Help with BF program

I found a BrainFuck Porgram and I wanted to know what it does.
Can anyone comment on what each step does?
I have no experience in this and someone with experience will probably recognize patterns they have seen earlier.
A big thanks to anyone who can explain to me.
To me it looks like a trolling program because of the consecutive <<>>

>,------------------------------------------------

[<>>++++++++++
[<<++++++++++>>-]<<>>++++++++++
[<<++++++++++>>-]<<>>++++++++++
[<<++++++++++>>-]<<>>++++++++++
[<<++++++++++>>-]<<>>++++++++++
[<<++++++++++>>-]<<>>++++++++++
[<<++++++++++>>-]<<>>++++++++++
[<<++++++++++>>-]<<>>++++++++++
[<<++++++++++>>-]<<>>++++++++++
[<<++++++++++>>-]<<>>++++++++++
[<<++++++++++>>-]<<>-]

<>,------------------------------------------------
[<>>++++++++++
[<<++++++++++>>-]<<>-]

<>,------------------------------------------------
[<++++++++++>-]

<>,------------------------------------------------
[<+>-]
<>>>>++++++++++++++++++++++++++++++++++++++++++++++++>++++++++++++++++++++++++++++++++>++++++++++<<<<<<

[>+>>+<<<-]>>>
[<<<+>>>-]<<

[<
[>>+>+<<<-]>>>
[<<<+>>>-]<
[>>.>.<<<-]>>>>.<<<<<-]
Last edited on
You may need to edit your post and take it out of the code tags, since the code tags swallowed that first set of "----"s

Try using output tags instead


As for the actual program, I can't help. I wouldn't touch this language with a 10-foot pole.
Removed the useless <>s.
>,------------------------------------------------ reads a character and subtracts 48
(though I didn't count the minuses) to get numeric value of a digit instead of ascii code

[>++++++++++
[<<++++++++++>>-]++++++++++
[<<++++++++++>>-]++++++++++
[<<++++++++++>>-]++++++++++
[<<++++++++++>>-]++++++++++
[<<++++++++++>>-]++++++++++
[<<++++++++++>>-]++++++++++
[<<++++++++++>>-]++++++++++
[<<++++++++++>>-]++++++++++
[<<++++++++++>>-]++++++++++
[<<++++++++++>>-]<-] I think this writes 1000*the number previously entered to
 the first cell (again, didn't really count)

,------------------------------------------------ same as line 1
[>++++++++++
[<<++++++++++>>-]<-] Adds 100*the number entered to the first cell

,------------------------------------------------
[<++++++++++>-] Adds 10*the number entered

,------------------------------------------------
[<+>-] Adds 1*the number entered
>>>++++++++++++++++++++++++++++++++++++++++++++++++>++++++++++++++++++++++++++++++++>++++++++++<<<<<<
Fills cells 5, 6, 7 with 48, 32, 10, which are zero, space and newline respectively

[>+>>+<<<-]>>> moves the value of cell 1 to cells 2 and 4
[<<<+>>>-]<< moves cell 4 back to 1 the result being cell 1 copied to cell 2

[< while there is something in cell 1
[>>+>+<<<-]>>>
[<<<+>>>-]< copy it to cell 3
[>>.>.<<<-] print "0 " as many times as cell 3 says
>>>>.<<<<<-]then print a newline and repeat the process 

It seems that this program reads a decimal number and then draws a triangle of that many zeros. I didn't run it, so I could be totally wrong though.
Last edited on
Is it made by C++? Doesn't look like C++
Last edited on
Nah, it's an esoteric language called "Brainfuck"

Basically, the language was designed to be damn near impossible to work with. (because the authors can) :P
Topic archived. No new replies allowed.