-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
528 lines (476 loc) · 25.5 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
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="shortcut icon" type="image/png" href="assets/buttons/favicon.png" />
<title>QCA | Quantum Cellular Automata</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Styles -->
<link rel="stylesheet" href="./styles/reset.css">
<link rel="stylesheet" href="./styles/main.css">
<link rel="stylesheet" href="./styles/activities.css">
<link rel="stylesheet" href="./styles/achievements.css">
<link rel="stylesheet" href="./styles/control-strip.css">
<link rel="stylesheet" href="./styles/info-holder.css">
<link rel="stylesheet" href="./styles/joystick-controls.css">
<link rel="stylesheet" href="./styles/top-control-bar.css">
<!-- <link rel="stylesheet" href="./styles/choice-holder.css"> -->
<!-- Librairies -->
<script type="text/javascript" src="./node_modules/three/build/three.js"></script>
<script type="text/javascript" src="./scripts/lib/OrbitControls.js"></script>
<script type="text/javascript" src="./scripts/lib/TRHEEOBJLoader.js"></script>
<link rel="stylesheet" href="./node_modules/izitoast/dist/css/iziToast.min.css">
<script type="text/javascript" src="./node_modules/izitoast/dist/js/iziToast.min.js"></script>
<script type="text/javascript" src="./node_modules/gsap/src/uncompressed/TweenLite.js"></script>
<script type="text/javascript" src="./node_modules/gsap/src/uncompressed/easing/EasePack.js"></script>
<script type="text/javascript" src="./node_modules/gsap/src/uncompressed/TimelineLite.js"></script>
<!-- Scripts -->
<!-- Loaders -->
<script src="./scripts/view/AssetManager.js"></script>
<script src="./scripts/controllers/MissionManager.js"></script>
<script src="./scripts/controllers/AchievementManager.js"></script>
<!-- Logic -->
<script src="./scripts/view/Axis.js"></script>
<script src="./scripts/view/ParticleSystem.js"></script>
<script src="./scripts/view/Skybox.js"></script>
<script src="./scripts/view/ThreeViewController.js"></script>
<script src="./scripts/view/Grid.js"></script>
<script src="./scripts/view/Cursor.js"></script>
<script src="./scripts/view/UxSaver.js"></script>
<script src="./scripts/controllers/Editor.js"></script>
<script src="./scripts/controllers/Preset.js"></script>
<script src="./scripts/controllers/AppController.js"></script>
<script src="./scripts/controllers/History.js"></script>
<script src="./scripts/model/Dot.js"></script>
<script src="./scripts/model/Block.js"></script>
<script src="./scripts/model/InputBlock.js"></script>
<script src="./scripts/model/Electron.js"></script>
<script src="./scripts/model/Qubit.js"></script>
<script src="./scripts/model/OutputBlock.js"></script>
<script src="./scripts/model/WaitingBlock.js"></script>
<script src="./scripts/model/Bridge.js"></script>
<script src="./scripts/model/QuantumAutomata.js"></script>
<script src="./scripts/gui/ToolboxController.js"></script>
<script src="./scripts/gui/UIController.js"></script>
<script src="./scripts/gui/JoystickCameraControls.js"></script>
<script src="./scripts/gui/DragAndDropControls.js"></script>
<script src="./scripts/gui/KeyBoardController.js"></script>
<script src="./scripts/gui/TimeControls.js"></script>
<script src="./scripts/gui/GUI.js" defer></script>
<script src="./scripts/gui/OverlaySelector.js"></script>
<script src="./scripts/gui/IntroScene.js"></script>
<script src="./scripts/gui/DrawerController.js"></script>
<script src="./scripts/Utils.js"></script>
<script src="./scripts/main.js" defer></script>
</head>
<body class="wrapper">
<!-- LOADING SCREEN -->
<div class="loading-overlay" id="loading-overlay">
<svg class="loading-spinner" width="48px" height="48px" viewBox="0 0 48 48" version="1.1" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="Qubit" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Group" transform="translate(23.763742, 23.616018) rotate(-17.000000) translate(-23.763742, -23.616018) translate(4.840665, 4.597150)"
stroke="#FFFFFF" stroke-width="2">
<rect id="Rectangle" x="6.46153846" y="6.33962264" width="24.9230769" height="24.4528302"></rect>
<ellipse id="Oval" fill="#000000" cx="6.92307692" cy="6.79245283" rx="5.92307692" ry="5.79245283"></ellipse>
<ellipse id="Oval-Copy-2" fill="#000000" cx="30.9230769" cy="6.79245283" rx="5.92307692" ry="5.79245283"></ellipse>
<ellipse id="Oval-Copy" fill="#000000" cx="6.92307692" cy="31.245283" rx="5.92307692" ry="5.79245283"></ellipse>
<ellipse id="Oval-Copy-3" fill="#000000" cx="30.9230769" cy="31.245283" rx="5.92307692" ry="5.79245283"></ellipse>
</g>
</g>
</svg>
<div>
Loading...
</div>
</div>
<!-- HEADER AND NAVBAR -->
<h1 class="title">Quantum cellular automata simulator</h1>
<div id="top-control-bar" class="ui">
<nav class="control-bar-mini">
<button class="button-mini" alt="Reset" id="dustbin-button" title="Reset">
<img src="assets/buttons/dustbeen.png" class="button-mini-icon">
</button>
<button class="button-mini" alt="Slower" id="undo-button" title="undo">
<img src="assets/buttons/undo.png" class="button-mini-icon">
</button>
<button class="button-mini" alt="Faster" id="redo-button" title="redo">
<img src="assets/buttons/redo.png" class="button-mini-icon">
</button>
</nav>
<nav class="control-bar-mini">
<button class="button-mini time-control" alt="Slower" id="slow-button" title="slower">
<img src="assets/buttons/playx2.png" class="button-mini-icon" id="slow-button-icon">
Slower
</button>
<button class="button-mini time-control" alt="Play/Pause simulation" id="play-button" title="play / pause">
<img src="assets/buttons/pause.png" class="button-mini-icon" id="pause-button-icon" style="display:none">
<img src="assets/buttons/play.png" class="button-mini-icon" id="play-button-icon">
Play
</button>
<button class="button-mini time-control" alt="Faster" id="fast-button" title="faster">
<img src="assets/buttons/playx3.png" class="button-mini-icon" id="fast-button-icon">
Faster
</button>
</nav>
<nav class="control-bar-mini">
<label class="button-mini">
<img class="layer-toggle-icon button-mini-icon" alt="Qubit values" src="assets/buttons/qubit_layer.png">
<input class="layer-checkbox" type="checkbox" id="show-qubit" checked />
</label>
<label class="button-mini">
<img class="layer-toggle-icon button-mini-icon" alt="Families" src="assets/buttons/family_layer.png">
<input class="layer-checkbox" type="checkbox" id="show-families" />
</label>
<label class="button-mini">
<img class="layer-toggle-icon button-mini-icon" alt="Electrons" src="assets/buttons/electron_layer.png">
<input class="layer-checkbox" type="checkbox" id="show-electrons" />
</label>
<label class="button-mini">
<img class="layer-toggle-icon button-mini-icon" alt="Charge Fields" src="assets/buttons/influence_layer.png">
<input class="layer-checkbox" type="checkbox" id="show-influence" />
</label>
<label class="button-mini">
<img class="layer-toggle-icon button-mini-icon" alt="Kittens" src="assets/buttons/kitten_layer.png">
<input class="layer-checkbox" type="checkbox" id="show-kittens" />
</label>
</nav>
<nav id="control-mission" class="control-bar-mini">
<button class="button-mini button-text">
<img class="layer-toggle-icon button-mini-icon" alt="Quit" src="assets/buttons/Quit.png">
</button>
<button class="button-mini button-text">
<img class="layer-toggle-icon button-mini-icon" alt="Reload" src="assets/buttons/Reload.png">
</button>
</nav>
</div>
<header class="control-strip ui">
<nav class="toolbox">
<button class="tool active" alt="Control Camera" id="camera-tool" title="Mode camera">
<img src="assets/buttons/Camera.png" class="tool-icon camera-icon">
Q
</button>
<div class="separator"></div>
<button class="tool draggable" alt="Negatively charged influencer" id="input-tool" title="Add input">
<img src="assets/buttons/Input.png" class="tool-icon electron-icon">
-
</button>
<div id="clock-change-container">
<button class="tool draggable" alt="Qubit" id="qubit-tool" title="Add Qubit">
<img src="assets/buttons/Qubit.png" class="tool-icon qubit-icon">
B
<div id="clock-indicator" class="pill"></div>
</button>
<div id="clock-selector"></div>
</div>
<button class="tool draggable" alt="Output" id="output-tool" title="Add output">
<img src="assets/buttons/Output.png" class="tool-icon output-icon">
O
</button>
<div class="separator"></div>
<button class="tool" alt="Bridge" id="bridge-tool" title="Bridge Qubits">
<img src="assets/buttons/Bridge.png" class="tool-icon bridge-icon">
B
</button>
<button class="tool" alt="Eraser" id="remove-tool" title="Erase">
<img src="assets/buttons/Delete.png" class="tool-icon delete-icon">
E
</button>
</nav>
</header>
<section id="choice-holder">
<div class="btn-card btn" id="choice-tutorial">
<img src="assets/buttons/tuto-icon.png" alt="Tutorial logo">
<h2>Tutorial</h2>
</div>
<div class="btn-card btn" id="choice-sandbox">
<img src="assets/buttons/sandbox-icon.png" alt="sandbox logo">
<h2>Sandbox</h2>
</div>
<img src="./assets/buttons/chatsIntro.png" src="Chatons de Schrödinger" id="intro_kitten"/>
</section>
<nav class="camera-controls ui" id="camera-touch-controls">
<!-- camera controls -->
<input class="zoom-control" type="range" id="zoom-control" min="1" max="25">
<button class="pan-control" id="joystick-control">
<!-- Inline svg solves issue with selection on touch devices -->
<svg viewBox="0 0 128 128" style="-moz-user-select: none; -webkit-user-select: none; -ms-user-select:none; user-select:none;-o-user-select:none;"
unselectable="on" onselectstart="return false;" width="128" height="128" xmlns="http://www.w3.org/2000/svg">
<g fill="none" fill-rule="evenodd">
<circle fill="#FFF" cx="64" cy="64" r="3" />
<g stroke="#FFF" stroke-linecap="square" stroke-width="2">
<path d="M47.42 16.5L64 .5M80.58 16.5L64 .5" />
</g>
<g stroke="#FFF" stroke-linecap="square" stroke-width="2">
<path d="M47.42 111.5l16.58 16M80.58 111.5L64 127.5" />
</g>
<g stroke="#FFF" stroke-linecap="square" stroke-width="2">
<path d="M111.5 47.42l16 16.58M111.5 80.58l16-16.58" />
<g>
<path d="M16.5 47.42L.5 64M16.5 80.58L.5 64" />
</g>
</g>
</g>
</svg>
</button>
</nav>
<!-- 3D VIEWPORT -->
<main id="viewport" class="viewport">
<div id="axis"></div>
</main>
</header>
<aside id="info-holder" class="info-holder-hidden">
<h4>Title of the info</h4>
<div id="info-holder-text"></div>
<span class="btn">Next</span>
<span class="btn" id="info-holder-skip">Skip</span>
</aside>
<aside class="activities active ui" id="activities">
<nav class="activity-tabs">
<div id="selectors">
<div id="drawer-menu-icon">
<img src="./assets/buttons/menu.png" alt="menu" />
</div>
<button class="hide-activities" id="toggle-activity-tab">
<img class="hide-activities-icon ifinactive" src="assets/buttons/inactive_sidebar.png" alt="show activities tab">
<img class="hide-activities-icon ifactive" src="assets/buttons/active_sidebar.png" alt="show activities tab">
</button>
<div class="activity-tab-button-wrapper">
<label class="activity-tab-button demos-tab" for="demos-check">Demos</label>
<!--
<label class="activity-tab-button tutorial-tab" for="tutorial-check">Tutorial</label>
-->
<label class="activity-tab-button missions-tab" for="mission-check">Missions</label>
<label class="activity-tab-button achievement-tab" for="achievement-check">Achievements</label>
<label class="activity-tab-button settings-tab" for="settings-check">About</label>
</div>
</div>
<div id="drawers">
<input class="activity-check" type="radio" id="no-drawer-check" name="tab" />
<input class="activity-check" type="radio" id="demos-check" name="tab" />
<div id="drawer-demos" class="drawer">
<div class="drawer-header">
<h3>Demos</h3>
<label for="no-drawer-check" class="drawer-close"><img src="assets/buttons/cross.png" alt="close"
class="cross" /></label>
</div>
<div class="drawer-main">
<p>Charger une démo : <input type="file" id="file_demo"/></p>
</div>
<div class="drawer-action">
<label for="no-drawer-check" class="inlinebtn btn">close</label>
</div>
</div>
<input class="activity-check" type="radio" id="tutorial-check" name="tab" />
<div id="drawer-tutorial" class="drawer">
<div class="drawer-header">
<h3>Tutorial</h3>
<label for="no-drawer-check" class="drawer-close"><img src="assets/buttons/cross.png" alt="close"
class="cross" /></label>
</div>
<div class="drawer-main">
<h4>- 1 -</h4>
<p>Welcome to the world of Quantum Cellular Automata!</p>
<p>In this tutorial, you will learn how to build interesting circuits using Qubits.</p>
<p>There are the three kind of blocks you can place:</p>
<ul>
<li>Influencer: sets the adjacent qubits to its value (0 or 1)</li>
<li>Qubit: stores and transmits quantum information, can be in an undeterminate state (?)
or determinate state (0 or 1) when measured</li>
<li>Output: allow to measure the value of one qubit</li>
</ul>
<h4>- 2 -</h4>
<p>Negative influence</p>
<p>Since electrons repel each other, it is possible to invert the polarity of qubits as such:</p>
<h4>- 3 -</h4>
<p>One output, many inputs</p>
<p>Let's build a more complex logic gate. By having many inputs joined into one output, a majority gate can be built. The output corresponds to the value of the major input.</p>
<h4>- 4 -</h4>
<p>More complex logic gates: AND gate</p>
<p>Let's now build another logic gate: the AND gate. The AND gate takes two inputs, A and B and one output, Z.</p>
<p>The output Z's value is 1 when both of the input A and B's values are 1. Otherwise, the output Z's value is 0.</p>
<p>The truth table for the AND logic gate is:</p>
<table>
<tr>
<td>A</td>
<td>B</td>
<td>Z</td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>0</td>
<td>1</td>
<td>0</td>
</tr>
<tr>
<td>1</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>1</td>
</tr>
</table>
<h4>- 5 -</h4>
<p>More complex logic gates: XOR gate</p>
<p>Another logic gate is the eXclusive-OR, or XOR gate. The output Z's value is 1 when only one
of the two inputs is 1 and the other is 0.</p>
<table>
<tr>
<td>A</td>
<td>B</td>
<td>Z</td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>0</td>
<td>1</td>
<td>1</td>
</tr>
<tr>
<td>1</td>
<td>0</td>
<td>1</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>0</td>
</tr>
</table>
<h4>- 6 -</h4>
<p>Combining circuits: a binary half-adder</p>
<p>By combining logic gates, we can build more complex and interesting circuits. If we combine
the AND and XOR logic gate, we can build an half-adder, which computes the binary sum of
its two inputs, A and B.</p>
<p>An half-adder has two outputs: S, the sum of A and B, and C, the carry (or overflow of the
sum into the next digit, if we were to build a more complex adder).</p>
<p>The truth table is:</p>
<table>
<tr>
<th colspan="2">Inputs</th>
<th colspan="2">Outputs</th>
</tr>
<tr>
<th><i>A</i></th>
<th><i>B</i></th>
<th><i>C</i></th>
<th><i>S</i></th>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>1</td>
<td>0</td>
<td>0</td>
<td>1</td>
</tr>
<tr>
<td>0</td>
<td>1</td>
<td>0</td>
<td>1</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>1</td>
<td>0</td>
</tr>
</table>
<p>By looking at the truth table, we can see that C = A AND B, and S = A XOR B. Thus, we can
easily build an half-adder out of the AND and XOR we build in the two previous missions.</p>
<p>The logical structure is widely used in computer processors to compute the sum of two binary
numbers.</p>
</div>
<div class="drawer-action">
<label for="no-drawer-check" class="inlinebtn btn">close</label>
</div>
</div>
<input class="activity-check" type="radio" id="mission-check" name="tab" />
<div id="drawer-mission" class="drawer">
<div class="drawer-header">
<h3>Missions</h3>
<label for="no-drawer-check" class="drawer-close"><img src="assets/buttons/cross.png" alt="close"
class="cross" /></label>
</div>
<div class="drawer-main">
<p>Here's all the missions:</p>
<div id="missions-holder">
<div id="template-mission" class="mission">
<img src="assets/textures/missions/default.png" alt="default">
<h4>$fullname</h4>
<p>$Description</p>
</div>
</div>
</div>
<div class="drawer-action">
<label for="no-drawer-check" class="inlinebtn btn">close</label>
</div>
</div>
<input class="activity-check" type="radio" id="achievement-check" name="tab" />
<div id="drawer-achievement" class="drawer">
<div class="drawer-header">
<h3>Achievements</h3>
<label for="no-drawer-check" class="drawer-close"><img src="assets/buttons/cross.png" alt="close"
class="cross" /></label>
</div>
<div class="drawer-main">
<p>Try to complete all thoses achievements !</p>
<div id="achievements-holder">
<div id="template-achievement" class="achievement">
<img src="assets/textures/achievements/default.png" alt="default">
<h4>$fullname</h4>
<p>$Description</p>
</div>
</div>
</div>
<div class="drawer-action">
<label for="no-drawer-check" class="inlinebtn btn">close</label>
</div>
</div>
<input class="activity-check" type="radio" id="settings-check" name="tab" />
<div id="drawer-settings" class="drawer">
<div class="drawer-header">
<h3>About</h3>
<label for="no-drawer-check" class="drawer-close"><img src="assets/buttons/cross.png" alt="close"
class="cross" /></label>
</div>
<div class="drawer-main">
<h4>The QCA simulator team</h4>
<p>Team Schrödinger: Valérian Daul, Pierre Gabory, Baptiste Mantovani, Maximilien Pluchard</p>
<p>Tutoring: Alain Lioret</p>
<p>Project made at <a href="https://www.ingenieur-imac.fr/">IMAC</a> engineering school in
2019.</p>
<img src="./assets/buttons/logo.png" alt="Logo" id="main_logo"/>
<button id="settings-reset" class="btn inlinebtn">Reset application</button>
</div>
<div class="drawer-action">
<label for="no-drawer-check" class="inlinebtn btn">close</label>
</div>
</div>
</div>
</nav>
</aside>
<div class="debug-info">
<div id="camera-info"></div>
<div id="cursor-info"></div>
<div id="tool-info"></div>
<div id="automata-info"></div>
</div>
</body>
</html>