forked from awmorp/turing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconcatenate.txt
31 lines (29 loc) · 882 Bytes
/
concatenate.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
; From https://github.com/awmorp/jsturing
; Write your Turing machine program here!
; Syntax: <current state> <current symbol> <new symbol> <direction> <new state>
; ';' starts a comment.
; '*' is a wildcard: it matches any symbol/state when used in the current symbol/state field;
; it means 'same as current' when used in new symbol/new state field.
; '_' represents the blank (space) symbol.
; Symbols must be a single non-whitespace character except ';'.
; States can be any word, not only numbers.
;
; This example program concatenates the first string of '1's to the end of the second.
q0 0 0 r q0
q0 1 x r 1
1 1 1 r 1
1 0 0 r 2
2 0 0 r 2
2 1 1 r 3
3 1 1 r 3
3 0 1 l 4
3 _ 1 l 4
4 1 1 l 4
4 0 0 l 5
5 0 0 l 5
5 1 1 l 6
5 x x * halt
6 1 1 l 6
6 x x r q0
6 0 0 r q0
; This is a hack to load an appropriate initial tape. $INITIAL_TAPE: 11110011111