Brainf*ck is an esoteric programming language noted for its extreme minimalism.
What is an Esoteric Programming Language?
An esoteric programming language is a programming language designed to test the boundaries of computer programming language design, as a proof of concept, or as a joke.
A little bit of history...
Brainf*ck is the ungodly creation of Urban Muller in 1993. His intention was to design a
Get ready to be Brainf*cked!
As it was stated earlier, Brainf*ck is noted for its extreme minimalism. This language is very minimalistic because it only uses 8 symbols. 8 symbols? Yeahp! It only uses the symbols ><+-.,[ ]
Each symbol represents a command:
> Move the pointer to the right
< Move the pointer to the left
+ Increment the memory cell under the pointer
- Decrement the memory cell under the pointer
. Output the character signified by the cell at the pointer
, Input a character and store it in the cell at the pointer
[ Jump past the matching ] if the cell under the pointer is 0
] Jump back to the matching [ if the cell under the pointer is nonzero
Let's look at a C equivalent to understand further:
(Program Start) char array[30000]; char *ptr=array;
> ++ptr;
< --ptr;
+ ++*ptr;
- --*ptr;
. putchar(*ptr);
, *ptr=getchar();
[ while (*ptr) {
] }
The essence of Brainf*ck programming is to manipulate the 'tape' using the 8 listed commands. Let's try to program in Brainf*ck!
The classic Hello World! program Brainf*ck style:
+++++ +++++ initialize counter (cell #0) to 10
[ use loop to set the next four cells to 70/100/30/10
> +++++ ++ add 7 to cell #1
> +++++ +++++ add 10 to cell #2
> +++ add 3 to cell #3
> + add 1 to cell #4
<<<< - decrement counter (cell #0)
]
> ++ . print 'H'
> + . print 'e'
+++++ ++ . print 'l'
. print 'l'
+++ . print 'o'
> ++ . print ' '
<< +++++ +++++ +++++ . print 'W'
> . print 'o'
+++ . print 'r'
----- - . print 'l'
----- --- . print 'd'
> + . print '!'
> . print '\n'
Our group mate then tried programming in Brainf*ck (lakas mo brad!):
The Group's Feedback:
"The language's name is so appropriate! It will really mess up with your brain. It's an interesting challenge for every programmer with a lot of time to waste! Haha. I thought that assembly was already cryptic, but when I saw this PL, BOOM! All I can say is "WTF." This programming language is so cool! Mr. Muller, what have you done? "
- Ivan Escamos, 2010-42113
"Brainf*ck language can turn your brain upside down when it comes to programming complex implementations. An amusement for bored programmer geeks who wants extreme challenges."
- Ciejay Hernandez, 2010-41303
" Brainf*ck is awesome but mind distorting. Coding in such a language takes a lot of time and effort. However, it helps to be familiar with the ascii code."
- Ian F. del Barrio, 2010-45988
- Ian F. del Barrio, 2010-45988
"Hindi siya readable.. Hindi rin sya writable... Mahirap aralin... Parang unfriendly sa mata yung symbols..."
-Keeshiah Ong, 2010-52851
References:
http://en.wikipedia.org/wiki/Brainfuck
http://esolangs.org/wiki/brainfuck
http://www.muppetlabs.com/~breadbox/bf/
No comments:
Post a Comment