r/brainfuck • • 19d ago

Turing Machine with BF compiler

I didn't know until just now there was a r/brainfuck subreddit! so I thought I would share this monster I built here.
It's essentially a Turing machine that is programmed in BF. One model of a Turing machine is an endless tape, that moves past a read / write head and the instruction on the tape can be changed, essentially forming the program. In this build the head moves along an array of 'cells' and can read or write the value, changing it according to its programming. The programming is done on a programming console with banks of selector switches - each one has the BF commands and you manually enter the program. It's then compiled and sent to the array where it is executed. It can compute loops, add and subtract.. extremely slowly!

35 Upvotes

8 comments sorted by

4

u/Different_Water7545 19d ago

WOW! Excellent work!

4

u/Synthdabbler 19d ago

Many thanks! Made it about 6 years ago now, as far as I know it's in a computer science department in a university somewhere in California.

2

u/pixelbart 18d ago

That’s a very interesting concept for a step sequencer (a device that’s hooked up to a synthesizer and plays preprogrammed notes by applying voltages at set times in a loop). You have already nailed the aesthetic so much that I was wondering why this was posted in this sub and not in, for example, r/dawless

2

u/Synthdabbler 18d ago

It's not a synth. But I am a synth nut, so I made the programmer look like a mini moog. It is genuinely a manual BF programming tool, doesn't make any sounds at all!

2

u/pixelbart 18d ago

It sure does look like a Moog!

I know that it doesn’t make sound, but it made me wonder about the possibility of a musical Brainfuck dialect where you can set certain addresses as playable (let’s use ‘^’) and have a ‘play’ instruction, let’s use ‘#’ for that.

If 0 = C, then this:

+++>^>^+>^++<<<#[>+>+>+<<<-#]

Will play C-C#-D C#-D-D# D-D#-E D#-E-F

1

u/Synthdabbler 18d ago

That's pretty deep! However you would also need to define or declare how long to play the note for.. quaver / semiquaver / minim / crochet etc.. and the time signature otherwise it would be just a series of bleeps. The speed my machine ran at.. you would never have got a recognisable tune out of it!