-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
204 lines (191 loc) · 7.21 KB
/
index.html
File metadata and controls
204 lines (191 loc) · 7.21 KB
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta
name="description"
content="Interactive Toy Robot simulator with command presets, script mode, and live board updates."
/>
<meta name="theme-color" content="#08122e" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
rel="preload"
as="style"
href="https://fonts.googleapis.com/css2?family=Bungee:wght@400&family=DM+Sans:wght@400;500;700&display=swap"
/>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Bungee:wght@400&family=DM+Sans:wght@400;500;700&display=swap"
media="print"
onload="this.media='all'"
/>
<noscript>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Bungee:wght@400&family=DM+Sans:wght@400;500;700&display=swap"
/>
</noscript>
<title>Toy Robot Game</title>
<link rel="preload" href="./web/styles.css" as="style" />
<link rel="stylesheet" href="./web/styles.css" />
</head>
<body>
<main class="app">
<section class="panel">
<h1>Toy Robot</h1>
<p class="subhead">
Guide your toy robot with simple controls and see every move update live on the board.
</p>
<button id="help-toggle" class="help-toggle" type="button">
Help
</button>
<div id="help-panel" class="controls hidden-controls">
<h2>How To Control</h2>
<ul class="help-list">
<li>
Start with <strong>PLACE X,Y,F</strong> before any move commands.
</li>
<li>
In <strong>Text mode</strong>, type single commands or run multiline
script commands with Step/Run All.
</li>
<li>
In <strong>Button mode</strong>, select X, Y, and Facing then press
PLACE, then use LEFT/MOVE/RIGHT/REPORT buttons.
</li>
<li>
Valid commands are uppercase only: PLACE, MOVE, LEFT, RIGHT,
REPORT.
</li>
<li>
Grid range is <strong>0..5</strong>. Any move that would fall is
rejected and state remains unchanged.
</li>
</ul>
</div>
<p id="latest-status" class="latest-status neutral">
Waiting for command...
</p>
<div class="controls">
<h2>Demo Presets</h2>
<div class="row">
<button class="preset" data-preset="A" type="button">Example A</button>
<button class="preset" data-preset="B" type="button">Example B</button>
<button class="preset" data-preset="C" type="button">Example C</button>
<button id="run-preset" type="button">Run Preset</button>
</div>
<p id="selected-preset" class="preset-meta">Selected preset: Example A</p>
<div class="custom-preset">
<h2>Create Preset</h2>
<input
id="custom-preset-name"
type="text"
placeholder="Preset name (for example, Patrol Loop)"
aria-label="Custom preset name"
/>
<textarea
id="custom-preset-commands"
rows="4"
placeholder="PLACE 0,0,NORTH MOVE RIGHT REPORT"
aria-label="Custom preset commands"
></textarea>
<button id="save-custom-preset" type="button">Save Preset</button>
<div id="custom-preset-list" class="row"></div>
</div>
</div>
<div class="controls">
<h2>Control Mode</h2>
<label class="mode-toggle" for="button-mode-toggle">
<input id="button-mode-toggle" type="checkbox" />
Use button interface
</label>
</div>
<div id="text-controls">
<div class="controls">
<h2>Single Command</h2>
<div class="row">
<input
id="command-input"
type="text"
placeholder="PLACE 0,0,NORTH"
aria-label="Single command input"
/>
<button id="run-command" type="button">Run</button>
</div>
</div>
<div class="controls">
<h2>Script Mode</h2>
<textarea
id="script-input"
rows="8"
placeholder="PLACE 0,0,NORTH MOVE RIGHT REPORT"
aria-label="Script input"
></textarea>
<div class="row">
<button id="step-script" type="button">Step</button>
<button id="run-script" type="button">Run All</button>
<button id="reset-script" type="button">Reset Script Cursor</button>
<button id="reset-state" type="button">Reset Robot</button>
</div>
<ol id="script-preview" class="script-preview"></ol>
</div>
</div>
<div id="button-controls" class="hidden-controls">
<div class="controls">
<h2>Button Commands</h2>
<div class="place-controls">
<label for="place-x">X</label>
<select id="place-x" aria-label="Place X coordinate">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
<label for="place-y">Y</label>
<select id="place-y" aria-label="Place Y coordinate">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
<label for="place-f">Facing</label>
<select id="place-f" aria-label="Place facing direction">
<option>NORTH</option>
<option>EAST</option>
<option>SOUTH</option>
<option>WEST</option>
</select>
<button id="place-button" type="button">PLACE</button>
</div>
<div class="action-pad">
<button data-command="LEFT" type="button">LEFT</button>
<button data-command="MOVE" type="button">MOVE</button>
<button data-command="RIGHT" type="button">RIGHT</button>
<button data-command="REPORT" type="button">REPORT</button>
<button id="button-reset-state" type="button">RESET</button>
</div>
</div>
</div>
<div class="status">
<h2>Current State</h2>
<p id="state-line">Not placed</p>
</div>
</section>
<section class="panel">
<h2>Board (0..5)</h2>
<div id="board" class="board" aria-live="polite"></div>
</section>
<section class="panel">
<h2>Command Log</h2>
<ol id="log" class="log"></ol>
</section>
</main>
<script type="module" src="./web/app.js"></script>
</body>
</html>