It was developed in 1993 by Urban Müller on the Amiga.
It is a Turing-complete language with only 8 commands:
Code: Select all
<>,.[]-+
Basically, you have an array of 30000 cells. The instructions '<' and '>' move backwards and forwards along the array. '+' and '-' add or subtract one from the value held in the cell (they are initialised to zero). ',' is to input a character and '.' outputs to the screen. '[' and ']' allow you to do loops.
For instance:
Code: Select all
+++[>+++<-]
It's just for fun!
Anyway, I couldn't resist putting it on my RPi.
I used Urban Urban Müller's "Portable Brainf*ck Interpreter". You can download the source code here. Or you can get the binary I compiled here.
Here's a screenshot of me using the interpreter and then feeding a program to it.
The little bit of code I typed in:
Code: Select all
,++.
After that I fed this program to pbi. And, as you can see, it prints out my username.
Code: Select all
# brainfu*k program that prints my username
# The first line uses a loop to make the second cell hold the value 100
# Then we take away 3 to get 97 (the ascii value for 'a')
# Then this is printed
# You can work out the rest!
++++++++++[>++++++++++<-]>---.
<+++++[>+++<-]>--.
++++++.
<+++[>----<-]>+.
+++.
+++.
++.
++++.
<+++++[>----<-]>.
<++++++[>++++<-]>-.
<++++++++++[>-----------<-]>.