-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.html
More file actions
388 lines (363 loc) · 13.8 KB
/
index.html
File metadata and controls
388 lines (363 loc) · 13.8 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
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
384
385
386
387
388
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Linear search Visualisation</title>
<link
href="https://fonts.googleapis.com/css2?family=Sen:wght@400;700;800&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="css/style.css" />
<script src="js/script.js"></script>
</head>
<body>
<!-- =========== Push question popup ========== -->
<div class="question-modal" id="dropmenu">
<div id="modal-head">
<h2>Where do you want to drop the Bomb?</h2>
<span class="close-menu close-btn">×</span>
</div>
<div id="modal-content">
<div id="answer">
<div id="ans-left">
<div class="option" id="option-a">Park</div>
<div class="option" id="option-b">Temple</div>
<div class="option" id="option-c">School</div>
<div class="option" id="option-d">Hospital</div>
</div>
<div id="ans-right">
<div class="option" id="option-e">Bus Stop</div>
<div class="option" id="option-f">Railway Station</div>
<div class="option" id="option-g">Shopping Mall</div>
<div class="option" id="option-h">Not in the city</div>
</div>
</div>
</div>
</div>
<!-- ======== Push question popup ends ======== -->
<!-- Wrapper for whole HTML document -->
<div class="wrapper">
<!-- ==== launch buttons ==== -->
<div class="btn-wrapper">
<button id="launch">Instructions</button>
<button id="gameLaunch">Instructions</button>
</div>
<!-- ===== Instructions for algorithmic Visualisation ===== -->
<div id="popup">
<span class="close">×</span>
<h2>Instructions :</h2>
<div id="instructions">
<li class="list-items">Scroll Page for options available</li>
<li class="list-items">There are two panes in the bottom:</li>
<li class="list-items">One for taking Inputs and</li>
<li class="list-items">Second to elaborate code step-by-step</li>
<li class="list-items">
Enter the values and press "Show" to show the entered data
</li>
<li class="list-items">
To search any element, enter that and press "Start"
</li>
<li class="list-items">
Please don't enter any new search while one is Searching
</li>
<!-- Actions -->
<div class="btn-container">
<input
type="button"
name="input"
value="Start Simulation"
onclick="start()"
class="btn btn-red"
/>
<input
type="button"
name="input"
value="Gamified Visualisation"
class="btn btn-yellow"
onclick="runVisualisation()"
/>
<input
type="button"
name="start"
value="Enter your Array"
onclick="input()"
class="btn btn-green"
/>
</div>
</div>
</div>
<!-- =========== Instructions for gamified Visualisation ============= -->
<div id="gamePopup">
<span class="gameClose">×</span>
<h2>Linear Search Visualisation using Drop the Bomb Game</h2>
<ul id="gameInstructions">
<p
class="code-line"
style="text-align: justify; font-size: 16px; line-height: 24px; font-weight: 400; margin-bottom: 20px;"
>
This [Drop the Bomb] interface is a gamified approach to illustrate the working of linear Search algorithm.
In this interface there is a Cop present on the left most side of the user screen (beside all the places in a city).
</p>
<li class="list-items">
The list of places will act like elements in an array.
</li>
<li class="list-items">
You as a user will drop a bomb to one of the given places similar to entering an element
to search it in the array using Linear search approach.
</li>
<li class="list-items">
Upon placing the bomb the Cop will start moving towards each place from its initial position.
</li>
<li class="list-items">
The Cop will move and search for the bomb at each place that will take some time similar to finding an element in an array.
</li>
<li class="list-items">
If the cop reaches the location where bomb was planted it will glow with Green color showing <span style="color: #4caf50;">SUCCESS</span>.
</li>
<li class="list-items">
If it fails finding the bomb at a given place it will glow in Red showing <span style="color: #ff0730;">FAILURE</span>. and will move towards next place.
</li>
</ul>
<!-- Actions -->
<div class="btn-container">
<input
type="button"
name="start"
value="Drop the Bomb"
onclick="drop()"
class="btn btn-red"
/>
<input
type="button"
name="start"
value="Back to Algorithmic Visualisation"
class="btn btn-green"
onclick="loadSimulation()"
/>
</div>
</div>
<!-- ========= content for gameboard ========= -->
<div id="gameboard">
<div id="up">
<div id="places">
<fieldset class="place" id="park">
<legend class="icon"><img src="images/park.png" alt="park"></legend>
Park
</fieldset>
<fieldset class="place" id="temple">
<legend class="icon"><img src="images/temple.png" alt="temple"></legend>
Temple
</fieldset>
<fieldset class="place" id="school">
<legend class="icon"><img src="images/school.png" alt="school"></legend>
School
</fieldset>
<fieldset class="place" id="hospital">
<legend class="icon"><img src="images/hospital.png" alt="hospital"></legend>
Hospital
</fieldset>
<fieldset class="place" id="bus">
<legend class="icon"><img src="images/bus.png" style="background: #b3a55b;" alt="bus"></legend>
Bus Stop
</fieldset>
<fieldset class="place" id="railway">
<legend class="icon"><img src="images/train.png" alt="railway"></legend>
Railway
</fieldset>
<fieldset class="place" id="shopping">
<legend class="icon"><img src="images/mall.png" alt=""></legend>
Mall
</fieldset>
</div>
</div>
<div id="down">
<img src="images/policeman.png" alt="" id="cop" class="cop animate">
<div id="trail">
<div class="spot"></div>
<div class="spot"></div>
<div class="spot"></div>
<div class="spot"></div>
<div class="spot"></div>
<div class="spot"></div>
<div class="spot"></div>
<div class="spot"></div>
</div>
<div class="btn-container">
<div class="btn btn-yellow" onclick="location.reload();">Search Again ↺ </div>
<input
type="button"
name="start"
value="Jump to Algorithmic Visualisation"
class="btn btn-green"
onclick="loadSimulation()"
/>
</div>
<div id="content-row">
<!-- ========== tooltip label ============ -->
<div class="tooltip">
<div class="right">
<h4 style="color: #d0fffd; font-weight: 400; text-shadow: none; text-align: left; font-size: 16px;">What's your Status, Cop?</h4>
<p id="status" class="animtext"></p>
<i></i>
</div>
</div>
<!-- ========= drop icon ========= -->
<div id="clickIcon" onclick="drop();">
<span style="padding: 20px 10px; font-size: 18px; color: #dbdbdb;">Click Here ^_~</span>
<img src="images/bomb.png" alt="bomb icon" id="bomb" class="blinkbomb" caption="Click Me!">
</div>
</div>
</div>
</div>
<!-- ===== container for simulator area ===== -->
<div id="simulator-area">
<div id="container">
<!-- ======= This is Canvas area ========= -->
<div id="canvas" class="box box-full">
<h2 style="position: absolute">Linear Search Visualisation</h2>
<!-- Canvas Element to draw Animations -->
<div id="canvas-wrapper">
<canvas id="board"></canvas>
</div>
<!-- Labels to show data steps -->
<!-- <h3>Current Step -></h3> -->
<div class="check" id="check">
<p id="label1"></p>
<p id="label2"></p>
</div>
<!-- Current Step in Algorithm -->
<li class="code-line current-step" id="current-step">
Current Algorithm steps explaination will appear here<br />
</li>
<!-- Canvas Actions -->
<div class="btn-container" id="actions">
<input
type="button"
name="input"
value="< Prev"
onclick="prev()"
class="btn btn-yellow hide"
id="prev"
/>
<a href="#canvas">
<input
type="button"
name="reset"
value="Start"
onclick="start()"
class="btn btn-red show"
id="start"
/>
</a>
<a href="#canvas">
<input
hidden
type="button"
name=""
value="< Reset"
onclick="previous_step()"
class="btn btn-red show"
id="user_prev"
/>
</a>
<a href="#canvas">
<input
hidden
type="button"
name=""
value="Next Step>"
onclick="next_step()"
class="btn btn-green"
id="user_next"
/>
</a>
<input
type="button"
name="start"
value="Next >"
onclick="next()"
class="btn btn-green hide"
id="next"
/>
</div>
</div>
<!-- ============= Canvas area ends here ============ -->
<!-- ========= This is Input Area ======== -->
<div id="input" class="box box-half hide">
<!-- <span class="drag" id="drag"><img src="moveicon.png" alt="drag icon"></span> -->
<h2>Enter the values to perform Linear Search</h2>
<!-- <form action="" method="post"> -->
<div class="inputs">
<input
type="text"
id="length"
class="input"
placeholder="Enter size of array"
required
/><br />
<input
type="text"
id="array"
class="input values"
placeholder="Enter Array elements using , (comma)"
required
/><br />
<input
type="text"
name="input"
id="enter"
class="input"
placeholder="Element to Search"
required
/><br />
</div>
<!-- Actions -->
<div class="btn-container">
<a href="#canvas">
<input
type="button"
name="input"
value="Show array"
onclick="execute()"
class="btn btn-yellow"
/>
</a>
<a href="#canvas">
<input
type="button"
name="reset"
value="Reset"
onclick="reset()"
class="btn btn-red"
/>
</a>
</div>
<!-- </form> -->
</div>
<!-- ========= This is code area ========== -->
<div id="code" class="box box-half">
<!-- <span class="drag" id="mydiv"><img src="moveicon.png" alt="drag icon" id="mydivheader"></span> -->
<h2>Step-by-Step Code Run</h2>
<div id="code-panel">
<li class="code-line" id="l1">LINEAR_SEARCH(A, N, VAL)</li>
<li class="code-line" id="l2">Step 1: [INITIALIZE] SET POS = -1</li>
<li class="code-line" id="l3">Step 2: [INITIALIZE] SET I = 1</li>
<li class="code-line" id="l4">Step 3: Repeat Step 4 while I<=N</li>
<li class="code-line" id="l5">
Step 4: IF A[I] = VAL SET POS = I PRINT POS Go to Step 6 [END OF
IF] SET I = I + 1 [END OF LOOP]
</li>
<li class="code-line" id="l6">
Step 5: IF POS = -1 PRINT " VALUE IS NOT PRESENTIN THE ARRAY "
[END OF IF]
</li>
<li class="code-line" id="l7">Step 6: EXIT</li>
</div>
</div>
</div>
</div>
</div>
</body>
<script src="js/script.js"></script>
</html>