Skip to content

newQuery/brainfuck-interpretator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Brainfuck Web Interpreter

A tiny, in-browser Brainfuck interpreter served via Docker.

Build and run

# Build image
docker build -t brainfuck-web .

# Run (open http://localhost:3000)
docker run -p 3000:3000 --rm brainfuck-web

Write 'Hello World!'

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

20 + 1 = 21 PRINTED AS 21

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

Full breakdown

++++++                     Set cell #0 to 6
[                          WHILE cell #0 != 0
    >++++++++              Add 8 to cell #1
    <-                     Decrement cell #0
]                          END WHILE
                           → cell #1 now = 6 × 8 = 48 (ASCII '0')
>++.                       Go to cell #2, add 22
                           Print cell #2 → ASCII 50'2'
>++++++                    Go to cell #3, set to 6
[>++++++++<-]              Multiply cell #3 × 8 → cell #4 = 48 (ASCII '0')
>+                         Go to cell #5, add 11
.                          Print cell #5 → ASCII 49'1'

What it does ?

  1. Builds the ASCII value 48 (the character '0') in two separate cells using a multiplication loop (6 × 8 = 48).
  2. Adds 2 to the first '0' → becomes 50 → prints 2
  3. Adds 1 to the second '0' → becomes 49 → prints 1

About

fuck.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published