aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor <pashev.igor@gmail.com>2010-01-17 21:37:57 +0300
committerIgor <pashev.igor@gmail.com>2010-01-17 21:37:57 +0300
commitd6a3c724a55638097edd38db6bcc2e5c50217c98 (patch)
tree797b59a34a2d33307aa47fa9c8f263c0ac9669bd
parent2c53ba0b9b36d1faff38cad74d0795b7b164efac (diff)
downloadbrainfuck-d6a3c724a55638097edd38db6bcc2e5c50217c98.tar.gz
More examples
-rw-r--r--.gitignore7
-rw-r--r--clear-prev-cells.bf12
-rw-r--r--copy-cell.bf15
-rw-r--r--move-cell.bf9
4 files changed, 43 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..18fad79
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+*.swp
+.directory
+*~
+*.bak
+*.backup
+*.o
+
diff --git a/clear-prev-cells.bf b/clear-prev-cells.bf
new file mode 100644
index 0000000..faea608
--- /dev/null
+++ b/clear-prev-cells.bf
@@ -0,0 +1,12 @@
+> # to 2nd cell
++. # inc and print
+> # move to 3rd cell
+++. # set 3rd cell to 2 and print
+> # move to 4th cell
++++. # set 4th cell to 3 and print
+
+[[-]] # set to zero 2nd, 3th and 4th cells
+
+
+.>.>. # print 2nd, 3th and 4th cells
+
diff --git a/copy-cell.bf b/copy-cell.bf
new file mode 100644
index 0000000..d943142
--- /dev/null
+++ b/copy-cell.bf
@@ -0,0 +1,15 @@
+# copy (1) to (2) using (3)
+
++++++ # set (1) = 5
+
+.>.< # show (1) and (2)
+
+[->+>+<<] # set (3) = (2) = (1) and (1) = 0
+
+.>.>. # show (1), (2) and (3)
+
+[-<<+>>] # set (1) = (3) (initial) and (3) = 0
+
+<< # got to (1)
+.>.>. # show (1), (2) and (3)
+
diff --git a/move-cell.bf b/move-cell.bf
new file mode 100644
index 0000000..09f518c
--- /dev/null
+++ b/move-cell.bf
@@ -0,0 +1,9 @@
+ # move (1) to (2), setting (1) = 0
++++++ # set (1) = 5
+
+.>.< # show (1) and (2)
+
+[->+<] # set (2) = (1) and (1) = 0
+
+.>.< # show (1) and (2)
+