r/brainfuck • u/Imagine-existance • Feb 21 '20
r/brainfuck • u/TheFrog36 • Feb 24 '26
Brainfuck visualization
Given the semplicity of the b.f. code i was wondering if the symbols could be used as rule to generate something somewhat artistic. This is an example of the classic "Hello world" program
r/brainfuck • u/Ahineya_it • Aug 27 '25
I made a professional-grade Brainfuck IDE. And used it to come closer than ever to running Doom in Brainfuck.
TL;DR: I made a Brainfuck IDE, macro language, RISC-like virtual machine in it, assembler for the VM, buggy C compiler, macro assembler, and used all of it to display Doom's titlepic — technically still in Brainfuck (and memory-mapped Brainfuck tape for IO). The IDE is live here https://braintease.dev with a bunch of Brainfuck, IDE, and macro language tutorials inside. And assembler.
---
So recently I saw a video — someone made a snake in Brainfuck. It was fun, buggy, and for some reason turned the "can I do better" crank inside me. And I think I did.
First, I wanted to remember how to even code in Brainfuck. I looked at currently available tooling — and was kinda disappointed. Being a professional developer and designer for the past ~20 years, I got used to nice IDEs, with debuggers, modern tooling, thought-through UI... Nothing of it existed for the Brainfuck. For some reason, companies like JetBrains do not see Brainfuck as a language worth investing into. So I did what every sane person would do in that case — I started writing my own code editor. Not the IDE — the code editor component for web, to build the IDE on top of it. Of course, I could have used Monaco, but after working with it for some time in the past, I wasn't sure that it would be easy to display a green rectangle over currently executed Brainfuck command in it.
After making the editor, and tokenizer to highlight Brainfuck code in it, I added the tape visualization — to actually see what all my +<[]>- do, and quickly made an interpreter v1, so I could finally execute some code. I played around, remembered how to actually use my >, wrote some simple algos, and made a 70-line prototype of how the "fetch - decode - execute - memory - write back" pipeline may even look in Brainfuck

Then I looked at that 70-line prototype on the next day, and understood that I have no idea how it works anymore. It was time to add some ✨abstractions✨
So I extended my code editor to support a second language, and started to build this second language — basically, a macro expander on steroids, properly AST'd and parsed to support code analysis, refactoring, and non-regex code highlighting. And wrote my first #define right(n) {repeat(n, >)}.
As it turned out, the power to name series of >>> characters makes wonders on one’s ability to understand the code. Suddenly, the VM started to get shape. I still needed to solve a lot of things, like how exactly do I layout everything on a Brainfuck tape, or how the hell do I do binary operations in it. Or even “how do I emulate a random memory access in a language that is inherently sequential”. Pointers in Brainfuck, baby. And then it hit me.
Lanes! I could abstract the tape itself to make it easier to work with! I believe, this technique was used previously, at least I saw it before in u/danielcristofani 's Sierpinski triangle demo. The basic idea is not to think about BF tape as about one lane, but as [[0, 1, 2], [3, 4, 5], [6, 7, 8]] a bunch of grouped values. Each first value in these groups forms the first lane, each second — the second lane, and so on. While still being on the same tape, just thinking about it differently helped a lot. I dedicated one lane to registers, one lane to opcodes, two lanes as scratch lanes for ALU ops, etc. And, I was able to use a whole dedicated lane to build the trails of ones to quickly get me to the place I need to be. The pointers were solved. I quickly added the lanes visualization mode to my tape.
I continued working on the VM implementation, and hit another wall — I really, really needed to stop the execution at a particular point in code, and manually step through the Brainfuck commands to make sure that I got, let’s say, a division algorithm right. So I added an ability to set breakpoints in Brainfuck code like you usually do in other programming languages — by clicking on a line number. Also, I shoved the “$” symbol to be recognized by my interpreter as a code breakpoint (is this the place where I lose all the interest from Brainfuck purists, or I already lost you at “macro language”? 😁)
After this, the rest was actually easy — if you find making virtual machines easy. After all, it is just moving some numbers here and there — and Brainfuck is good at it.

So I got the whole virtual machine working: I was able to execute arbitrary machine code on it by setting up tape cells to those opcodes (the story of How I Made a Turing Tarpit Less Tarpit-y). It took only around 900k Brainfuck commands!
But you know, programming in machine codes is like... Coding in Brainfuck. Hard to understand, easy to make a mistake.
And once again, I did what every sane person would do on my place — I wrote assembler and linker, so they could spit me the exact Brainfuck code, that would set those machine codes somewhere on Brainfuck tape before the virtual machine starts executing those.
But you know, programming in assembly is like... Coding in Brainfuck. Hard to understand, easy to make a mistake.
So of course I wrote a C compiler. It actually got me into a whole bunch of another fun mini projects, like writing a test suite TUI for it. Then, when I was getting to around 50 tests, waiting for them to run on Brainfuck virtual machine was excruciating, so I wrote the same virtual machine, but in Rust, so I could debug my C compiler on it, while still being able to compile everything down to Brainfuck...

