-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathu1q0.html
771 lines (699 loc) · 22.2 KB
/
u1q0.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
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
<html>
<head>
<title>Unit 1 Quiz 0</title>
<style>
@import url(https://fonts.googleapis.com/css?family=Roboto);
body,
html,
* {
font-family: 'Roboto', sans-serif;
box-sizing: border-box;
}
body {
padding: 50px;
background: url('polyBkgPurple.svg');
}
.bkgLine {
stroke-width: 1;
stroke: #eee;
fill: none;
}
.axisLine {
stroke-width: 1;
stroke: black;
fill: none;
}
.lineCircle {
stroke: blue;
stroke-width: 1;
fill: #228;
}
text {
font-size: 11px;
fill: black;
font-family: sans-serif;
}
#p0,
#p1,
#p2,
#p3,
#p4,
#p5,
#p6 {
font-size: 13px;
fill: white;
font-weight: bold;
font-family: sans-serif;
}
#b1,
#b2,
#b3,
#b4,
#b5,
#b6 {
fill: #ccc;
stroke: none;
}
.gLabel {
fill: black;
font-family: sans-serif;
font-size: 10px;
}
.gLabelItalic {
font-size: 13px;
font-weight: bold;
}
button {
display: inline-block;
padding: 6px 12px;
margin-bottom: 0;
font-size: 12px !important;
font-weight: 400;
line-height: 17px;
text-align: center;
white-space: nowrap;
vertical-align: middle;
-ms-touch-action: manipulation;
touch-action: manipulation;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
color: #fff;
background-color: #337ab7;
border-color: #2e6da4;
}
button:focus {
outline: none;
}
hr {
border: 0;
height: 1px;
background: #777;
background-image: linear-gradient(to right, #ddd, #aaa, #ddd);
}
table {
padding: 20px;
background: #fff;
border-radius: 5px;
}
</style>
</head>
<body>
<table border="0">
<tr id='theQuiz' style='display:none;'>
<td>
<h3>Quiz 1.0</h3>
<hr>
<div id='g1'><svg width="460" height="255">
<g transform="translate(40,10)">
<path
d="M0,0 400,0 M0,20 400,20 M0,40 400,40 M0,60 400,60 M0,80 400,80 M0,100 400,100 M0,120 400,120 M0,140 400,140 M0,160 400,160 M0,180 400,180"
class="bkgLine" />
<path
d="M40,0 40,200 M80,0 80,200 M120,0 120,200 M160,0 160,200 M200,0 200,200 M240,0 240,200 M280,0 280,200 M320,0 320,200 M360,0 360,200 M400,0 400,200 "
class="bkgLine" />
<path
d="M0,0 0,200
M0,200 400,200 M-5,0 0,0 M-5,20 0,20 M-5,40 0,40 M-5,60 0,60 M-5,80 0,80 M-5,100 0,100 M-5,120 0,120 M-5,140 0,140 M-5,160 0,160 M-5,180 0,180 M-5,200 0,200 M40,200 40,205 M80,200 80,205 M120,200 120,205 M160,200 160,205 M200,200 200,205 M240,200 240,205 M280,200 280,205 M320,200 320,205 M360,200 360,205 M400,200 400,205 "
class="axisLine" />
<text x='-20' y='205'>0</text>
<text x='-20' y='185'>1</text>
<text x='-20' y='165'>2</text>
<text x='-20' y='145'>3</text>
<text x='-20' y='125'>4</text>
<text x='-20' y='105'>5</text>
<text x='-20' y='85'>6</text>
<text x='-20' y='65'>7</text>
<text x='-20' y='45'>8</text>
<text x='-20' y='25'>9</text>
<text x='-25' y='5'>10</text>
<text x='-150' y='-30' transform="rotate(-90)" style="font-size:13px; font-weight:bold;">Position
(meters)</text>
<text x='-3' y='222'>0</text>
<text x='33' y='222'>10</text>
<text x='73' y='222'>20</text>
<text x='113' y='222'>30</text>
<text x='153' y='222'>40</text>
<text x='193' y='222'>50</text>
<text x='233' y='222'>60</text>
<text x='273' y='222'>70</text>
<text x='313' y='222'>80</text>
<text x='353' y='222'>90</text>
<text x='390' y='222'>100</text>
<text x='150' y='240' style="font-size:13px; font-weight:bold;">Time (seconds)</text>
<path id="graphPath" stroke="blue" stroke-width="2.5" fill="none" />
<circle id='c0' cx='1' cy='1' r='8' class="lineCircle" />
<circle id='c1' cx='1' cy='1' r='8' class="lineCircle" />
<circle id='c2' cx='1' cy='1' r='8' class="lineCircle" />
<circle id='c3' cx='1' cy='1' r='8' class="lineCircle" />
<circle id='c4' cx='1' cy='1' r='8' class="lineCircle" />
<circle id='c5' cx='1' cy='1' r='8' class="lineCircle" />
<circle id='c6' cx='1' cy='1' r='8' class="lineCircle" />
<text id='p0' x='1' y='1'>A</text>
<text id='p1' x='1' y='1'>B</text>
<text id='p2' x='1' y='1'>C</text>
<text id='p3' x='1' y='1'>D</text>
<text id='p4' x='1' y='1'>E</text>
<text id='p5' x='1' y='1'>F</text>
<text id='p6' x='1' y='1'>G</text>
</g>
</svg></div>
<div id='g2'>
<svg width="300" height="300" id="graphingBlock" onclick="setCoords(evt)">
<g>
<text x="-190" y="18" class="gLabel gLabelItalic" transform="rotate(-90)">Position (meters)</text>
<text x="110" y="294" class="gLabel gLabelItalic">Time (seconds)</text>
<path d="
M40,20 40,260
M60,20 60,260
M80,20 80,260
M100,20 100,260
M120,20 120,260
M140,20 140,260
M160,20 160,260
M180,20 180,260
M200,20 200,260
M220,20 220,260
M240,20 240,260
M260,20 260,260
M280,20 280,260
M40,20 280,20
M40,40 280,40
M40,60 280,60
M40,80 280,80
M40,100 280,100
M40,120 280,120
M40,140 280,140
M40,160 280,160
M40,180 280,180
M40,200 280,200
M40,220 280,220
M40,240 280,240
M40,260 280,260
" stroke="#eee" stroke-width="1" />
<path d="
M40,20 40,260 280,260 M40,20 36,20 M40,60 36,60 M40,100 36,100 M40,140 36,140 M40,180 36,180 M40,220 36,220 M40,260 36,260
M40,260 40,264 M80,260 80,264 M120,260 120,264 M160,260 160,264 M200,260 200,264 M240,260 240,264 M280,260 280,264
" stroke="#000" stroke-width="1" fill="none" />
</g>
<g>
<circle fill="#00f" cx="40" cy="260" r="6" id="circ40" />
<circle fill="#00f" cx="80" cy="260" r="6" id="circ80" />
<circle fill="#00f" cx="120" cy="260" r="6" id="circ120" />
<circle fill="#00f" cx="160" cy="260" r="6" id="circ160" />
<circle fill="#00f" cx="200" cy="260" r="6" id="circ200" />
<circle fill="#00f" cx="240" cy="260" r="6" id="circ240" />
<circle fill="#00f" cx="280" cy="260" r="6" id="circ280" />
</g>
<path stroke="#00f" stroke-width="2" d="M40,260 280,260" id="gLine" fill="none" />
<text x="26" y="23" class="gLabel">6</text>
<text x="26" y="63" class="gLabel">5</text>
<text x="26" y="103" class="gLabel">4</text>
<text x="26" y="143" class="gLabel">3</text>
<text x="26" y="183" class="gLabel">2</text>
<text x="26" y="223" class="gLabel">1</text>
<text x="26" y="263" class="gLabel">0</text>
<text y="279" x="38" class="gLabel">0</text>
<text y="279" x="74" class="gLabel">10</text>
<text y="279" x="114" class="gLabel">20</text>
<text y="279" x="154" class="gLabel">30</text>
<text y="279" x="194" class="gLabel">40</text>
<text y="279" x="234" class="gLabel">50</text>
<text y="279" x="274" class="gLabel">60</text>
</svg>
</div>
<hr>
<div id="result"></div>
<div id="result0"></div><br>
<button onclick="generateGraph();">Reload Question</button>
<hr>
Your Score: <span id='theScore'>0</span> out of 16<span id="codeZ" style="display:none"></span>
</td>
</tr>
<tr id='pwCollect'>
<td>
Password for this quiz: <input id='pw' /><br>
<button
onclick="if($('pw').value===names[3]){$('pwCollect').style.display='none';$('theQuiz').style.display='table-row'}">Continue</button>
</td>
</tr>
</table>
<script>
function $(elem) {
return document.getElementById(elem);
}
var svg = $('graphingBlock');
var pt = svg.createSVGPoint(); // Created once for document
var q = 0;
var qOrder = [0, 0, 0, 1, 1, 2, 3];
var outPosY = [];
var aa = [];
var q2Answer = 0;
var q3Answer = 0;
var rr = [0, 0, 0, 0, 0, 0, 0];
qType = 0;
var qText = ['', '', '', ''];
function setCoords(evt) {
pt.x = evt.clientX;
pt.y = evt.clientY;
// The cursor point, translated into svg coordinates
var cursorpt = pt.matrixTransform(svg.getScreenCTM().inverse());
cursorpt.x = Math.round(cursorpt.x / 40) * 40;
cursorpt.y = Math.round(cursorpt.y / 20) * 20;
cursorpt.y = cursorpt.y < 0 ? 0 : cursorpt.y;
cursorpt.y = cursorpt.y > 260 ? 260 : cursorpt.y;
var thePt = $('circ' + cursorpt.x);
thePt.setAttribute('cy', cursorpt.y);
var outStr = 'M';
var ii = 0;
for (var t = 40; t < 290; t += 40) {
thePt = $('circ' + t);
outStr += thePt.getAttribute('cx') + ',' + thePt.getAttribute('cy') + ' ';
outPosY[ii] = (260 - thePt.getAttribute('cy')) / 40;
ii++;
}
thePt = $('gLine');
thePt.setAttribute('d', outStr);
//$('result2').innerHTML = outPosY.join(' ');
}
var names = [
'James',
'John',
'Robert',
'Newton',
'Michael',
'William',
'David',
'Richard',
'Joseph',
'Thomas',
'Charles',
'Christopher',
'Daniel',
'Matthew',
'Anthony',
'Donald',
'Mark',
'Paul',
'Steven',
'Andrew',
'Kenneth',
'George',
'Joshua',
'Kevin',
'Brian',
'Edward',
'Ronald',
'Timothy',
'Jason',
'Jeffrey',
'Ryan',
'Jacob',
'Gary',
'Nicholas',
'Eric',
'Stephen',
'Jonathan',
'Larry',
'Justin',
'Scott',
'Brandon',
'Frank',
'Benjamin',
'Gregory',
'Raymond',
'Samuel',
'Patrick',
'Alexander',
'Jack',
'Dennis',
'Jerry',
'Tyler',
'Aaron',
'Henry',
'Jose',
'Douglas',
'Peter',
'Adam',
'Nathan',
'Zachary',
'Walter',
'Kyle',
'Harold',
'Carl',
'Jeremy',
'Gerald',
'Keith',
'Roger',
'Arthur',
'Terry',
'Lawrence',
'Sean',
'Christian',
'Ethan',
'Austin',
'Joe',
'Albert',
'Jesse',
'Willie',
'Billy',
'Bryan',
'Bruce',
'Noah',
'Jordan',
'Dylan',
'Ralph',
'Roy',
'Alan',
'Wayne',
'Eugene',
'Juan',
'Gabriel',
'Louis',
'Russell',
'Randy',
'Vincent',
'Philip',
'Logan',
'Bobby',
'Harry',
'Johnny',
'Mary',
'Patricia',
'Jennifer',
'Linda',
'Elizabeth',
'Barbara',
'Susan',
'Jessica',
'Sarah',
'Margaret',
'Karen',
'Nancy',
'Lisa',
'Betty',
'Dorothy',
'Sandra',
'Ashley',
'Kimberly',
'Donna',
'Emily',
'Carol',
'Michelle',
'Amanda',
'Melissa',
'Deborah',
'Stephanie',
'Rebecca',
'Laura',
'Helen',
'Sharon',
'Cynthia',
'Kathleen',
'Amy',
'Shirley',
'Angela',
'Anna',
'Ruth',
'Brenda',
'Pamela',
'Nicole',
'Katherine',
'Samantha',
'Christine',
'Catherine',
'Virginia',
'Debra',
'Rachel',
'Janet',
'Emma',
'Carolyn',
'Maria',
'Heather',
'Diane',
'Julie',
'Joyce',
'Evelyn',
'Joan',
'Victoria',
'Kelly',
'Christina',
'Lauren',
'Frances',
'Martha',
'Judith',
'Cheryl',
'Megan',
'Andrea',
'Olivia',
'Ann',
'Jean',
'Alice',
'Jacqueline',
'Hannah',
'Doris',
'Kathryn',
'Gloria',
'Teresa',
'Sara',
'Janice',
'Marie',
'Julia',
'Grace',
'Judy',
'Theresa',
'Madison',
'Beverly',
'Denise',
'Marilyn',
'Amber',
'Danielle',
'Rose',
'Brittany',
'Diana',
'Abigail',
'Natalie',
'Jane',
'Lori',
'Alexis',
'Tiffany',
'Kayla'
];
var j = [];
var k = [];
function generateGraph() {
var resultElement = $('result');
var graphPath = $('graphPath');
var a = [0, 0, 0];
a[0] = Math.floor(Math.random() * 9 + 1);
do {
a[1] = Math.floor(Math.random() * 9 + 1);
} while (a[1] === a[0]);
do {
a[2] = Math.floor(Math.random() * 9 + 1);
} while (a[2] === a[0] || a[2] === a[1]);
var b = [0, 0, 0];
b[0] = Math.floor(Math.random() * 3 + 1) * 2;
b[1] = Math.floor(Math.random() * (8 - b[0]) / 2 + 1) * 2;
b[2] = 12 - b[0] - b[1];
var c = [0, 0, 0];
c[0] = Math.floor(Math.random() * 2 + 1) * 2;
c[1] = Math.floor(Math.random() * 2 + 1) * 2;
if (c[0] + c[1] >= 8) {
if (c[0] > 2) c[0] -= 2;
else c[1] -= 2;
}
c[2] = 8 - c[0] - c[1];
j[0] = 0
j[1] = (b[0]) * 5;
j[2] = (b[0] + c[0]) * 5;
j[3] = (b[0] + c[0] + b[1]) * 5;
j[4] = (b[0] + c[0] + b[1] + c[1]) * 5;
j[5] = (b[0] + c[0] + b[1] + c[1] + b[2]) * 5;
j[6] = (b[0] + c[0] + b[1] + c[1] + b[2] + c[2]) * 5;
k[0] = 0;
k[1] = a[0];
k[2] = k[1];
k[3] = a[1];
k[4] = k[3];
k[5] = a[2];
k[6] = k[5];
var p = [];
p[0] = [0, 200];
p[1] = [b[0] * 20, 200 - a[0] * 20];
p[2] = [b[0] * 20 + c[0] * 20, 200 - a[0] * 20];
p[3] = [b[0] * 20 + c[0] * 20 + b[1] * 20, 200 - a[1] * 20];
p[4] = [b[0] * 20 + c[0] * 20 + b[1] * 20 + c[1] * 20, 200 - a[1] * 20];
p[5] = [b[0] * 20 + c[0] * 20 + b[1] * 20 + c[1] * 20 + b[2] * 20, 200 - a[2] * 20];
p[6] = [b[0] * 20 + c[0] * 20 + b[1] * 20 + c[1] * 20 + b[2] * 20 + c[2] * 20, 200 - a[2] * 20];
var outStr2 = 'M' + p.join(' ');
graphPath.setAttribute('d', outStr2);
for (var idx = 0; idx < 7; idx++) {
var tc = $('c' + idx);
tc.setAttribute('cx', p[idx][0]);
tc.setAttribute('cy', p[idx][1]);
tc = $('p' + idx);
tc.setAttribute('x', p[idx][0] - 4.5);
tc.setAttribute('y', p[idx][1] + 4.5);
}
var NAME = names[Math.floor(Math.random() * names.length)];
aa[0] = ((k[1] - k[0]) > 0 ? 'forward' : 'back');
aa[1] = Math.abs(k[1] - k[0]);
aa[2] = (j[1] - j[0]);
aa[3] = (j[2] - j[1]);
aa[4] = ((k[3] - k[2]) > 0 ? 'forward' : 'back');
aa[5] = Math.abs(k[3] - k[2]);
aa[6] = (j[3] - j[2]);
aa[7] = (j[4] - j[3]);
aa[8] = ((k[5] - k[4]) > 0 ? 'forward' : 'back');
aa[9] = Math.abs(k[5] - k[4]);
aa[10] = (j[5] - j[4]);
aa[11] = (j[6] - j[5]);
qText[2] = NAME +
" started at the door (0 meters) and<br>walked <select id='qq0'><option value='' selected> </option><option value='forward'>forward</option><option value='back'>back</option></select> <input id='qq1' size='4'> meters for <input id='qq2' size='4'> seconds,<br>stopped for <input id='qq3' size='4'> seconds,<br>walked <select id='qq4'><option value='' selected> </option><option value='forward'>forward</option><option value='back'>back</option></select> <input id='qq5' size='4'> meters for <input id='qq6' size='4'> seconds,<br>stopped for <input id='qq7' size='4'> seconds,<br>walked <select id='qq8'><option value='' selected> </option><option value='forward'>forward</option><option value='back'>back</option></select> <input id='qq9' size='4'> meters for <input id='qq10' size='4'> seconds,<br>and finally stopped for <input id='qq11' size='4'> seconds.<br><br><button onclick='check1();'>Submit Answers</button>";
var lineSegments = ['A and B', 'B and C', 'C and D', 'D and E', 'E and F', 'F and G'];
var lineDirections = ['going forward', 'standing still', 'going back'];
var qqVal = [0, 0, 1, 2, 2, 2, 2, 3, 4, 4, 4, 4, 5]
var q2Val = qqVal[Math.floor(Math.random() * qqVal.length)];
if ((k[q2Val + 1] - k[q2Val]) > 0) q2Answer = 0;
if ((k[q2Val + 1] - k[q2Val]) == 0) q2Answer = 1;
if ((k[q2Val + 1] - k[q2Val]) < 0) q2Answer = 2;
q3Answer = ((k[q2Val + 1] - k[q2Val]) / (j[q2Val + 1] - j[q2Val]));
qText[0] = 'Between points ' + lineSegments[q2Val] + ', ' + NAME +
" was <select id='qq12'><option value='' selected> </option><option value='0'>going forward</option><option value='1'>standing still</option><option value='2'>going back</option></select>.<br><br><button onclick='check2();'>Submit Answer</button>";
qText[1] = NAME + '\'s <i>velocity</i> between points ' + lineSegments[q2Val] +
" was <input id='qq13' size='6'> m/s<br><br><button onclick='check3();'>Submit Answer</button>";
do {
rr[0] = Math.floor(Math.random() * 7);
rr[1] = Math.floor(Math.random() * 7);
rr[2] = rr[1];
rr[3] = Math.floor(Math.random() * 7);
rr[4] = rr[3];
rr[5] = Math.floor(Math.random() * 7);
rr[6] = rr[5];
} while (rr[0] == rr[1] || rr[1] == rr[3] || rr[3] == rr[5])
qText[3] = '<i>Click on the graph above to move the points to match this description:</i><br><br>' + NAME +
' started at the ' + rr[0] + ' meter mark.<br>' + NAME + ' went ' + (rr[1] - rr[0] > 0 ? 'forward ' : 'back ') +
Math.abs(rr[1] - rr[0]) + ' meters, stopped for 10 seconds,<br>went ' + (rr[3] - rr[1] > 0 ? 'forward ' :
'back ') + Math.abs(rr[3] - rr[1]) + ' meters, stopped for 10 seconds,<br>went ' + (rr[5] - rr[3] > 0 ?
'forward ' : 'back ') + Math.abs(rr[5] - rr[3]) +
' meters, and finally stopped for 10 seconds.<br><br><button onclick="check4();">Submit Answer</button>';
$('result').innerHTML = qText[qOrder[qType]];
$('g1').style.display = 'none';
$('g2').style.display = 'none';
if (qOrder[qType] === 3) {
$('g2').style.display = 'block';
} else {
$('g1').style.display = 'block';
}
}
function check1() {
var testQ1 = [];
var ptpt = 0;
for (var idx = 0; idx < 12; idx++) {
testQ1.push($('qq' + idx).value);
if (aa[idx] != testQ1[idx]) {
$('qq' + idx).value = '';
} else {
ptpt += 0.5;
}
}
//$('result0').innerHTML = testQ1.join('') === aa.join(' ') ? 'correct' : 'incorrect';
if (testQ1.join('') !== '') isC(ptpt);
}
function check2() {
//$('result0').innerHTML = $('qq12').value === q2Answer.toString() ? 'correct' : 'incorrect';
if ($('qq12').value !== '') isC($('qq12').value === q2Answer.toString() ? 1 : 0);
}
function check3() {
var ua = Math.abs(parseFloat($('qq13').value) - q3Answer);
//$('result0').innerHTML = (ua < 0.01 ? 'correct' : 'incorrect');
if ($('qq13').value !== '') isC(ua < 0.01 ? 2 : 0);
}
function check4() {
var ptpt = 0;
for (var idx = 0; idx < outPosY.length; idx++) {
if (outPosY[idx] === rr[idx]) {
ptpt += 0.5;
}
}
// $('result0').innerHTML = (outPosY.join(' ') === rr.join(' ') ? 'correct' : 'incorrect');
if (parseInt(outPosY.join('')) > 0) isC(ptpt);
}
function isC(w) {
var ts = parseInt($('theScore').innerHTML);
ts += w;
$('theScore').innerHTML = ts;
qType++;
var sc =
'https://docs.google.com/forms/d/e/1FAIpQLScmfbs8w_VWMQML4z3EIAqgTfFuklcQMKK3nFjjPrpgSotO-g/viewform?usp=pp_url&entry.901367584=' +
getURLParameter('teacher') + '&entry.1270571468=' + encodeURI(getScoreString(ts));
if (qType > 6) {
window.location.href = sc;
} else {
generateGraph();
}
setCookie('theScoreU1Q0', ts.toString(10) + ',' + qType, 2);
}
function getScoreString(score) {
var e = '@';
if (score > 62) {
e = String.fromCharCode(score + 2);
score -= 62;
}
if (score > 62) {
score = 62;
}
var p = Math.floor(Math.random() * 8) + 1;
var s = '';
s += String.fromCharCode(p + 64);
for (var i = 1; i < 12; i++) {
if (i === p) {
s += String.fromCharCode(score + 64);
} else {
var c = String.fromCharCode(Math.floor(Math.random() * 62) + 64);
s += c
}
}
s += e;
s += String.fromCharCode(Math.floor(Math.random() * 62) + 64);
return s + ' - Unit 1 Quiz 0';
}
function getURLParameter(name) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(window.location.search) ||
[null, ''])[1].replace(/\+/g, '%20')) || null;
}
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
var expires = "expires=" + d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "0,0";
}
var checkScoreCookie = getCookie('theScoreU1Q0').split(',');
if (checkScoreCookie[0] !== '0') {
$('theScore').innerHTML = checkScoreCookie[0];
qType = parseInt(checkScoreCookie[1]);
}
generateGraph();
</script>
</body>
</html>