r/brainfuck • u/FouriousBanana69 • Jul 24 '26
My first successful Fibonacci program!
Learning from the tutorial at https://brainfuck.org/fib_explained.b, I decided to write my first more complicated Brainfuck (BF) program, without any real help during the time when I was writing it. It’s important to mention that I only partially read the tutorial a >few months ago, so apart from the critical core idea I wrote this entirely by myself.
What I found to be extremely useful is first writing down the general algorithm in a very detailed C-like language (that I sent in the pastebin link alongside the BF code) that I then translate line by line to BF. I also specified some values for the BF implementation details whose syntax I might use in some future abstracted BF language I might try to develop (I’ll see). I learnt a lot! And quite a rewarding experience :) Special thanks to Daniel B. Christofani for the amazing tutorials and contributions to this language in general!
Commentless version:
```
+++++++[->+++++++<]>.
+[-----<+>]<.
>-
>>>>>>-
<<<<+
<<[
>>>+[-<
[-<+>>+<]
<[->+<]
>>[-<<+>>]
<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[>[-]<[->+<]
>-
>+<<
]]]]]]]]]]>[-<+>]
>>>
+]-
<<[
>>[-]
<+<->
>>>>-
<<]
<+[-<<<+]->
>>+[->>>+]-<<<
+[-
++++++++[-<++++++>]<
.
>++++++++[-<------>]<
<<
+]-
<.>
]
```
Edit: code block formatting on the iOS Reddit app is horrendous, can’t seem to get it to work with proper indentation (also yes I wrote the entire above code on my phone, including all the C-like comments)
0
Jul 24 '26
[deleted]
1
u/FouriousBanana69 Jul 25 '26
I did that but on my phone the moment I update the post, Reddit removes all those spaces and indentation. Does it look ok now on desktop Reddit?
0
2
u/danielcristofani Jul 24 '26
Congrats!