-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtm.html
154 lines (152 loc) · 6.12 KB
/
tm.html
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
144
145
146
147
148
149
150
151
152
153
154
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Turing Maching Simulator</title>
<link rel="stylesheet" href="css/blueprint/screen.css" type="text/css" media="screen, projection">
<link rel="stylesheet" href="css/blueprint/print.css" type="text/css" media="print">
<!--[if lt IE 8]>
<link rel="stylesheet" href="css/blueprint/ie.css" type="text/css" media="screen, projection">
<![endif]-->
<link rel="stylesheet" href="css/tm.css" type="text/css" media="screen, projection">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script type="text/javascript" src="js/pubsub.js"></script>
<script type="text/javascript" src="js/tm.js"></script>
</head>
<body>
<div class="topHeader">
<em>JavaScript Turing Machine Simulator</em>
</div>
<div class="container">
<div class="prepend-8 span-16 prepend-top last append-bottom center">
<div class="symbolIndicator">
{
<span id="currentState">A</span>,
<span id="currentSymbol">B</span> →
<span id="nextState">C</span>,
<span id="nextSymbol">D</span>,
<span id="nextDirection">E</span>
}
</div>
<div>
<a id="curState" class="small" title="Click To Edit The State">
Edit State
</a>
</div>
</div>
<div class="span-2">
<img id="goBackward" src="img/left.png" title="Move Left">
</div>
<div class="prepend-7 span-6">
<img id="startButton" src="img/play.png" title="Start">
<img id="stopButton" src="img/pause.png" title="Stop">
<img id="resetButton" src="img/power.png" title="Reset">
</div>
<div class="prepend-7 span-2 last">
<img id="goForward" src="img/right.png" title="Move Right">
</div>
<div class="span-24 tickerTapeContain">
<div id="tickerTape" class="clearfix">
<div class="tapeCell firstCell"> 0 </div>
<div class="tapeCell"> 1 </div>
<div class="tapeCell"> 2 </div>
<div class="tapeCell"> 3 </div>
<div class="tapeCell"> 4 </div>
<div class="tapeCell"> 5 </div>
<div class="tapeCell"> 6 </div>
<div class="tapeCell"> 7 </div>
<div class="tapeCell"> 8 </div>
<div class="tapeCell"> 9 </div>
<div class="tapeCell"> 10 </div>
<div class="tapeCell"> 11 </div>
<div class="tapeCell headCell"> 12 </div>
<div class="tapeCell"> 13 </div>
<div class="tapeCell"> 14 </div>
<div class="tapeCell"> 15 </div>
<div class="tapeCell"> 16 </div>
<div class="tapeCell"> 17 </div>
<div class="tapeCell"> 18 </div>
<div class="tapeCell"> 19 </div>
<div class="tapeCell"> 20 </div>
<div class="tapeCell"> 21 </div>
<div class="tapeCell"> 22 </div>
<div class="tapeCell"> 23 </div>
<div class="tapeCell"> 24 </div>
<div class="tapeCell lastCell"> 25 </div>
</div>
</div>
<div class="span-24">
<div id="headHighlight"></div>
</div>
<div class="span-24 prepend-top">
<div class="span-8">
<label for="tmInstructions">Instructions</label>
<a id="loadInstructions">Load Instructions</a>
<br>
<textarea id="tmInstructions" cols="35"></textarea>
<br><a id="showInstructions">Show Instructions</a>
<div id="instructions" class="hidden">
Instructions for using the TM Simulator:
<ol>
<li>
Load your instruction set. Each instruction should look
like: {A,B}->{C,D,E}
<dl>
<dt>A</dt>
<dd>The current state</dd>
<dt>B</dt>
<dd>The current symbol on the tape</dd>
<dt>C</dt>
<dd>The new state to move to</dd>
<dt>D</dt>
<dd>The symbol to write on the tape</dd>
<dt>E</dt>
<dd>The Direction to move the tape either. Must be R or L</dd>
</dl>
Every state, symbol, or direction should be just one character.
Use the state H for the halting state. Use an underscore
_ for a blank symbol on the tape.
</li>
<li>
Set the intial symobls on tape and move the tape to the
correct position.
</li>
<li>
Click the current state at the top of the page and set
it to the state you want to start with.
</li>
<li>
Press start. If the touring machine halts, it will
stop with state H.
</li>
</ol>
If you'd like to see the simulator in action try running the
demo.<br>
<button id="runDemo">Run Demo</button>
</div>
</div>
<div class="prepend-1 span-15 last">
<div class="span-5">
<label for="transpeed">Transition Speed (in ms)</label>
</div>
<div class="span-10 last">
<input type="text" id="transpeed" value="1000">
</div>
<div class="span-5">
<label for="initialSymbols">Starting Tape Symbols</label>
</div>
<div class="span-10 last">
<input type="text" id="initialSymbols"><br>
</div>
<div>
<a id="loadSymbols">Load Symbols</a>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(window).load(function(){
tm.manager.setup();
});
</script>
</body>
</html>