Skip to content

Commit

Permalink
increment
Browse files Browse the repository at this point in the history
  • Loading branch information
grammarware committed Jun 20, 2012
1 parent c6aab50 commit 792b4ce
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/inc/README.txt
@@ -0,0 +1,9 @@
There are two simple Turing Machine programs that increment a unary number.

inc1 the most naïve possible implementation of incrementing a number by 1.

incby takes two unary numbers and increment the second one by the value of the first one

e.g.: 1101110… ⇒ 110111110…

-- Vadim Zaytsev, http://grammarware.net
6 changes: 6 additions & 0 deletions examples/inc/inc1.ctur
@@ -0,0 +1,6 @@
J06
MF
J12
W1
MF

8 changes: 8 additions & 0 deletions examples/inc/inc1.t_l2
@@ -0,0 +1,8 @@
J0 stop
L skip
MF
J1 skip
W1
MF
L stop

15 changes: 15 additions & 0 deletions examples/inc/incby.ctur
@@ -0,0 +1,15 @@
J015
W0
MF
J13
MF
J15
W1
MB
J18
MB
J110
W1
MF
J12

19 changes: 19 additions & 0 deletions examples/inc/incby.t_l2
@@ -0,0 +1,19 @@
J0 stop
L incby
W0
REP 2 {
L skip4
MF
J1 skip4
}
W1
REP 2 {
L back3
MB
J1 back3
}
W1
MF
J1 incby
L stop

0 comments on commit 792b4ce

Please sign in to comment.