forked from Akshayakayy/Space_Invaders
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
383 lines (349 loc) · 18.2 KB
/
index.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
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Mars Simulation</title>
<link rel="icon" type="image/png" href="./images/icon.jpeg" />
<link rel="stylesheet" href="./css/style.css" />
<link rel="stylesheet" href="./lib/themes/jquery.ui.all.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<link href='https://fonts.googleapis.com/css?family=Julius%20Sans%20One' rel='stylesheet'>
<link href='https://fonts.googleapis.com/css?family=Dosis' rel='stylesheet'>
<link href='https://fonts.googleapis.com/css?family=Didact%20Gothic' rel='stylesheet'>
<link href='https://fonts.googleapis.com/css?family=Roboto+Mono' rel='stylesheet'>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@sweetalert2/theme-bulma@3.2.0/bulma.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9/dist/sweetalert2.min.js"></script>
<script type="text/javascript" src="./lib/raphael-min.js"></script>
<script type="text/javascript" src="./lib/es5-shim.min.js"></script>
<script type="text/javascript" src="./lib/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="./lib/state-machine.min.js"></script>
<script type="text/javascript" src="./lib/async.min.js"></script>
<script type="text/javascript" src="./lib/ui/jquery.ui.core.min.js"></script>
<script type="text/javascript" src="./lib/ui/jquery.ui.widget.min.js"></script>
<script type="text/javascript" src="./lib/ui/jquery.ui.mouse.min.js"></script>
<script type="text/javascript" src="./lib/ui/jquery.ui.draggable.min.js"></script>
<script type="text/javascript" src="./lib/ui/jquery.ui.accordion.min.js"></script>
<script type="text/javascript" src="./lib/ui/jquery.ui.slider.min.js"></script>
<script type="text/javascript" src="./lib/pathfinding-browser.min.js"></script>
<script type="text/javascript" src="./js/view.js"></script>
<script type="text/javascript" src="./js/bot.js"></script>
<script type="text/javascript" src="./js/agent.js"></script>
<script type="text/javascript" src="./js/guide.js"></script>
<script type="text/javascript" src="./js/panel.js"></script>
<script type="text/javascript" src="./js/main.js"></script>
<audio id="playMusic" autoplay="autoplay">
<source src="music/mars_rover.mp3" type="audio/mpeg">
</audio>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<img src="https://www.ripplesnigeria.com/wp-content/uploads/2018/10/Planet-Mars.jpg" alt="mars_pic" width="90"
height="50">
<a class="navbar-brand" id="brand">Mars Pathfinder</a>
</div>
<ul class="nav navbar-nav">
<li class="dropdown" id="dropdown1">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<div class="header_title" id="genmaze">Generate Maze<span class="caret"></span>
<span class="tooltiptext" id="tooltipgenmaze">Generate mazes using different algorithms</span>
</div>
</a>
<ul class="dropdown-menu" id="dropdown-menu1">
<div id="algorithm_panel">
<div id="maze">
<li><a id="maze1" class="maze_button">Random Maze</a></li>
<li class="divider"></li>
<li><a id="maze2" class="maze_button">Dense Recursive Maze</a></li>
<li class="divider"></li>
<li>
<div id="maze3" class="maze_button">Stair Maze</div>
</li>
<li class="divider"></li>
<li>
<div id="maze4" class="maze_button">Sparse Recursive Maze</div>
</li>
</div>
</div>
</ul>
</li>
<!-- <li class="dropdown" id="dropdown2">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<div class="header_title" id="genobs">Obstacles<span class="caret"></span>
<span class="tooltiptext" id="tooltipgenobs">Insert obstacles of various types</span>
</div>
</a>
<ul class="dropdown-menu" id="dropdown-menu2">
<div id="algorithm_panel">
<div id="obstacles">
<li><a id="button4" class="obstacle_button">Add Pit</a></li>
<li class="divider"></li>
<li><a id="button5" class="obstacle_button">Add ice</a></li>
<li class="divider"></li>
<li><a id="button6" class="obstacle_button">Add bombs</a></li>
</div>
</div>
</ul>
</li> -->
<li class="dropdown" id="dropdown3">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<div class="header_title" id="genalgo">Algorithms<span class="caret"></span>
<span class="tooltiptext" id="tooltipgenalgo">Use various algorithms to find the shortest path</span>
</div>
</a>
<ul class="dropdown-menu" id="dropdown-menu3">
<div id="algorithm_panel">
<div class="accordion">
<h3 id="astar_header"><a href="#">A*</a></h3>
<div id="astar_section" class="finder_section">
<header class="option_header">
<h3>Heuristic</h3>
</header>
<div id="astar_heuristic" class="sub_options">
<input type="radio" name="astar_heuristic" value="manhattan" checked />
<label class="option_label">Manhattan</label> <br>
<input type="radio" name="astar_heuristic" value="euclidean" />
<label class="option_label">Euclidean</label> <br>
<input type="radio" name="astar_heuristic" value="octile" />
<label class="option_label">Octile</label> <br>
<input type="radio" name="astar_heuristic" value="chebyshev" />
<label class="option_label">Chebyshev</label> <br>
</div>
<header class="option_header">
<h3>Options</h3>
</header>
<div class="optional sub_options">
<input type="checkbox" class="allow_diagonal" checked>
<label class="option_label">Allow Diagonal</label> <br>
<input type="checkbox" class="bi-directional">
<label class="option_label">Bi-directional</label> <br>
<input type="checkbox" class="dont_cross_corners">
<label class="option_label">Don't Cross Corners</label> <br>
<input class="spinner" name="astar_weight" value="1">
<label class="option_label">Weight</label> <br>
</div>
</div>
<h3 id="ida_header"><a href="#">IDA*</a></h3>
<div id="ida_section" class="finder_section">
<header class="option_header">
<h3>Heuristic</h3>
</header>
<div id="ida_heuristic" class="sub_options">
<input type="radio" name="ida_heuristic" value="manhattan" checked />
<label class="option_label">Manhattan</label> <br>
<input type="radio" name="ida_heuristic" value="euclidean" />
<label class="option_label">Euclidean</label> <br>
<input type="radio" name="ida_heuristic" value="octile" />
<label class="option_label">Octile</label> <br>
<input type="radio" name="ida_heuristic" value="chebyshev" />
<label class="option_label">Chebyshev</label> <br>
</div>
<header class="option_header">
<h3>Options</h3>
</header>
<div class="optional sub_options">
<input type="checkbox" class="allow_diagonal" checked>
<label class="option_label">Allow Diagonal</label> <br>
<input type="checkbox" class="dont_cross_corners">
<label class="option_label">Don't Cross Corners</label> <br>
<input class="spinner" name="astar_weight" value="1">
<label class="option_label">Weight</label> <br>
<input class="spinner" name="time_limit" value="10">
<label class="option_label">Seconds limit</label> <br>
<input type="checkbox" class="track_recursion" checked />
<label class="option_label">Visualize recursion</label> <br>
</div>
</div>
<h3 id="breadthfirst_header"><a href="#">Breadth-First-Search</a></h3>
<div id="breadthfirst_section" class="finder_section">
<header class="option_header">
<h3>Options</h3>
</header>
<div class="optional sub_options">
<input type="checkbox" class="allow_diagonal" checked>
<label class="option_label">Allow Diagonal</label> <br>
<input type="checkbox" class="bi-directional">
<label class="option_label">Bi-directional</label> <br>
<input type="checkbox" class="dont_cross_corners">
<label class="option_label">Don't Cross Corners</label> <br>
</div>
</div>
<h3 id="bestfirst_header"><a href="#">Best-First-Search</a></h3>
<div id="bestfirst_section" class="finder_section">
<header class="option_header">
<h3>Heuristic</h3>
</header>
<div id="bestfirst_heuristic" class="sub_options">
<input type="radio" name="bestfirst_heuristic" value="manhattan" checked />
<label class="option_label">Manhattan</label> <br>
<input type="radio" name="bestfirst_heuristic" value="euclidean" />
<label class="option_label">Euclidean</label> <br>
<input type="radio" name="bestfirst_heuristic" value="octile" />
<label class="option_label">Octile</label> <br>
<input type="radio" name="bestfirst_heuristic" value="chebyshev" />
<label class="option_label">Chebyshev</label> <br>
</div>
<header class="option_header">
<h3>Options</h3>
</header>
<div class="optional sub_options">
<input type="checkbox" class="allow_diagonal" checked>
<label class="option_label">Allow Diagonal</label> <br>
<input type="checkbox" class="bi-directional">
<label class="option_label">Bi-directional</label> <br>
<input type="checkbox" class="dont_cross_corners">
<label class="option_label">Don't Cross Corners</label> <br>
</div>
</div>
<h3 id="dijkstra_header"><a href="#">Dijkstra</a></h3>
<div id="dijkstra_section" class="finder_section">
<header class="option_header">
<h3>Options</h3>
</header>
<div class="optional sub_options">
<input type="checkbox" class="allow_diagonal" checked>
<label class="option_label">Allow Diagonal</label> <br>
<input type="checkbox" class="bi-directional">
<label class="option_label">Bi-directional</label> <br>
<input type="checkbox" class="dont_cross_corners">
<label class="option_label">Don't Cross Corners</label> <br>
</div>
</div>
<h3 id="jump_point_header"><a href="#">Jump Point Search</a></h3>
<div id="jump_point_section" class="finder_section">
<header class="option_header">
<h3>Heuristic</h3>
</header>
<div id="jump_point_heuristic" class="sub_options">
<input type="radio" name="jump_point_heuristic" value="manhattan" checked />
<label class="option_label">Manhattan</label> <br>
<input type="radio" name="jump_point_heuristic" value="euclidean" />
<label class="option_label">Euclidean</label> <br>
<input type="radio" name="jump_point_heuristic" value="octile" />
<label class="option_label">Octile</label> <br>
<input type="radio" name="jump_point_heuristic" value="chebyshev" />
<label class="option_label">Chebyshev</label> <br>
</div>
<header class="option_header">
<h3>Options</h3>
</header>
<div class="optional sub_options">
<input type="checkbox" class="track_recursion" checked>
<label class="option_label">Visualize recursion</label> <br>
</div>
</div>
<h3 id="orth_jump_point_header"><a href="#">Orthogonal Jump Point Search</a></h3>
<div id="orth_jump_point_section" class="finder_section">
<header class="option_header">
<h3>Heuristic</h3>
</header>
<div id="orth_jump_point_heuristic" class="sub_options">
<input type="radio" name="orth_jump_point_heuristic" value="manhattan" checked />
<label class="option_label">Manhattan</label> <br>
<input type="radio" name="orth_jump_point_heuristic" value="euclidean" />
<label class="option_label">Euclidean</label> <br>
<input type="radio" name="orth_jump_point_heuristic" value="octile" />
<label class="option_label">Octile</label> <br>
<input type="radio" name="orth_jump_point_heuristic" value="chebyshev" />
<label class="option_label">Chebyshev</label> <br>
</div>
<header class="option_header">
<h3>Options</h3>
</header>
<div class="optional sub_options">
<input type="checkbox" class="track_recursion" checked>
<label class="option_label">Visualize recursion</label> <br>
</div>
</div>
<h3 id="cla_header"><a href="#">Collaborative Learning Agent</a></h3>
<div id="cla_section" class="finder_section">
<header class="option_header">
<h3>Heuristic</h3>
</header>
<div id="cla_heuristic" class="sub_options">
<input type="radio" name="cla_heuristic" value="poweredManhattan" checked />
<label class="option_label">Powered Manhattan</label> <br>
<input type="radio" name="cla_heuristic" value="extrapoweredManhattan" />
<label class="option_label">Extra Powered-Manhattan</label> <br>
</div>
</div>
</div>
</div>
</ul>
</li>
<li><a id="speed">Speed:</a></li>
<li><input type="range" min="1" max="30" value="25" class="slider" name="speed"></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="b1"><a id="button1" class="control_button">Start Search</a></li>
<li><a id="button2" class="control_button">Pause Search</a></li>
<li><a id="button3" class="control_button">Clear Obstacles</a></li>
<li><a id="button4" class="control_button">Clear Checkpoints</a></li>
</ul>
</div>
</nav>
<div id="draw_area"></div>
<div id="bot_panel" class="panel">
<header>
<h2 class="bot_title">TARS</h2>
<span id="hide_bot"> X </span>
</header>
<div class="bot_content">
<div id="bot_msg">Welcome to Mars Rover Pathfinder!</id>
</div>
</div>
</body>
<script>
$('.dropdown-toggle').on('click', function (e) {
$(this).next().slideToggle("fast");
});
$('li.dropdown.mega-dropdown a').on('click', function (event) {
$(this).parent().toggleClass('open');
});
$('.dropdown').on('show.bs.dropdown', function () {
$('body').append($('.dropdown').css({
position: 'absolute',
left: $('.dropdown').offset().left,
top: $('.dropdown').offset().top
}).detach());
});
$(document).click(function () {
// $(this).find(".dropdown-menu").hide()
$("#dropdown-menu1").slideUp("fast");
// $("#dropdown-menu2").slideUp("fast");
$("#dropdown-menu3").slideUp("fast");
});
/* Clicks within the dropdown won't make
it past the dropdown itself */
$("#dropdown1").click(function (e) {
e.stopPropagation();
$("#dropdown-menu2").slideUp("fast");
$("#dropdown-menu3").slideUp("fast");
});
// $("#dropdown2").click(function (e) {
// e.stopPropagation();
// $("#dropdown-menu1").slideUp("fast");
// $("#dropdown-menu3").slideUp("fast");
// });
$("#dropdown3").click(function (e) {
e.stopPropagation();
$("#dropdown-menu1").slideUp("fast");
$("#dropdown-menu2").slideUp("fast");
});
// $(document).on("click", function (event) {
// var $trigger = $(".dropdown");
// if ($trigger !== event.target && !$trigger.has(event.target).length) {
// $(".dropdown-menu").slideUp("fast");
// }
// });
var botpan = document.getElementById('bot_panel');
var botmsg = document.getElementById('bot_msg');
botmsg.innerHTML = 'Welcome! <br><br> Click within the grey grid and drag your mouse to draw obstacles. <br><br> Add and remove checkpoints using Ctrl+Click';
msgs = 0;
</script>
</html>