Zelaron Gaming Forum

Zelaron Gaming Forum (http://zelaron.com/forum/index.php)
-   Tech Help (http://zelaron.com/forum/forumdisplay.php?f=329)
-   -   Brain Fuck Programming language... (http://zelaron.com/forum/showthread.php?t=2111)

spa 2002-04-06 10:58 AM

Brain Fuck Programming language...
 
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

Wiccan][V][asta 2002-04-06 11:09 AM

I wish I understood the whole programming languages/stuff/yeah... My dad knows C++ and PASCAL tho... :) I guess I should ask him...

ZERONX 2002-04-06 12:01 PM

My dad's a web deisgner though he did do c++ for a little while

floppy_gunk 2009-12-24 03:05 PM

I'm currently learning BF (though there's not much to learn). the "," command put single-character input into the current register. The "]" command loops back to the corresponding "[" command if the value at the current register is not equal to 0. If it is equal to 0, then the "]" is ignored.


All times are GMT -6. The time now is 08:01 PM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
This site is best seen with your eyes open.