diff options
-rw-r--r-- | README.md | 17 | ||||
-rw-r--r-- | brainfuck.bf | 1 |
2 files changed, 17 insertions, 1 deletions
@@ -1,4 +1,19 @@ | |||
1 | brainfuck | 1 | brainfuck |
2 | ========= | 2 | ========= |
3 | 3 | ||
4 | brainfuck | 4 | Brainfuck is represented by an array with 30,000 cells initialized to zero |
5 | and a data pointer pointing at the current cell. | ||
6 | |||
7 | There are eight commands: | ||
8 | ``` | ||
9 | + : Increments the value at the current cell by one. | ||
10 | - : Decrements the value at the current cell by one. | ||
11 | > : Moves the data pointer to the next cell (cell on the right). | ||
12 | < : Moves the data pointer to the previous cell (cell on the left). | ||
13 | . : Prints the ASCII value at the current cell (i.e. 65 = 'A'). | ||
14 | , : Reads a single input character into the current cell. | ||
15 | [ : If the value at the current cell is zero, skips to the corresponding ] . | ||
16 | Otherwise, move to the next instruction. | ||
17 | ] : If the value at the current cell is zero, move to the next instruction. | ||
18 | Otherwise, move backwards in the instructions to the corresponding [ . | ||
19 | ``` \ No newline at end of file | ||
diff --git a/brainfuck.bf b/brainfuck.bf new file mode 100644 index 0000000..e0a8381 --- /dev/null +++ b/brainfuck.bf | |||
@@ -0,0 +1 @@ | |||
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>. \ No newline at end of file | |||