summaryrefslogtreecommitdiffhomepage
path: root/brainfuck.html.markdown
diff options
context:
space:
mode:
authorAdam Bard <github@adambard.com>2013-09-26 20:04:35 -0700
committerAdam Bard <github@adambard.com>2013-09-26 20:04:35 -0700
commit7f3c7caa860381415542749627207085e6e24aea (patch)
tree94291adfee880239ed26fa959fa3eba94637bf99 /brainfuck.html.markdown
parentcf8b3d8c39f3d3aacf04e7a996cb119e4217c626 (diff)
parent09fe6eb5878d926196bc4bf23ec3dfae7aeeb81e (diff)
Merge pull request #363 from disjukr/master
[brainfuck/ko-kr][brainfuck/en] Add korean translation of brainfuck
Diffstat (limited to 'brainfuck.html.markdown')
-rw-r--r--brainfuck.html.markdown14
1 files changed, 8 insertions, 6 deletions
diff --git a/brainfuck.html.markdown b/brainfuck.html.markdown
index 9282381f..27ac6921 100644
--- a/brainfuck.html.markdown
+++ b/brainfuck.html.markdown
@@ -53,25 +53,27 @@ until cell #1 is 0, and cell #2 holds cell #1's old value. Because we're on
cell #1 at the end of the loop, move to cell #2, and then print out the value
in ASCII.
-Also keep in mind that the spaces are purely for readibility purposes. You
+Also keep in mind that the spaces are purely for readability purposes. You
could just as easily write it as:
,[>+<-]>.
Try and figure out what this program does:
-,>,< [ > [ >+ >+ << -] >> [- << + >>] <<< -] >>
+,>,< [ > [ >+ >+ << -] >> [- << + >>] <<< -] >>
This program takes two numbers for input, and multiplies them.
The gist is it first reads in two inputs. Then it starts the outer loop,
conditioned on cell #1. Then it moves to cell #2, and starts the inner
-loop conditioned on cell #2, incrementing cell #3. However, there comes a
-problem: at the end of the inner loop, cell #2 is zero. To solve this problem,
+loop conditioned on cell #2, incrementing cell #3. However, there comes a
+problem: At the end of the inner loop, cell #2 is zero. In that case,
+inner loop won't work anymore since next time. To solve this problem,
we also increment cell #4, and then recopy cell #4 into cell #2.
+Then cell #3 is the result.
```
-And that's brainfuck. Not that hard, eh? For fun, you can write your own
-brainfuck programs, or you can write a brainfuck interpreter in another
+And that's brainfuck. Not that hard, eh? For fun, you can write your own
+brainfuck programs, or you can write a brainfuck interpreter in another
language. The interpreter is fairly simple to implement, but if you're a
masochist, try writing a brainfuck interpreter… in brainfuck.