View Single Post
 
Brain Fuck Programming language...
Reply
Posted 2002-04-06, 10:58 AM
I bet a lot of you would be surprised that there are tons of programming languages out there which were created solely for fun, and to be as complicated as possible.

Enter Brain F u c k (or commonly refered to as BrainF lol).

What does it consist of?
+-<>,.[]

*counts* Yep. That's all 8 of them. That is the whole language. 8 lousy characters.

If it's confusing now, here's some sample code:
Code:
>
+++++++++[<+++++++>-]<++++.---------.>>
++++++++++[<+++++++++>-]<++.<++++.,
>>>++++++++++.>>+++++++++[<+++++++>
-]<+++.>>+++++++++++[<+++++++++>-]<--
.+++.>>++++++[<+++++>-]<++.>>++++++++
+++[<+++++++++>-]<.>>+++++++++++[<++
++++++++>-]<+.--..>>+++++++++++[<+++++
++++>-]<--.>>+++++++++++[<++++++++++>-]
<.>>+++++++++++[<+++++++++>-]<+.>>++++
++[<+++++>-]<++.>>+++++++++++[<+++++++
+++>-]<+.+++.>>++++++[<+++++>-]<++.>>++
+++++++++[<+++++++++>-]<+++.>>+++++++
++++++++[<+++++++>-]<.+++.-------.>>+++++
+[<+++++>-]<++.>>+++++++++++[<+++++++
+++>-]<.>>+++++++++++[<+++++++++>-]<--
.>>+++++++++++[<++++++++++>-]<-.>>++++
+++++++++++[<+++++++>-]<----.>>++++++++
++.
(I added carriage returns for the benefit of all of you :P BF code usually can't contain any.)

I wrote that myself by the way ;D Now I'd tell you exactly what's going on in it, but I can't entirely remember! All I can say is that it *looked* like a C:\> prompt, but didn't do much, just took some input, didn't even look at it, and did some output.

I'm gonna try to remember this from memory, so it may be a bit off.
+: Increases current register
-: Decreases current register
.: Outputs current register
,: Gets input (into current register??? I can't remember)
>: Moves to next register
<: Moves to previous register
[: Start bracket (very odd)
]: End bracket (very odd)

Now the [ ] characters are quite odd to say the least....using them you can multiply registers..I have no idea how it works, but I used it in my code to increase the number in the current register using less characters...

There are lots of sites on BrainF, I'm sure if you're interested you can find one
Old
Profile PM WWW Search
spa is neither ape nor machine; has so far settled for the in-betweenspa is neither ape nor machine; has so far settled for the in-between
 
spa