BrainFizuck
Community Forums/Showcase/BrainFizuck
| ||
BrainF*ck interpreter. |
| ||
Probably the most useless thing written in blitz :P Ah well, Kinda cool :D |
| ||
Here is a serpenski triangle :-) alter the code with this" Graphics 80*10,45*10,0,2 ;optional FIL =ReadFile("C:\BF.TXT") Repeat CODE$=CODE$+ReadLine(FIL) Until Eof(FIL) |
| ||
Thats more like it :D My interpreter is already better though :P (well, once I work out variables) |
| ||
this one takes input from the console (0 terminated) and prints out a BF program that prints the BF source ;-)+++++[>+++++++++<-],[[>--.++>+<<-]>+.->[<.>-]<<,]>>>>>>>>>++++++++++. |
| ||
Now all you have to do is write BF in BF :D |
| ||
lol how do you enter code? |
| ||
Instead of having the input from the console, get each char from a file stream. |
| ||
Huh... Looking at the source code above... > and < move forward or back one location in an array, while + and - incremenet or decrement the value at the current location. . writes a character to a string called OUT$, unless that character is a line feed, (10) in which case it prints the data contained in OUT$ and clears OUT$. , gets keyboard input and writes the key to the current array location. And [ and ] appear to be some kind of loop but I can't figure out how the hell it works. Interesting. But useless. :-) |
| ||
"[" is simply a loop initiator "]" will throw the pointer back to its matching "[" if the value at the current pointer is not 0. Loops can be nested. This program "++++++[-]" increments the value of the current pointer by 6 then enters a loop that decriments the value at that pointer until it hits 0 and the program ends. The neat thing about it is that its a Turing complete language. you could write OO programs in it if you wanted to. not sure why anyone would though ;) |
| ||
I forgot all about that language... |