-
Notifications
You must be signed in to change notification settings - Fork 0
/
EqualityTest.txt
145 lines (89 loc) · 1.54 KB
/
EqualityTest.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
//TUTORIAL
//LOAD AN EXAMPLE TO TRY
//then load an input and click play
//-------DELTA FUNCTION:
//[current_state],[read_symbol]
//[new_state],[write_symbol],[>|<|-]
// < = left
// > = right
// - = hold
// use underscore for blank cells
//States and symbols are case-sensitive
//Load your code and click COMPILE.
//or load an example (top-right).
// Input: a string with {w#w : w is (0,1)*}
// Gamma : {
// Ouput: accept if the strings of 1 and 0 are equals
// Example: accepts 110#110
// By: Vincenzo Gargano
// Equality test on sipster book
// for Turing Machine Simulator
// turingmachinesimulator.com
//
// ------- States -----------|
// q0 |
// q1 |
// q3 |
// q4 |
// q5 |
// q6 |
// qaccept - accepting state |
//---------------------------|
//-------CONFIGURATION
name: Equality Test
init: q0
accept: qAccept
//-------DELTA FUNCTION:
//--------------q0
q0,0
q1,x,>
q0,#
q7,#,>
q0,1
q2,x,>
//--------------q1
q1,0
q1,0,>
q1,1
q1,1,>
q1,#
q3,#,>
//--------------q2
q2,0
q2,0,>
q2,1
q2,1,>
q2,#
q4,#,>
//--------------q3
q3,x
q3,x,>
q3,0
q5,x,<
//----------------q4
q4,x
q4,x,>
q4,1
q5,x,<
//----------------q5
//Until now we checked for 0 and 1 checking again is redundant so we can get rid of this transitions
//q5,0
//q5,0,<
//q5,1
//q5,1,<
q5,x
q5,x,<
q5,#
q6,#,<
//----------------q6
q6,0
q6,0,<
q6,1
q6,1,<
q6,x
q0,x,>
//----------------q7
q7,x
q7,x,>
q7,_
qAccept,_,-