I added memory-mapped I/O to the VM, so I could not only spit ASCII, but also emulate work with the game controller, keyboard, 40x25 terminal, then RGB565-based double-buffered screen, and a tiny persistent storage rw driver...
Wrote a whole bunch of demos for all of it, starting with FizzBuzz, and Brainfuck interpreter, and ending with a working Tetris game, and Forth machine...
Just to find out that somewhere in my C compiler lies a bug which corrupts memory, but only when the program size exceeds some particular value. And that particular value was the exact one I needed to go over to actually write a Doom .wad files parser — so I just adapted my already powerful macro language to be able to spit out assembly, and wrote the parser in macro assembly.
Seeing Doom titlepic showing up in my VM was like writing some complex algorithm in Brainfuck and succeeding.

And the beauty? All the programs that do not require memory-mapped IO still work in your regular Brainfuck interpreter like https://copy.sh/brainfuck/ — just make sure to set cell size to 16 bits, memory size to at least a million, and memory overflow behavior to wrap.
---
So yeah, that was a very fun ride. To give something back to the community, I put the IDE on https://braintease.dev, added a whole bunch of tutorials in there, and dumped all the code on Github. Just be aware — a lot of it, and I mean A LOT of it except the VM, brainfuck, macro, and assembly code, and the code editor itself was made with a different degree of help from Claude Code, and I didn’t even care about looking in it if it was doing what I need. You have been warned https://github.com/ahineya/braintease
If you like the IDE, and would like to contribute some Brainfuck tutorials to include in it — now you know where to find me.
Cheers everyone!
r/brainfuck • u/MarsRuler • May 18 '21
My CS teacher said I can use any language for the homework, so I did it in brainfuck
Homework instruction:
Write a program that finds the first Fibonacci number that is also a square of an integer bigger than 1.
My answer:
+>+>+>+[-<<<[->>>+<<<]>[-<+>>>+<<]>>[-<<+>>]+[-<[->+>+>+<<<]>[-<+>]>[->>+<<]>[->[->+<<<+>>]>[-<+>]<<]>[-]<<<<<[->>+>>+<<<<]>>>>[-<<<<+>>>>]<<>>>>+[<<<<[->]>>]>>[<<<<[-]>[[-]>+<]>>>>]<-<<<[-]<[-]+>>[-<<->>]<<<+>]<--[->+>+>+<<<]>>>[-<<<+>>>]<<[->>+<<]>[->[->+<<<+>>]>[-<+>]<<]>[-]<<<<[->>>+>+<<<<]>>>>[-<<<<+>>>>]<<>>>>+[<<<<[->]>>]>>[<<<[>>>-<<<[-]]<[>>>>[-]<<<<[-]]>>>>+>]<-<<<[-]<[-]+>>>>[-<<<<->>>>]<<<<]<<.
You can find the annotated (easier to read) version here on GitHub
https://github.com/martian17/fib-square-brainfuck
I'm new to brainfuck, but I'm surprised how readable it gets with proper comments and indentation. Also, learning brainfuck has been eye-opening to me because now I have more intuitive understanding of how stack machines function!
r/brainfuck • u/pat621 • Jul 15 '25
I designed some hardware to run brainfuck natively
The instructions and "tape" are separate bits of ram and instructions are all mapped from 0 to 7, it is fairly slow because i didnt implement anything fancy like moving or adding by some integer amount instead of one at a time, but every instruction besides adding/subtracting (two cycles to read and write to ram) executes in 1 clock cycle
r/brainfuck • u/Weekly-Ad2984 • Nov 23 '25
Hello dear brainfuck users I made a puzzle I made a script that says Hello, Brainfuck! But I made 1 mistake in it so it doesn't work properly try and find the mistake in the code good luck!
r/brainfuck • u/ZeroOne3010 • Apr 06 '24
I used SignMyRocket.com to brainfuck the invaders in Ukraine 🇺🇦
r/brainfuck • u/[deleted] • Mar 10 '19
BF Designer (IDE)
BF Designer is a powerful IDE made to write and run Brainfuck Programs.
Some Features:
- Extensive debugger with pause, step by step, and breakpoint features.
- Toggle between 8-bit and 16-bit cells
- Many useful pre-made code snippets with the ability to add your own snippets.
- Export BF code as a Python or Java.
- Syntax highlighting.
- Auto-complete.
- Customize font, color scheme.
- Modern, clean UI.
- Fully scalable app size for high DPI displays
MADE IN JAVA:
This means that it can run on most* machines with java installed.
*Keep in mind that the EXE launcher used to start the app may not work on your system. In that case just launch the program directly by running the JAR file in the bin folder.
r/brainfuck • u/Dragon-Hatcher • Jun 18 '20
Connect 4 in Brainfuck: My First program
place markers denoting zones:
-- >+>+>+>+>+>+>+>+>+>+ >+>+>+>+>+>+>+>+>+>+ >+>+>+>+>+>+>+>+>+>+ >+>+>+>+>+>+>+>+>+>+ >+>+> none (starts full)
-- >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>> o
-- >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>> x
- > this is the reference board is to the left :c0
create pipe reference:
>> +++ +++ +++ +++ get 12 into x2 :c2
> +++ +++ +++ + get 10 into x3 :c3
<<< :c0
>>>[<[<+<+>>-]<[>+<-]>>-]<[-]<< multiply x2 and x3 into x0 :c0
++++ :c0 tape: 124/ 0
create plus reference:
>>> +++ +++ +++ + get 10 into x2 :c2
> +++ + get 4 into x3 :c3
<<< :c0
>>>[<[<+<+>>-]<[>+<-]>>-]<[-]<< multiply x2 and x3 into x0 :c0
+++ :c0 tape: 124/ 0
create minus reference:
[>+>+ <<-] copy plus to x2 and x3 :c1
>>[<<+>>-] copy x3 back to x1 :c3
<++ move to x2 and add two for minus :c2
create space reference:
>>> +++ +++ ++ get 8 into x2 :c2
> +++ + get 4 into x3 :c3
<<< :c0
>>>[<[<+<+>>-]<[>+<-]>>-]<[-]<< multiply x2 and x3 into x0 :c0
create o reference:
>>> +++ +++ ++ get 8 into x2 :c2
> +++ +++ +++ + get 10 into x3 :c3
<<< :c0
>>>[<[<+<+>>-]<[>+<-]>>-]<[-]<< multiply x2 and x3 into x0 :c0
- :c0
create x reference:
>>> +++ +++ ++ get 8 into x2 :c2
> +++ +++ +++ ++ get 11 into x3 :c3
<<< :c0
>>>[<[<+<+>>-]<[>+<-]>>-]<[-]<< multiply x2 and x3 into x0 :c0
create new line reference:
>+++ +++ +++ +
create board stop:
>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>+
>>>>>>>----
>>>>>>>----
>>>>>>>----
>>>>>>>----
>>>>>>>----
>>>>>>>-----
<<<<<<<
<<<<<<<
<<<<<<<
<<<<<<<
<<<<<<<
<<<<<<<
<<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<<<
create board anchor:
>>---<
reference lineup: x0: pipe/plus/minus/space/o/x/new line
<<<<<<<
[
draw board: starts x0
>.>.......<.>>>>>.<<<<<< draw top line :c0
.
get character:
+++[--->+++]--- glide to board anchor
>-
[
+<
<<<<<<<< skip reference characters
<<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<< go 43
-[
--- mark
+[->+]- glide
>>>>>>>> move to mark spot
+
++++[----<++++]---- guide to mark
++++
<<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<< go 43
-[
--- mark
+[->+]- glide
>>>>>>>> move to mark spot
+
++++[----<++++]---- guide to mark
++++
<<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<< go 43
-[
--- mark
+[->+]- glide
>>>>>>>> move to mark spot
+
++++[----<++++]---- guide to mark
++++
]
]
]
+
+[->+]- glide to solid ref
>>>>>>>> go to count
[
>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>>+
<<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<<<<<<<<-
]
>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>>
[-[-<]<]<<
<<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<<<<<<<<.
+++[--->+++]--- glide to board anchor
>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>
[
+[-<+]- glide to solid ref
>.>>>>>>.
+++[--->+++]--- glide to board anchor
>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>
+++++
[
+[-<+]- glide to solid ref
>.
+++[--->+++]--- glide to board anchor
>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>
-
]
]
<<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<<
+++[--->+++]--- glide to board anchor
+++>---
>-
]
+
<+++>
>>>>>>>----
>>>>>>>----
>>>>>>>----
>>>>>>>----
>>>>>>>----
>>>>>>>-----
<<<<<<<
<<<<<<<
<<<<<<<
<<<<<<<
<<<<<<<
<<<<<<<
<<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<
---
<<<<<<<.>.......<.
end draw board
get input
+++++[----->+++++]----->
>>+
[
<<[-]>>
[-],-
>>>+++++++>+++++++
<<< >>>[<[<+<+>>-]<[>+<-]>>-]<[-]<<- multiply x2 and x3 into x0 :c0
[<->-]++++++<
[<+<+>>-]<[>+<-]>
[->-[<<]>]
+++++[-----<+++++]----->>>
]
>[-]<<<
>>>>>>>>>>
[--<] swap
+++++[-----<+++++]----->>>>>>>>>> >+
<<<<<<<<<<
[-[-[-[-[-[->]>]>]>]>]>]
<<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<<<<<<<<
<<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<<<<<<<< <<<<<<<<<<
<<<<<<<<
-[+<<<<<<<-]+
-
>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>++
>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>+++
+++++[----->+++++]----->>>>>>>>>>>
[
---[+++<---]+++
-<
--[++<--]++
+
+++++[----->+++++]----->>>>>>>>>>
]
+++++[-----<+++++]----->>>>>>>>>>>
--[++<--]++ -
+[->+]-
---[+++<---]+++ ---
+[->+]->
>>>>>>.<<<<<<
]r/brainfuck • u/MaybeTheGreat • Sep 13 '20
Calculator in Brainfuck
Today I wrote this Calculator program.What do you think?
[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++++++++++++++++++.++++++.---------------.+++++++++++++.----------------------------------------------------------------------------------.++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++.+++++++++.+.+.------------------------------------------------------------------------------------.++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++.--------.-----------.+++.+++++++++++++.--------------------------------------------------------.------------------------------------------------.[-]Printing string
>>>>>>>>>>>>>>[-]>[-]+[[-]>[-],[+[-----------[>[-]++++++[<------>-]<--<<[->>++++++++++<<]>>[-<<+>>]<+>]]]<]<<<<<<<<[-]>>>>>>>>>>>>[-] <<<<<[<<<<<<<+>>>>>>>>>>>>+<<<<<-] >>>>>[<<<<<+>>>>>-]<<<<<[-]Read
<<<<<<<<<<<<<<[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++.--.++.++++.+++++++++++++.-----------------.-.--------------------------------------------------------------------.++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++.--------.-----------.+++.+++++++++++++.----------------------------------------------------------------------------------.[-]>>>>>>>>>>>>>>Printing string
>>>>>[-] <<<<<<<<<<<<[>>>>>>+>>>>>>+<<<<<<<<<<<<-] >>>>>>>>>>>>[<<<<<<<<<<<<+>>>>>>>>>>>>-]<<<<<<[<+<+>>-]<>>++++++++++<<[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]>>[-]>>>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]>>[>++++++[-<++++++++>]<.<<+>+>[-]]<[<[->-<]++++++[->++++++++<]>.[-]]<<++++++[-<++++++++>]<.[-]<<[-<+>]<<[>>+<<-]>>[-]<[-]<[-]print byte
<<<<<<<<<<<[-]++++++++++.[-]>>>>>>>>>>>Printing string
<<<<<<<<<<<[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++++++++++++++++++.++++++.---------------.+++++++++++++.----------------------------------------------------------------------------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.--------------.--.++++++++++++.-.----------.--------------------------------------------------------------------.++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++.--------.-----------.+++.+++++++++++++.--------------------------------------------------------.------------------------------------------------.[-]>>>>>>>>>>>Printing string
>>>[-]>[-]+[[-]>[-],[+[-----------[>[-]++++++[<------>-]<--<<[->>++++++++++<<]>>[-<<+>>]<+>]]]<]<<<<<<<[-]>>>>>>>>>>>[-] <<<<<[<<<<<<+>>>>>>>>>>>+<<<<<-] >>>>>[<<<<<+>>>>>-]<<<<<[-]Read
<<<<<<<<<<<<<<[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++.--.++.++++.+++++++++++++.-----------------.-.--------------------------------------------------------------------.++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++.--------.-----------.+++.+++++++++++++.----------------------------------------------------------------------------------.[-]>>>>>>>>>>>>>>Printing string
>>>>>[-] <<<<<<<<<<<[>>>>>+>>>>>>+<<<<<<<<<<<-] >>>>>>>>>>>[<<<<<<<<<<<+>>>>>>>>>>>-]<<<<<<[<+<+>>-]<>>++++++++++<<[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]>>[-]>>>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]>>[>++++++[-<++++++++>]<.<<+>+>[-]]<[<[->-<]++++++[->++++++++<]>.[-]]<<++++++[-<++++++++>]<.[-]<<[-<+>]<<[>>+<<-]>>[-]<[-]<[-]print byte
<<<<<<<<<<<[-]++++++++++.[-]>>>>>>>>>>>Printing string
<<<<<<<<<<<[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++++++++++++++++++.++++++.---------------.+++++++++++++.----------------------------------------------------------------------------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+.-----------.+++++++++++++.-----------------.+++++++++++++++++++.-----.+++.----------------------------------------------------------------------------------.++++++++.+++.+.+.-.--.++.+++.------.+++++++++++++++++.------------------------------------------------.[-]>>>>>>>>>>>Printing string
<<<<<,Read
>>>[-]+++++++++++++++++++++++++++++++++++++++++++KInt
KInt
>[-]>[-] <<<<<[>>>>+>+<<<<<-] >>>>>[<<<<<+>>>>>-]<<<<<<<<<<<[-]>[-]>>>>>>>>>[<<<<<<<<<+>>>>>>>>>-]+<[<<<<<<<<-<+>>>>>>>>>-]<<<<<<<<<[>>>>>>>>>+<<<<<<<<<-]>[>>>>>>>>>-<<<<<<<<<[-]]equal than
>>>[-]>>>>>>>[-] <[<<<<<<+>>>>>>>+<-] >[<+>-]CodeCond
[-]+>[-]<<<<<<<<[CL
<<<<[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++..------------------------------------------------------------------------------------------.[-]>>>>Printing string
>>>>>>>>>[-]>[-] <<<<<<<[>>>>>>+>+<<<<<<<-] >>>>>>>[<<<<<<<+>>>>>>>-][-] <<<<<<[>>>>>+>+<<<<<<-] >>>>>>[<<<<<<+>>>>>>-]Add
>>>>>>>>>>[-] <<<<<<<<<<<[>>>>>+>>>>>>+<<<<<<<<<<<-] >>>>>>>>>>>[<<<<<<<<<<<+>>>>>>>>>>>-]<<<<<<[<+<+>>-]<>>++++++++++<<[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]>>[-]>>>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]>>[>++++++[-<++++++++>]<.<<+>+>[-]]<[<[->-<]++++++[->++++++++<]>.[-]]<<++++++[-<++++++++>]<.[-]<<[-<+>]<<[>>+<<-]>>[-]<[-]<[-]print byte
<<<<<<<<<<<<<<<<[-]++++++++++.[-]>>>>>>>>>>>>>>>>Printing string
<<<<<-<<<<<<<[>>>>>>>>+<<<<<<<<-]]>>>>>>>>[<<<<<<<<+>>>>>>>>-]<[CL
>>>[-]+++++++++++++++++++++++++++++++++++++++++++++KInt
KInt
>[-]>[-] <<<<<<<<<<[>>>>>>>>>+>+<<<<<<<<<<-] >>>>>>>>>>[<<<<<<<<<<+>>>>>>>>>>-]<<<<<<<<<<<<<<<<[-]>[-]>>>>>>>>>>>>>>[<<<<<<<<<<<<<<+>>>>>>>>>>>>>>-]+<[<<<<<<<<<<<<<-<+>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<[>>>>>>>>>>>>>>+<<<<<<<<<<<<<<-]>[>>>>>>>>>>>>>>-<<<<<<<<<<<<<<[-]]equal than
>>>[-]>>>>>>>>>>>>[-] <[<<<<<<<<<<<+>>>>>>>>>>>>+<-] >[<+>-]CodeCond
[-]+>[-]<<<<<<<<<<<<<[CL
<<<<[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.++.-------------------.++++++++++++++++++.--.-----------------.++.+++++++++++++++++.----------------------------------------------------------------------------------------------------------.[-]>>>>Printing string
>>>>>>>>>>>>>>[-]>[-]<<<<<<<<<<<<[>>>>>>>>>>>+>+<<<<<<<<<<<<-]>>>>>>>>>>>>[<<<<<<<<<<<<+>>>>>>>>>>>>-]<<<<<<<<<<<<<<<<<[-]>>>>>>[>>>>>>>>>>-<<<<<<<<<<<<<<<<+>>>>>>-]<<<<<<[>>>>>>+<<<<<<-]Sub
>>>>>>>>>>>>>>>>>>>>>>>>>>>[-] <<<<<<<<<<<[>>>>>+>>>>>>+<<<<<<<<<<<-] >>>>>>>>>>>[<<<<<<<<<<<+>>>>>>>>>>>-]<<<<<<[<+<+>>-]<>>++++++++++<<[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]>>[-]>>>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]>>[>++++++[-<++++++++>]<.<<+>+>[-]]<[<[->-<]++++++[->++++++++<]>.[-]]<<++++++[-<++++++++>]<.[-]<<[-<+>]<<[>>+<<-]>>[-]<[-]<[-]print byte
<<<<<<<<<<<<<<<<<<<<<[-]++++++++++.[-]>>>>>>>>>>>>>>>>>>>>>Printing string
<<<<<-<<<<<<<<<<<<[>>>>>>>>>>>>>+<<<<<<<<<<<<<-]]>>>>>>>>>>>>>[<<<<<<<<<<<<<+>>>>>>>>>>>>>-]<[CL
>>>[-]++++++++++++++++++++++++++++++++++++++++++KInt
KInt
>[-]>[-] <<<<<<<<<<<<<<<[>>>>>>>>>>>>>>+>+<<<<<<<<<<<<<<<-] >>>>>>>>>>>>>>>[<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<<<<<<<<[-]>[-]>>>>>>>>>>>>>>>>>>>[<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>-]+<[<<<<<<<<<<<<<<<<<<-<+>>>>>>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<<<<<<[>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<-]>[>>>>>>>>>>>>>>>>>>>-<<<<<<<<<<<<<<<<<<<[-]]equal than
>>>[-]>>>>>>>>>>>>>>>>>[-] <[<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>+<-] >[<+>-]CodeCond
[-]+>[-]<<<<<<<<<<<<<<<<<<[CL
<<<<[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++.---------.++++++++.-----------.+++++++.----.+++++++++++++.---------------------------------------------------------------------------------------------------------------.[-]>>>>Printing string
>>>>>>>>>>>>>>>>>>>[-]>[-]<<<<<<<<<<<<<<<<<[>>>>>>>>>>>>>>>>+>+<<<<<<<<<<<<<<<<<-]>>>>>>>>>>>>>>>>>[<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<<<<<<<<<<<[-]>[-]>>>>>>>>>>>>>>>>>>>>>>[<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<<<<<<<<<[>>>>>>>[>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>-]<<<<<<<<[>>>>>>>>+<<<<<<<<-]>-]Mult
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-] <<<<<<<<<<<[>>>>>+>>>>>>+<<<<<<<<<<<-] >>>>>>>>>>>[<<<<<<<<<<<+>>>>>>>>>>>-]<<<<<<[<+<+>>-]<>>++++++++++<<[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]>>[-]>>>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]>>[>++++++[-<++++++++>]<.<<+>+>[-]]<[<[->-<]++++++[->++++++++<]>.[-]]<<++++++[-<++++++++>]<.[-]<<[-<+>]<<[>>+<<-]>>[-]<[-]<[-]print byte
<<<<<<<<<<<<<<<<<<<<<<<<<<[-]++++++++++.[-]>>>>>>>>>>>>>>>>>>>>>>>>>>Printing string
<<<<<-<<<<<<<<<<<<<<<<<[>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<-]]>>>>>>>>>>>>>>>>>>[<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>-]<[CL
>>>[-]+++++++++++++++++++++++++++++++++++++++++++++++KInt
KInt
>[-]>[-] <<<<<<<<<<<<<<<<<<<<[>>>>>>>>>>>>>>>>>>>+>+<<<<<<<<<<<<<<<<<<<<-] >>>>>>>>>>>>>>>>>>>>[<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<<<<<<<<<<<<<[-]>[-]>>>>>>>>>>>>>>>>>>>>>>>>[<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>-]+<[<<<<<<<<<<<<<<<<<<<<<<<-<+>>>>>>>>>>>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<<<<<<<<<<<[>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<-]>[>>>>>>>>>>>>>>>>>>>>>>>>-<<<<<<<<<<<<<<<<<<<<<<<<[-]]equal than
>>>[-]>>>>>>>>>>>>>>>>>>>>>>[-] <[<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>+<-] >[<+>-]CodeCond
[-]+>[-]<<<<<<<<<<<<<<<<<<<<<<<[CL
<<<<[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++.+++++++++++++.------------------------------------------------------------------------------------------------------------.[-]>>>>Printing string
>>>>>>>>>>>>>>>>>>>>>>>>[-]KInt
KInt
>[-]>[-] <<<<<<<<<<<<<<<<<<<<<<[>>>>>>>>>>>>>>>>>>>>>+>+<<<<<<<<<<<<<<<<<<<<<<-] >>>>>>>>>>>>>>>>>>>>>>[<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[-]>[-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>[<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>-]+<[<<<<<<<<<<<<<<<<<<<<<<<<<<<-<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<[>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<-]>[>>>>>>>>>>>>>>>>>>>>>>>>>>>>-<<<<<<<<<<<<<<<<<<<<<<<<<<<<[-]]equal than
>>>[-]>>>>>>>>>>>>>>>>>>>>>>>>>>[-] <[<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>+<-] >[<+>-]CodeCond
[-]+>[-]<<<<<<<<<<<<<<<<<<<<<<<<<<<[CL
>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-]KInt
KInt
>[-]>[-] <<<<<<<<<<<<<<<<<<<<<<<<<<<[>>>>>>>>>>>>>>>>>>>>>>>>>>+>+<<<<<<<<<<<<<<<<<<<<<<<<<<<-] >>>>>>>>>>>>>>>>>>>>>>>>>>>[<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[-]>[-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>-]+<[<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<-<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<-]>[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>-<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[-]]equal than
>>>[-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-] <[<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<-] >[<+>-]CodeCond
[-]+>[-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[CL
<<<<[-]++++++++++++++++++++++++++++++++++++++++++++++++.-.+.----------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++.-----------------------------------------------------------------------------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.-------.----------.+.+.+++.+++++.---------.-.------------------------------------------------------------------------------------------.[-]>>>>Printing string
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>-<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<-]]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>-]<[CL
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++.+++++++++++++.-------------.++++++++++.----------.++++++.-.------------------------------------------------------------------------------.++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++.-----------------------------------------------------------------------------------------.++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.---------------------.+++++++++++++.---.-------------------------------------------------------------------------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++.-----.-----------------------------------------------------------------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.------------------------------------------------------------------------------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++..+++.++++++++.------------------.-.------------------------------------------------------------------------------------------.[-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Printing string
-]<<<<-<<<<<<<<<<<<<<<<<<<<<<<<<<[>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<-]]>>>>>>>>>>>>>>>>>>>>>>>>>>>[<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>-]<[CL
>>>>>>[-]>[-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[-]>[-]>[-]>[-] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>-] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[ >>>>>>>>[<<<<<<<+>+>>>>>>-] <<<<<<[>>>>>>+<<<<<<-] <[ >+ <<-[>>[-]>+<<<-] >>>[<<<+>>>-] <[<-[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>-<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[-]]+>-]<-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]Div
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[-] <<<<<<<<<<<[>>>>>+>>>>>>+<<<<<<<<<<<-] >>>>>>>>>>>[<<<<<<<<<<<+>>>>>>>>>>>-]<<<<<<[<+<+>>-]<>>++++++++++<<[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]>>[-]>>>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]>>[>++++++[-<++++++++>]<.<<+>+>[-]]<[<[->-<]++++++[->++++++++<]>.[-]]<<++++++[-<++++++++>]<.[-]<<[-<+>]<<[>>+<<-]>>[-]<[-]<[-]print byte
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[-]++++++++++.[-]>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Printing string
<<<<<<<<<-]<<<<-<<<<<<<<<<<<<<<<<<<<<<[>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<<-]]>>>>>>>>>>>>>>>>>>>>>>>[<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>-]<[CL
<<<<<<<<<<<<<<<<<<<<<<<<<<[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.-------.---.+++.+.++++++++.---------.------------------------------------------------------------------------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+.-----------.+++++++++++++.-----------------.+++++++++++++++++++.-----------.++++++.-.----------------------------------------------------------------------------------------------------.[-]>>>>>>>>>>>>>>>>>>>>>>>>>>Printing string
-]<<<<<-]<<<<<-]<<<<<-]
Examples:


r/brainfuck • u/Eli_IL • Sep 08 '20
Tic-Tac-Toe in Brainfuck
Today I added a Tic-Tac-Toe game, compiled to Brainfuck, to my Brainfuck compiler GitHub repository.
I did this to inspire people to write creative programs in Brainfuck :)
It is available at https://github.com/elikaski/BF-it
The game board looks like this:
1 | 2 | 3
---------
4 | 5 | 6
---------
7 | 8 | 9
Feel free to suggest / create more games :)
r/brainfuck • u/AND_MY_HAX • Sep 28 '17
My CPU that natively runs Brainfuck code
r/brainfuck • u/pxOMR • Oct 06 '19
VisualBrainfuck - A simple Brainfuck debugger for the Terminal
r/brainfuck • u/danielcristofani • Mar 12 '21
Game of Life in brainfuck.
I wrote a brainfuck program for John Horton Conway's Game of Life cellular automaton. This has been done before, but I'd been meaning to take a shot at it myself. Having years of brainfuck experience helped: mine is under a third as long, hundreds of times faster on naive interpreters, and uses less memory. Also I gave it a toroidal wrapping grid, and made it easy to change the board size.
Basic memory layout is 0 0 0 v t a v t a v t a ...
a cells hold the ASCII for the board (decreased by 9 most of the time to help with navigation). v cells hold the cell values of 0 for dead or 1 for live; then these are spread out to the 8 neighboring t cells and accumulated there. There are dummy cells on all sides of the board (mostly corresponding with the coordinate grid and the linefeeds), to catch the values that spread off the edge of the board. So values are then moved from the dummy t cells to the corresponding in-board t cells on the opposite side, first vertically and then horizontally; that's how I made the board wrap. After that, all the t values are used to calculate new v values. Originally I had a fourth category of cells dedicated to navigation, but I've managed to do all of it using only the v, t, and a cells. It helps that either the v cells or the t cells are empty most of the time.
r/brainfuck • u/stack_of_thoughts • 21d ago
Was wondering if I could make an LLM inside brainfuck
Was wondering if I could make an LLM inside brainfuck and that idea got a bit out of hand. So I present to you brnfck.chat
The video is Qwen2.5-1.5B as one file of 11,430,468,880 characters. First it writes all its numbers into memory, then it gets "What is 12 + 30?" and answers after about 461 billion steps.
The smallest one is SmolLM2-135M at 1,030,902,380 characters. There's also one that looks at photos, one that answers with brainfuck itself, and programs that train small networks inside brainfuck.
r/brainfuck • u/Holiday-Rise5724 • Oct 10 '26
Pi in 796 bytes
I wrote a brainfuck program that prints pi in decimal.
It was inspired by e.b by Daniel B. Cristofani: https://brainfuck.org/e.b
It use the fact that `pi = 2 + 1/3 (2 + 2/5 (2 + 3/7 (2 + 4/9 (2 + ...))))` and do the calcul thanks to this algorithm https://www.cs.williams.edu/~heeringa/classes/cs135/s15/readings/spigot.pdf
>>>>>>+>>>>>>>>++<++<+<+<+<+<++[
[>>>[>>>>]<<<<[[>>>>+<<<<-]<<<<]>>>>>]>+>+[
-[++<<<<<<[
>[-[->>>>+>>>>>>>>-[>>>>-]++[<<<<]]+>]<<<<<<<
]<++++++[->>++++++++<<]>>.>[-<-----.>]<[-]>>>[>>>>]>->
]+[
-<+<<<<<[<<<<]>+>>>[
-[-<->]+<[>+>--[+++>>>>--]+>>+[-<<<<+]]>>>>>
]>-[->+<]+>
]<<<<<<[<<<<]>->>>[>>-[->-<]+>[<+<-[>>>>-]++>>+[-<<<<+]]>]
>>--<[->+<<+>]<[->+<]<<<<[<<<<]>>>>[
-[-<->]+<[>+>-[>>>>-]++>>+[-<<<<+]]
>>>-[->-<]+>[<+<--[+++>>>>--]+>>+[-<<<<+]]>
]>>
]<-->>[<+<+<+>>>>>>>]<+<+<+<[<<<<]<<<[
>>>>>>>[[<<<<+>>>>-]>>>>]<<<<<<<<[<<<<]
>-[-<+>]+<[->+>>>[-[+>>>>-]->-[>>>>-]++>>>+[-<<<<+]+>>>>]<<<<[<<<<]]
>>-[-<<+>>]+<<[->>+>>[-[+>>>>-]->>-[>>>>-]++>>+[-<<<<+]+>>>>]<<<<[<<<<]]
>>>-[-<<<+>>>]+<<<[->>>>[-[+>>>>-]-<-[>>>>-]++>+[-<<<<+]
-<<-[>>>>-]++>>+[-<<<<+]+>>>>]<<<<[<<<<]]<<<
]>>>>>>>--[+[+++<<<<--]++>>>>--]+[<<<<]>
]r/brainfuck • u/Kayo4life • Dec 22 '25
Has someone done this already? Unary/Octal brainfuck.
Pretty much, you write the code as normal brainfuck, but the operators are replaced with digits 0 to 7 (base 8), and then you take the value that it encodes and you repeat only one operator that amount of times, which is equivalent to unary. Has someone already made this? As an example...
nya
> = 0
< = 1
+ = 2
- = 3
. = 4
, = 5
[ = 6
] = 7+- is written as nyanyanyanyanyanyanyanyanyanyanyanyanyanyanyanyanyanyanya
My assumption is that this is so basic it's probably already been done. I'm hoping though that I've contributed something. So, is it?
When making this, the goal was for the code to be as homogenous as possible, thereby masking the fact that it was logic, and also making reading it a pain. The initial goal was to make "silly" brainfuck but the goal shifted to this. I came to the realization of how I could do it in this text I've pasted: "to anyone reading, it should look no different than nya repeated over and over without any- hold on i have an idea!"