From e85bf9281710facb2664f732af03951997810408 Mon Sep 17 00:00:00 2001 From: JinweiClarkChao Date: Thu, 8 Jan 2015 01:01:53 +0800 Subject: brainfuck helloworld --- README.md | 17 ++++++++++++++++- brainfuck.bf | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 brainfuck.bf diff --git a/README.md b/README.md index 294413c..66b2fa1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,19 @@ brainfuck ========= -brainfuck +Brainfuck is represented by an array with 30,000 cells initialized to zero +and a data pointer pointing at the current cell. + +There are eight commands: +``` ++ : Increments the value at the current cell by one. +- : Decrements the value at the current cell by one. +> : Moves the data pointer to the next cell (cell on the right). +< : Moves the data pointer to the previous cell (cell on the left). +. : Prints the ASCII value at the current cell (i.e. 65 = 'A'). +, : Reads a single input character into the current cell. +[ : If the value at the current cell is zero, skips to the corresponding ] . + Otherwise, move to the next instruction. +] : If the value at the current cell is zero, move to the next instruction. + Otherwise, move backwards in the instructions to the corresponding [ . +``` \ 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 -- cgit v1.2.3