|
1 | 1 | # WHAT IS BRAINFUCK? |
2 | 2 |
|
3 | | -Brainfuck is an esoteric language that is turing-complete and works with cells. |
4 | | -Even though it isn't very useful, it's an interesting experience every passionate programmer should |
5 | | -experience. |
| 3 | +Brainfuck is a turing-complete, esoteric language that uses only 8 commands. |
6 | 4 |
|
7 | 5 | # HOW DO I BRAINFUCK? |
8 | 6 |
|
9 | | -This version of brainfuck has only 8 instructions, and those are: |
| 7 | +mempo = memory pointer |
10 | 8 |
|
11 | | -``` |
12 | | - + --> Adds 1 to the cell it's in. |
| 9 | +The instructions for writting in brainfuck are the following: |
13 | 10 |
|
14 | | - - --> Removes 1 to the cell it's in. |
| 11 | +''' |
| 12 | ++ --> Adds 1 to the value on the mempo is in. |
15 | 13 |
|
16 | | - > --> Changes the cell it's in by 1. |
| 14 | +- --> Removes 1 to the value on the mempo is in. |
17 | 15 |
|
18 | | - < --> Changes the cell it's in by -1. |
| 16 | +> --> Changes the mempo by 1. |
19 | 17 |
|
20 | | - , --> Allows for ascii input. |
| 18 | +< --> Changes the mempo by -1. |
21 | 19 |
|
22 | | - . --> Echoes the ascii value of the cell. |
| 20 | +. --> Outputs ASCII(char) value. |
23 | 21 |
|
24 | | - [ --> Starts a loop. |
| 22 | +, --> Inputs ASCII(char) value. |
25 | 23 |
|
26 | | - ] --> Goes to the last open bracket if it doesn't end on 0 / null. |
27 | | -``` |
| 24 | +[ --> Starts a loop. |
28 | 25 |
|
29 | | -Every character other than those is (hopefully) ignored. |
30 | | - |
31 | | -# WHY? |
| 26 | +] --> Ends a loop if the value of the mempo it's in equals to 0, otherwise it restarts. |
| 27 | +''' |
32 | 28 |
|
33 | | -Why i did it? Because I was bored. Why does this language exists in the first place? I guess someone felt the same way ~15 years before me. |
| 29 | +Every character other than those is (hopefully) ignored. |
34 | 30 |
|
35 | 31 | # ERRORS |
36 | | -If it doesn't work, depending on the exit it can be the following: |
37 | | - |
38 | | -0 - No problems on the code, have you checked that it's well written? |
39 | | - |
40 | | -1 - There is an unfinished loop. |
41 | | - |
42 | | -2 - You are trying to access a negative cell position. |
43 | | - |
44 | | -3 - 1 & 2. |
45 | | - |
46 | | -4 - Not enough input or not input at all. |
| 32 | +If it doesn't work, depending on the return it can be the following: |
47 | 33 |
|
48 | | -5 - 1 & 4 |
| 34 | +''' |
| 35 | +0 - No problems on the code, check it's well written or mail me. |
49 | 36 |
|
50 | | -6 - 2 & 4 |
| 37 | +1 - There is an unfinished loop, somewhere. |
51 | 38 |
|
52 | | -7 - 1 & 2 & 4 |
| 39 | +2 - You ar etrying to access a negative mempo. |
53 | 40 |
|
54 | | -# TODO |
55 | | -[x] Make it to interpret brainfuck(only in the python version atm). |
| 41 | +3 - 1 & 2 |
56 | 42 |
|
57 | | -[ ] Make it to COMPILE brainfuck. |
| 43 | +4 - Not enough input. |
58 | 44 |
|
59 | | -[ ] Add more stuff to the TODO. |
| 45 | +5 - 1 & 4 |
60 | 46 |
|
61 | | -# AUTHOR NOTE |
| 47 | +6 - 2 & 4 |
62 | 48 |
|
63 | | -Hope you enjoy playing with this, it's possible to do some impressive stuff. |
| 49 | +7 - 1 & 2 & 4 |
| 50 | +''' |
0 commit comments