-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfinal.nb
2839 lines (2779 loc) · 139 KB
/
final.nb
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
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(* Content-type: application/vnd.wolfram.mathematica *)
(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)
(* CreatedBy='Mathematica 10.1' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[ 158, 7]
NotebookDataLength[ 141988, 2831]
NotebookOptionsPosition[ 139544, 2744]
NotebookOutlinePosition[ 139918, 2760]
CellTagsIndexPosition[ 139875, 2757]
WindowFrame->Normal*)
(* Beginning of Notebook Content *)
Notebook[{
Cell[CellGroupData[{
Cell["Aaron Kirtland and Caleb Stickney", "Section",
CellChangeTimes->{{3.6676850227875023`*^9, 3.6676850328005023`*^9}, {
3.6677633798124123`*^9, 3.6677633817144117`*^9}}],
Cell[CellGroupData[{
Cell["playSound", "Subsubsection",
CellChangeTimes->{{3.6707140587179356`*^9, 3.670714061516049*^9}}],
Cell[BoxData[{
RowBox[{
RowBox[{"Clear", "@", "playSound"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"playSound", "[", "filename_String", "]"}], ":=",
RowBox[{"EmitSound", "@",
RowBox[{"Import", "[",
RowBox[{"filename", ",", "\"\<WAV\>\""}], "]"}]}]}], ";"}]}], "Input",
CellChangeTimes->{{3.671472978424511*^9, 3.671472983369587*^9}, {
3.671485121305526*^9, 3.671485130847066*^9}, {3.6714851631839*^9,
3.671485170735827*^9}, 3.671485219497597*^9, {3.6714863657393475`*^9,
3.6714863732247705`*^9}, {3.671745328777035*^9, 3.6717453312161713`*^9}}]
}, Closed]],
Cell[CellGroupData[{
Cell["updateMovement", "Subsubsection",
CellChangeTimes->{{3.6707140540407486`*^9, 3.6707140561308317`*^9}}],
Cell[BoxData[{
RowBox[{
RowBox[{"Clear", "@", "updateMovement"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"updateMovement", "[", "movement_", "]"}], ":=",
RowBox[{"If", "[",
RowBox[{
RowBox[{"MemberQ", "[",
RowBox[{"path", ",",
RowBox[{"pacman", "+", "movement"}]}], "]"}], ",",
RowBox[{"dir", "=", "movement"}], ",",
RowBox[{"nextDir", "=", "movement"}]}], "]"}]}], ";"}]}], "Input",
CellChangeTimes->{
3.670714021764453*^9, {3.6714729700493827`*^9, 3.6714729765044813`*^9}, {
3.67148314421873*^9, 3.6714831453794327`*^9}, {3.671485173633992*^9,
3.671485178718777*^9}, {3.6714852136747675`*^9, 3.671485214601819*^9},
3.671485941222873*^9, 3.67148676304241*^9}]
}, Closed]],
Cell[CellGroupData[{
Cell["round", "Subsubsection",
CellChangeTimes->{{3.6707686747894773`*^9, 3.670768675295376*^9}}],
Cell[BoxData[{
RowBox[{
RowBox[{"Clear", "@", "round"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"round", "[", "list_", "]"}], ":=",
RowBox[{"8",
RowBox[{"Floor", "[",
FractionBox["list", "8.0"], "]"}]}]}], ";"}]}], "Input",
CellChangeTimes->{{3.6707686802623825`*^9, 3.670768705533827*^9}, {
3.671472986044628*^9, 3.6714729894496803`*^9}, {3.6714840046115503`*^9,
3.671484005748114*^9}, {3.671485139459556*^9, 3.6714851583386235`*^9}, {
3.6714852733206425`*^9, 3.6714852743527017`*^9}, {3.6714853194022307`*^9,
3.671485320921315*^9}, {3.671485374284316*^9, 3.6714853796196127`*^9}, {
3.671485442465102*^9, 3.6714854636587954`*^9}, {3.6714854947242503`*^9,
3.671485494944254*^9}, 3.6719786222243834`*^9, 3.681652703036721*^9, {
3.6878079091221495`*^9, 3.6878079197753754`*^9}, {3.687872142370866*^9,
3.687872154562357*^9}, {3.687872319633153*^9, 3.687872342882124*^9}, {
3.687872377024044*^9, 3.6878723771766996`*^9}, {3.6878724530941668`*^9,
3.687872459187309*^9}, {3.687872490104506*^9, 3.687872490258173*^9}, {
3.687872556367315*^9, 3.687872562018614*^9}, {3.6878731684166203`*^9,
3.6878731976224575`*^9}, {3.687874898643072*^9, 3.6878749235010033`*^9}, {
3.687875535068113*^9, 3.6878755499912806`*^9}}]
}, Closed]],
Cell[CellGroupData[{
Cell["stopScheduledTasks", "Subsubsection",
CellChangeTimes->{{3.6714845463045583`*^9, 3.671484549093712*^9}}],
Cell[BoxData[{
RowBox[{
RowBox[{"Clear", "@", "stopScheduledTasks"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"stopScheduledTasks", "[", "]"}], ":=",
RowBox[{
RowBox[{
RowBox[{"StopScheduledTask", "@", "#"}], "&"}], "/@",
RowBox[{"ScheduledTasks", "[", "]"}]}]}], ";"}]}], "Input",
CellChangeTimes->{{3.6714845557690873`*^9, 3.6714845831656017`*^9}, {
3.671747865953209*^9, 3.6717478695094156`*^9}, {3.6878173611674533`*^9,
3.6878173668041363`*^9}}]
}, Closed]],
Cell[CellGroupData[{
Cell["getTargetTile", "Subsubsection",
CellChangeTimes->{{3.670714045157391*^9, 3.6707140496995745`*^9},
3.6717479260269737`*^9}],
Cell[BoxData[{
RowBox[{
RowBox[{"Clear", "@", "getTargetTile"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"getTargetTile", "[", "i_", "]"}], ":=",
RowBox[{"If", "[",
RowBox[{"isScattering", ",",
RowBox[{
"ghostCorners", "\[LeftDoubleBracket]", "i", "\[RightDoubleBracket]"}],
",", "\[IndentingNewLine]",
RowBox[{"Switch", "[",
RowBox[{"i", ",", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
"blinky", " ", "always", " ", "goes", " ", "for", " ", "pacman"}],
"*)"}], "\[IndentingNewLine]", "1", ",", "pacman", ",",
"\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
"go", " ", "for", " ", "the", " ", "tile", " ", "that", " ", "is",
" ", "at", " ", "blinky", " ", "plus", " ", "2", " ", "times", " ",
"the", " ", "distance", " ", "between", " ", "2", " ", "spots", " ",
"ahead", " ", "of", " ", "pacman", " ", "and", " ", "blinky"}],
"*)"}], "\[IndentingNewLine]", "2", ",",
RowBox[{
RowBox[{
"ghosts", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}], "+",
RowBox[{"2",
RowBox[{"(",
RowBox[{"pacman", "+",
RowBox[{"2", "dir"}], "-",
RowBox[{
"ghosts", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}]}],
")"}]}]}], ",", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
"go", " ", "for", " ", "4", " ", "tiles", " ", "ahead", " ", "of",
" ", "pacman"}], "*)"}], "\[IndentingNewLine]", "3", ",",
RowBox[{"pacman", "+",
RowBox[{"4", "dir"}]}], ",", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
RowBox[{
"if", " ", "the", " ", "distance", " ", "between", " ", "it", " ",
"and", " ", "pacman", " ", "is", " ", "greater", " ", "than", " ",
"8"}], ",", " ",
RowBox[{"go", " ", "for", " ",
RowBox[{"pacman", ".", " ", "else"}]}], ",", " ",
RowBox[{
"go", " ", "for", " ", "the", " ", "bottom", " ", "left", " ",
"corner"}]}], "*)"}], "\[IndentingNewLine]", "4", ",",
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"EuclideanDistance", "[",
RowBox[{
RowBox[{
"ghosts", "\[LeftDoubleBracket]", "i", "\[RightDoubleBracket]"}],
",", "pacman"}], "]"}], ">", "24"}], ",", "pacman", ",",
RowBox[{
"ghostCorners", "\[LeftDoubleBracket]", "4",
"\[RightDoubleBracket]"}]}], "]"}]}], "\[IndentingNewLine]",
"]"}]}], "\[IndentingNewLine]", "]"}]}], ";"}]}], "Input",
CellChangeTimes->{
3.670714037441081*^9, {3.671472961076745*^9, 3.6714729674668427`*^9}, {
3.6714851905964527`*^9, 3.6714851958217487`*^9}, 3.671485229332656*^9, {
3.671485264740172*^9, 3.6714852667582817`*^9}, {3.67148532708066*^9,
3.671485332151946*^9}, {3.6878751646361556`*^9, 3.6878752233357935`*^9}, {
3.6878752801678905`*^9, 3.687875302723347*^9}, {3.6878753616345263`*^9,
3.6878754279416666`*^9}, 3.687875615397888*^9}]
}, Closed]],
Cell[CellGroupData[{
Cell["collisions", "Subsubsection",
CellChangeTimes->{{3.671139624303959*^9, 3.6711396254889584`*^9}}],
Cell[BoxData[{
RowBox[{
RowBox[{"Clear", "@", "collisions"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"collisions", "[", "]"}], ":=", "\[IndentingNewLine]",
RowBox[{"For", "[",
RowBox[{
RowBox[{"i", "=", "1"}], ",",
RowBox[{"i", "\[LessEqual]",
RowBox[{"Length", "[", "ghosts", "]"}]}], ",",
RowBox[{"i", "++"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"EuclideanDistance", "[",
RowBox[{"pacman", ",",
RowBox[{
"ghosts", "\[LeftDoubleBracket]", "i", "\[RightDoubleBracket]"}]}],
"]"}], "\[LessEqual]", "4"}], ",", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
"If", " ", "frightened", " ", "mode", " ", "is", " ", "active", " ",
"then", " ", "the", " ", "ghost", " ", "is", " ", "returned", " ",
"to", " ", "the", " ", "center"}], "*)"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"If", "[",
RowBox[{
RowBox[{
"isFrightened", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{
"isFrightened", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}], "=", "False"}], ";",
"\[IndentingNewLine]",
RowBox[{
RowBox[{
"ghosts", "\[LeftDoubleBracket]", "i", "\[RightDoubleBracket]"}],
"=",
RowBox[{"{",
RowBox[{"104", ",", "152"}], "}"}]}], ";",
RowBox[{"killCounter", "++"}], ";",
RowBox[{"(*",
RowBox[{
"Score", " ", "is", " ", "incremented", " ", "based", " ", "on",
" ", "the", " ", "number", " ", "of", " ", "ghosts", " ",
"eaten"}], "*)"}], " ",
RowBox[{"Switch", "[",
RowBox[{"killCounter", ",", "1", ",",
RowBox[{"score", "+=", "200"}], ",", "2", ",",
RowBox[{"score", "+=", "400"}], ",", "3", ",",
RowBox[{"score", "+=", "800"}], ",", "4", ",",
RowBox[{"score", "+=", "1600"}]}], "]"}], ";"}],
RowBox[{"(*",
RowBox[{"playSound", "[", "\"\<sound/Ghost Eat.wav\>\"", "]"}],
"*)"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
"If", " ", "frightened", " ", "mode", " ", "is", " ", "not", " ",
"acative", " ", "pacman", " ", "is", " ", "returned", " ", "to",
" ", "spawn"}], "*)"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"pacman", "=", "spawn"}], ";",
RowBox[{"ghosts", "=", "ghostSpawns"}], ";",
RowBox[{"counter", "=",
RowBox[{"-", "1"}]}], ";",
RowBox[{"deathCounter", "--"}], ";", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
RowBox[{"EmitSound", "@",
RowBox[{"Import", "[",
RowBox[{
"\"\<sound/Pacman-death-sound.mp3\>\"", ",", "\"\<MP3\>\""}],
"]"}]}], ";"}], "*)"}], "\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{"deathCounter", "<", "1"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"stopScheduledTasks", "[", "]"}], ";",
RowBox[{"NotebookClose", "[", "]"}], ";",
RowBox[{"gameReset", "[", "]"}], ";",
RowBox[{"startScreen", "[", "]"}], ";"}]}],
"\[IndentingNewLine]", "]"}], ";"}]}], "\[IndentingNewLine]",
"]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}]}],
"\[IndentingNewLine]", "]"}]}], ";"}]}], "Input",
CellChangeTimes->{
3.6711407970039587`*^9, {3.6714729926447296`*^9, 3.6714729985123196`*^9}, {
3.6714836724647923`*^9, 3.671483754916542*^9}, {3.671483788111102*^9,
3.671483803872831*^9}, {3.6714838518802557`*^9, 3.6714838782391376`*^9}, {
3.671484665933894*^9, 3.6714846723492537`*^9}, 3.6714852811240826`*^9, {
3.671486939857429*^9, 3.6714869707381716`*^9}, {3.671708965889984*^9,
3.671708975170511*^9}, {3.6717092624717836`*^9, 3.6717092626589837`*^9}, {
3.671723069151862*^9, 3.6717230693798747`*^9}, {3.6717496192101126`*^9,
3.6717496502868843`*^9}, {3.6717497366748047`*^9,
3.6717497447007623`*^9}, {3.6717498466096153`*^9, 3.67174984688163*^9}, {
3.671750459835398*^9, 3.6717504602074194`*^9}, {3.6717925837397614`*^9,
3.6717925948619814`*^9}, {3.6717926637280617`*^9,
3.6717926639410734`*^9}, {3.6718977406073194`*^9,
3.6718977428714485`*^9}, {3.671897814653448*^9, 3.6718978167315636`*^9}, {
3.671897872288685*^9, 3.6718979415820417`*^9}, {3.6718980123559265`*^9,
3.671898023272846*^9}, {3.6718980682819614`*^9, 3.6718980984962153`*^9}, {
3.671957318684411*^9, 3.671957347339363*^9}, 3.67195758099564*^9, {
3.6719576153685637`*^9, 3.671957763653911*^9}, {3.6719578541374817`*^9,
3.671957899730056*^9}, {3.671957947471778*^9, 3.671957980309626*^9}, {
3.6719580177977467`*^9, 3.671958031394512*^9}, {3.671958108134327*^9,
3.6719581397581177`*^9}, {3.6719584998933983`*^9, 3.671958534766364*^9}, {
3.671958566145073*^9, 3.6719585759626207`*^9}, {3.6719586076663423`*^9,
3.671958626566408*^9}, {3.6719586754507737`*^9, 3.6719586756223736`*^9}, {
3.6719595937214055`*^9, 3.6719596024100213`*^9}, {3.6719639782419004`*^9,
3.6719639784839144`*^9}, {3.6719748377370596`*^9,
3.6719748377890625`*^9}, {3.6719785294751005`*^9, 3.671978550374138*^9}, {
3.6719787306588464`*^9, 3.6719787517570505`*^9}, {3.6719789316452866`*^9,
3.6719789563026943`*^9}, 3.671979115820992*^9, 3.671979165252798*^9,
3.6719792736119604`*^9, {3.6719793107610693`*^9, 3.6719793672712774`*^9}, {
3.6878044538930826`*^9, 3.687804458298217*^9}, {3.687808191002309*^9,
3.687808192737539*^9}, {3.687808225626368*^9, 3.687808245195272*^9}, {
3.687818258921916*^9, 3.6878182619940243`*^9}, {3.687871743365384*^9,
3.687871749418995*^9}, {3.6878827557332788`*^9, 3.6878827587403917`*^9}, {
3.6981409629342194`*^9, 3.698140993042206*^9}, {3.698141145243328*^9,
3.698141174073702*^9}, {3.698141269980795*^9, 3.698141277854307*^9}, {
3.6981413307867565`*^9, 3.6981413553200707`*^9}, {3.6981414529900093`*^9,
3.6981414565389814`*^9}}]
}, Closed]],
Cell[CellGroupData[{
Cell["ifOnPath", "Subsubsection",
CellChangeTimes->{{3.6711426569920855`*^9, 3.6711426587912617`*^9}}],
Cell[BoxData[{
RowBox[{
RowBox[{"Clear", "@", "ifOnPath"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"ifOnPath", "[",
RowBox[{"pos_", ",", "obj_"}], "]"}], ":=",
RowBox[{"Block", "[",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"roundOrigin", "=",
RowBox[{"round", "[", "pos", "]"}]}], ",",
RowBox[{"roundMax", "=",
RowBox[{"round", "[",
RowBox[{"pos", "+",
RowBox[{"{",
RowBox[{"7", ",", "7"}], "}"}]}], "]"}]}]}], "}"}], ",",
"\[IndentingNewLine]",
RowBox[{
RowBox[{"MemberQ", "[",
RowBox[{"path", ",", "roundOrigin"}], "]"}], "&&",
RowBox[{"MemberQ", "[",
RowBox[{"path", ",", "roundMax"}], "]"}], "&&", "\[IndentingNewLine]",
RowBox[{"(",
RowBox[{
RowBox[{
RowBox[{"obj", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}],
"==",
RowBox[{
"roundOrigin", "\[LeftDoubleBracket]", "1",
"\[RightDoubleBracket]"}]}], "||",
RowBox[{
RowBox[{"obj", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}],
"==",
RowBox[{
"roundOrigin", "\[LeftDoubleBracket]", "2",
"\[RightDoubleBracket]"}]}]}], ")"}], "&&", "\[IndentingNewLine]",
RowBox[{"(",
RowBox[{
RowBox[{
RowBox[{"obj", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}],
"==",
RowBox[{
"roundMax", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}]}],
"||",
RowBox[{
RowBox[{"obj", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}],
"==",
RowBox[{
"roundMax", "\[LeftDoubleBracket]", "2",
"\[RightDoubleBracket]"}]}]}], ")"}]}]}], "\[IndentingNewLine]",
"]"}]}]}], "Input",
CellChangeTimes->{{3.671141952833491*^9, 3.6711420457153606`*^9}, {
3.6711421877987466`*^9, 3.671142189403904*^9}, 3.6711422324126463`*^9,
3.671142417703725*^9, {3.671471411894842*^9, 3.6714714754658184`*^9}, {
3.6714730051299214`*^9, 3.6714730102625003`*^9}, 3.671708955286391*^9,
3.67170954363939*^9, {3.6878744608855066`*^9, 3.687874545600357*^9}, {
3.687874653092845*^9, 3.6878746654160204`*^9}}]
}, Closed]],
Cell[CellGroupData[{
Cell["update", "Subsubsection",
CellChangeTimes->{{3.6707141451944103`*^9, 3.6707141478645167`*^9}}],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{
RowBox[{"(*",
RowBox[{"variable", " ", "used", " ", "to", " ", "update", " ", "board"}],
"*)"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"update", "=",
RowBox[{"CreateScheduledTask", "[", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{"keep", " ", "track", " ", "of", " ", "elapsed", " ", "time"}],
"*)"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"counter", "++"}], ";", "\[IndentingNewLine]",
"\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{"if", " ", "need", " ", "to", " ", "switch", " ",
RowBox[{"scatter", "/", "chase"}]}], "*)"}], "\[IndentingNewLine]",
RowBox[{"If", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"shouldScatter", "&&",
RowBox[{"(", "\[IndentingNewLine]",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"level", "\[Equal]", "1"}], "&&",
RowBox[{"MemberQ", "[",
RowBox[{
RowBox[{"perSecond", " ",
RowBox[{
"scatterTimes", "\[LeftDoubleBracket]", "1",
"\[RightDoubleBracket]"}]}], ",", "counter"}], "]"}]}],
")"}], "||",
RowBox[{"(",
RowBox[{
RowBox[{"2", "\[LessEqual]", "level", "\[LessEqual]", "4"}], "&&",
RowBox[{"MemberQ", "[",
RowBox[{
RowBox[{"perSecond", " ",
RowBox[{
"scatterTimes", "\[LeftDoubleBracket]", "2",
"\[RightDoubleBracket]"}]}], ",", "counter"}], "]"}]}],
")"}], "||",
RowBox[{"(",
RowBox[{
RowBox[{"level", "\[GreaterEqual]", "5"}], "&&",
RowBox[{"MemberQ", "[",
RowBox[{
RowBox[{"perSecond", " ",
RowBox[{
"scatterTimes", "\[LeftDoubleBracket]", "3",
"\[RightDoubleBracket]"}]}], ",", "counter"}], "]"}]}],
")"}]}], ")"}]}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"isScattering", "=",
RowBox[{"!", "isScattering"}]}], ";"}]}], "\[IndentingNewLine]",
"]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{"pacman", " ", "interactions", " ", "with", " ", "tiles"}],
"*)"}], "\[IndentingNewLine]",
RowBox[{"Which", "[", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{"NORMAL", " ", "DOT", " ", "IS", " ", "EATEN"}], "*)"}],
"\[IndentingNewLine]",
RowBox[{
RowBox[{"MemberQ", "[",
RowBox[{"dots", ",", "pacman"}], "]"}], ",",
RowBox[{
RowBox[{"score", "+=", "10"}], ";",
RowBox[{"dots", "=",
RowBox[{"DeleteCases", "[",
RowBox[{"dots", ",", "pacman"}], "]"}]}]}],
RowBox[{"(*",
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"Length", "@", "dots"}], "\[Equal]", "0"}], ",",
RowBox[{"Goto", "[", "begin", "]"}]}], "]"}], "*)"}],
"\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{"EmitSound", "@",
RowBox[{"Sound", "@",
RowBox[{"SoundNote", "[", "]"}]}]}], "*)"}], ",",
"\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{"POWER", " ", "DOT", " ", "IS", " ", "EATEN"}], "*)"}],
"\[IndentingNewLine]",
RowBox[{"MemberQ", "[",
RowBox[{"power", ",",
RowBox[{"round", "@", "pacman"}]}], "]"}], ",",
RowBox[{
RowBox[{"score", "+=", "50"}], ";",
RowBox[{"power", "=",
RowBox[{"DeleteCases", "[",
RowBox[{"power", ",", "pacman"}], "]"}]}], ";",
RowBox[{"isFrightened", "=",
RowBox[{"Table", "[",
RowBox[{"True", ",",
RowBox[{"{", "4.", "}"}]}], "]"}]}], ";",
RowBox[{"killCounter", "=", "0"}], ";",
RowBox[{"ghostsDir", "=",
RowBox[{"-", "ghostsDir"}]}], ";",
RowBox[{"StartScheduledTask", "[", "turnOffFrightened", "]"}]}]}],
"\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]",
"\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{"dots", "==",
RowBox[{"{", "}"}]}], ",",
RowBox[{
RowBox[{"level", "++"}], ";",
RowBox[{"gameReset", "[", "]"}], ";",
RowBox[{"startGame", "[", "]"}], ";"}]}], "]"}], ";",
"\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{"pacman", " ", "movement"}], "*)"}], "\[IndentingNewLine]",
RowBox[{"Which", "[", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
"pacman", " ", "is", " ", "on", " ", "a", " ", "warp", " ", "time"}],
"*)"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"MemberQ", "[",
RowBox[{"warps", ",", "pacman"}], "]"}], ",",
RowBox[{"pacman", "=",
RowBox[{
RowBox[{"warps", "\[LeftDoubleBracket]",
RowBox[{"1", "+",
RowBox[{"Boole", "[",
RowBox[{"pacman", "\[Equal]",
RowBox[{
"warps", "\[LeftDoubleBracket]", "1",
"\[RightDoubleBracket]"}]}], "]"}]}],
"\[RightDoubleBracket]"}], "+", "dir"}]}], ",",
"\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
RowBox[{"if", " ",
RowBox[{"pacman", "'"}], "s", " ", "next", " ", "direction", " ",
"is", " ", "not", " ", "blank", " ", "and", " ", "is", " ", "on",
" ", "the", " ", "path"}], ",", " ",
RowBox[{
"make", " ", "pacman", " ", "go", " ", "in", " ", "the", " ",
"next", " ", "direction", " ", "and", " ", "the", " ", "current",
" ", "direction", " ", "become", " ", "the", " ", "old", " ",
"next", " ",
RowBox[{"direction", ".", " ", "the"}], " ", "next", " ",
"direction", " ", "is", " ", "now", " ", "blank"}]}], "*)"}],
"\[IndentingNewLine]",
RowBox[{
RowBox[{"nextDir", "\[NotEqual]",
RowBox[{"{",
RowBox[{"0", ",", "0"}], "}"}]}], "&&",
RowBox[{"ifOnPath", "[",
RowBox[{
RowBox[{"pacman", "+", "nextDir"}], ",", "pacman"}], "]"}]}], ",",
"\[IndentingNewLine]",
RowBox[{
RowBox[{"pacman", "+=", "nextDir"}], ";",
RowBox[{"dir", "=", "nextDir"}], ";",
RowBox[{"nextDir", "=",
RowBox[{"{",
RowBox[{"0", ",", "0"}], "}"}]}]}], " ", ",",
"\[IndentingNewLine]",
RowBox[{"ifOnPath", "[",
RowBox[{
RowBox[{"pacman", "+", "dir"}], ",", "pacman"}], "]"}], ",",
"\[IndentingNewLine]",
RowBox[{"pacman", "+=", "dir"}]}], "\[IndentingNewLine]", "]"}], ";",
"\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{"ghost", " ", "actual", " ", "game", " ", "AI"}], "*)"}],
"\[IndentingNewLine]",
RowBox[{"ghosts", "=",
RowBox[{"Table", "[", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{"chase", " ", "or", " ", "frightened", " ", "mode"}],
"*)"}], "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
"current", " ", "position", " ", "plus", " ", "the", " ", "change",
" ", "in", " ", "direction"}], "*)"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"Which", "[", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{"if", " ", "in", " ", "ghost", " ", "house"}], "*)"}],
"\[IndentingNewLine]",
RowBox[{
RowBox[{"counter", "<",
RowBox[{"5", "perSecond",
RowBox[{"(",
RowBox[{"i", "-", "1"}], ")"}]}]}], ",",
RowBox[{
"ghosts", "\[LeftDoubleBracket]", "i", "\[RightDoubleBracket]"}],
",", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
"if", " ", "supposed", " ", "to", " ", "be", " ", "moving", " ",
"outside", " ", "ghost", " ", "house"}], "*)"}],
"\[IndentingNewLine]",
RowBox[{"counter", "\[Equal]",
RowBox[{"5", "perSecond",
RowBox[{"(",
RowBox[{"i", "-", "1"}], ")"}]}]}], ",",
RowBox[{
RowBox[{
"ghosts", "\[LeftDoubleBracket]", "i", "\[RightDoubleBracket]"}],
"+",
RowBox[{"{",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"-", "8"}], "i"}], "+", "16"}], ",", "24"}], "}"}]}],
",", "\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
"ghost", " ", "is", " ", "on", " ", "a", " ", "warp", " ",
"tile"}], "*)"}], "\[IndentingNewLine]",
RowBox[{"MemberQ", "[",
RowBox[{"warps", ",",
RowBox[{
"ghosts", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}]}], "]"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"warps", "\[LeftDoubleBracket]",
RowBox[{"1", "+",
RowBox[{"Boole", "[",
RowBox[{
RowBox[{
"ghosts", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}], "\[Equal]",
RowBox[{
"warps", "\[LeftDoubleBracket]", "1",
"\[RightDoubleBracket]"}]}], "]"}]}],
"\[RightDoubleBracket]"}], "+",
RowBox[{
"ghostsDir", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}]}], ",", "\[IndentingNewLine]",
"\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
"ghost", " ", "is", " ", "on", " ", "an", " ", "intersection",
" ", "point", " ", "and", " ", "is", " ", "frightened"}],
"*)"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"MemberQ", "[",
RowBox[{"intersections", ",",
RowBox[{
"ghosts", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}]}], "]"}], "&&",
RowBox[{
"isFrightened", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}]}], ",", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
"return", " ", "a", " ", "random", " ", "direction", " ", "that",
" ", "is", " ", "on", " ", "the", " ", "path"}], "*)"}],
"\[IndentingNewLine]",
RowBox[{
RowBox[{
"ghosts", "\[LeftDoubleBracket]", "i", "\[RightDoubleBracket]"}],
"+",
RowBox[{"(",
RowBox[{
RowBox[{
"ghostsDir", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}], "=",
RowBox[{"RandomChoice", "[",
RowBox[{"Select", "[",
RowBox[{"directions", ",",
RowBox[{
RowBox[{"ifOnPath", "[",
RowBox[{
RowBox[{
RowBox[{
"ghosts", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}], "+", "#"}], ",",
RowBox[{
"ghosts", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}]}], "]"}], "&"}]}], "]"}],
"]"}]}], ")"}]}], ",", "\[IndentingNewLine]",
"\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
RowBox[{"just", " ", "on", " ", "an", " ", "intersectioin"}],
",", " ",
RowBox[{"but", " ", "not", " ", "frightened"}]}], " ", "*)"}],
"\[IndentingNewLine]",
RowBox[{"MemberQ", "[",
RowBox[{"intersections", ",",
RowBox[{
"ghosts", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}]}], "]"}], ",", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{"if", " ", "not", " ", "frightened", " ",
RowBox[{"i", ".", "e", ".", " ", "in"}], " ", "chase"}], "*)"}],
"\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
"select", " ", "the", " ", "points", " ", "that", " ", "are",
" ", "on", " ", "the", " ", "path", " ", "from", " ", "the",
" ", "directions"}], "*)"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
"ghosts", "\[LeftDoubleBracket]", "i", "\[RightDoubleBracket]"}],
"+",
RowBox[{"(",
RowBox[{
RowBox[{
"ghostsDir", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}], "=",
RowBox[{
FractionBox["1", "8"],
RowBox[{"(",
RowBox[{
RowBox[{"First", "@",
RowBox[{"Sort", "[", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
"get", " ", "the", " ", "points", " ", "out", " ", "of",
" ", "the", " ", "four", " ", "directions", " ", "that",
" ", "are", " ", "on", " ", "the", " ", "path"}], "*)"}],
"\[IndentingNewLine]",
RowBox[{
RowBox[{"Select", "[",
RowBox[{
RowBox[{
RowBox[{
RowBox[{
RowBox[{
"ghosts", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}], "+",
RowBox[{"8", "#"}]}], "&"}], "/@", "directions"}], ",",
RowBox[{
RowBox[{"MemberQ", "[",
RowBox[{"path", ",", "#"}], "]"}], "&"}]}], "]"}], ",",
"\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
"sort", " ", "by", " ", "the", " ", "distance", " ",
"between", " ", "that", " ", "point", " ", "and", " ",
"the", " ", "target", " ", "tile"}], "*)"}],
"\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"EuclideanDistance", "[",
RowBox[{
RowBox[{"getTargetTile", "[", "i", "]"}], ",", "#1"}],
"]"}], "<",
RowBox[{"EuclideanDistance", "[",
RowBox[{
RowBox[{"getTargetTile", "[", "i", "]"}], ",", "#2"}],
"]"}]}], "&"}]}], "]"}]}], "\[IndentingNewLine]", "-",
RowBox[{
"ghosts", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}]}], ")"}]}]}], ")"}]}], ",",
"\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
"ghost", " ", "will", " ", "be", " ", "on", " ", "the", " ",
"path", " ", "after", " ", "the", " ", "next", " ", "move"}],
"*)"}], "\[IndentingNewLine]",
RowBox[{"ifOnPath", "[",
RowBox[{
RowBox[{
RowBox[{
"ghosts", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}], "+",
RowBox[{
"ghostsDir", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}]}], ",",
RowBox[{
"ghosts", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}]}], "]"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{
"ghosts", "\[LeftDoubleBracket]", "i", "\[RightDoubleBracket]"}],
"+",
RowBox[{
"ghostsDir", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}]}], ",", "\[IndentingNewLine]",
"\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
RowBox[{
"if", " ", "ghost", " ", "will", " ", "not", " ", "be", " ",
"on", " ", "the", " ", "path"}], ",", " ",
RowBox[{
"turn", " ", "onto", " ", "the", " ", "available", " ",
"corridor"}]}], "*)"}], "\[IndentingNewLine]", "True", ",",
"\[IndentingNewLine]",
RowBox[{
RowBox[{
"ghosts", "\[LeftDoubleBracket]", "i", "\[RightDoubleBracket]"}],
"+",
RowBox[{"If", "[",
RowBox[{
RowBox[{"ifOnPath", "[",
RowBox[{
RowBox[{
RowBox[{
"ghosts", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}], "+",
RowBox[{"Reverse", "@",
RowBox[{
"ghostsDir", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}]}]}], ",",
RowBox[{
"ghosts", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}]}], "]"}], ",",
"\[IndentingNewLine]",
RowBox[{
RowBox[{
"ghostsDir", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}], "=",
RowBox[{"Reverse", "[",
RowBox[{
"ghostsDir", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}], "]"}]}], ",",
"\[IndentingNewLine]",
RowBox[{
RowBox[{
"ghostsDir", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}], "=",
RowBox[{"-",
RowBox[{"Reverse", "[",
RowBox[{
"ghostsDir", "\[LeftDoubleBracket]", "i",
"\[RightDoubleBracket]"}], "]"}]}]}]}],
"\[IndentingNewLine]", "]"}]}]}], "\[IndentingNewLine]", "]"}],
"\[IndentingNewLine]", ",",
RowBox[{"{",
RowBox[{"i", ",",
RowBox[{"Length", "@", "ghosts"}]}], "}"}]}], "]"}]}], ";",
"\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
"If", " ", "pacman", " ", "collides", " ", "with", " ", "a", " ",
"ghost"}], "*)"}], "\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{"AnyTrue", "[",
RowBox[{
RowBox[{
RowBox[{
RowBox[{
RowBox[{"EuclideanDistance", "[",
RowBox[{"pacman", ",", "#"}], "]"}], "\[LessEqual]", "4"}],
"&"}], "/@", "ghosts"}], ",", "TrueQ"}], "]"}], ",",
RowBox[{"collisions", "[", "]"}]}], "]"}], ";"}],
"\[IndentingNewLine]", "\[IndentingNewLine]", ",",
RowBox[{"1", "/", "perSecond"}]}], "]"}]}], ";"}]}]], "Input",
CellChangeTimes->{{3.6707141611810503`*^9, 3.6707141623310966`*^9}, {
3.670715211408469*^9, 3.670715269185688*^9}, {3.670715345690899*^9,
3.6707153553840947`*^9}, {3.6707154012267036`*^9,
3.6707154307785263`*^9}, {3.6707154610693183`*^9,
3.6707155236158266`*^9}, {3.6707156555205693`*^9, 3.670715716947745*^9}, {
3.670715747894437*^9, 3.670715771936197*^9}, {3.670715923529687*^9,
3.670715948504438*^9}, {3.6707160169362974`*^9, 3.6707160363232975`*^9},
3.6707161295682974`*^9, {3.670768266392311*^9, 3.6707682672592125`*^9}, {
3.6707684326879945`*^9, 3.6707684347465725`*^9}, {3.670768546916627*^9,
3.6707685474262753`*^9}, {3.6707685806398106`*^9, 3.670768582616915*^9}, {
3.6707686567860785`*^9, 3.6707686580698214`*^9}, {3.670768732096013*^9,
3.67076873711201*^9}, {3.6707694182474766`*^9, 3.6707695469194746`*^9}, {
3.6707695866788206`*^9, 3.6707695955714674`*^9}, {3.670769936299893*^9,
3.6707699870963135`*^9}, {3.6707707152234464`*^9, 3.6707707342665863`*^9},
3.6708750796126413`*^9, {3.6708753056235695`*^9, 3.6708753484133396`*^9}, {
3.670875459103403*^9, 3.6708754610784817`*^9}, {3.670875535930476*^9,
3.670875539100603*^9}, 3.6708756338483934`*^9, {3.6708757731759114`*^9,
3.6708758200286846`*^9}, {3.670875887715707*^9, 3.670875889463879*^9}, {
3.6708760213343782`*^9, 3.6708760222204657`*^9}, {3.670876119866413*^9,
3.670876120024429*^9}, 3.6708761791781254`*^9, {3.6708762942579823`*^9,
3.6708763171527424`*^9}, {3.6708783341081753`*^9,
3.6708783607311754`*^9}, {3.6708785139361715`*^9,
3.6708785907271233`*^9}, {3.6708787678713417`*^9, 3.67087880459958*^9}, {
3.6708788432503567`*^9, 3.670878862303239*^9}, {3.6708789015315285`*^9,
3.6708789075991507`*^9}, 3.6708789623473496`*^9, {3.6708789944879985`*^9,
3.670879033046275*^9}, {3.670879076238144*^9, 3.6708790764581485`*^9}, {
3.6708791151734276`*^9, 3.6708791390314083`*^9}, {3.6708793296499*^9,
3.67087933263596*^9}, {3.6708794153321238`*^9, 3.670879435865038*^9}, {
3.6708795025388794`*^9, 3.670879507631482*^9}, {3.6708796889940352`*^9,
3.670879708345425*^9}, {3.6708798255504026`*^9, 3.670879835300599*^9}, {
3.6708799044440145`*^9, 3.670879935966669*^9}, {3.6708800150652866`*^9,
3.670880039832792*^9}, {3.67088009702295*^9, 3.6708801002430167`*^9}, {
3.670880501843223*^9, 3.670880635523944*^9}, {3.6708806829029083`*^9,
3.670880752052318*^9}, {3.6708812901844764`*^9, 3.6708813069979296`*^9}, {
3.6708814302541156`*^9, 3.6708814816301613`*^9}, {3.670881607534522*^9,
3.6708816165077047`*^9}, {3.6708816502259493`*^9, 3.670881652523402*^9}, {
3.6708817172438774`*^9, 3.6708817959016266`*^9}, {3.6708821476277246`*^9,
3.670882152578577*^9}, {3.6708822529215803`*^9, 3.670882257489444*^9}, {
3.6708823372820606`*^9, 3.6708823455178146`*^9}, {3.670882937923769*^9,
3.6708829450918436`*^9}, {3.6708831033784885`*^9, 3.670883114452605*^9}, {
3.670883181334307*^9, 3.6708831829743233`*^9}, {3.670883224540761*^9,
3.6708832252987714`*^9}, {3.670884865515378*^9, 3.6708848788448753`*^9}, {
3.670884917209343*^9, 3.670884984592389*^9}, {3.670885055846111*^9,
3.6708850591301394`*^9}, {3.6708851176127677`*^9,
3.6708851193424044`*^9}, {3.67113593309385*^9, 3.6711359413783503`*^9}, {
3.67113601990135*^9, 3.67113609282635*^9}, {3.67113619156635*^9,
3.6711361920773497`*^9}, {3.67113623474535*^9, 3.67113626434035*^9}, {
3.67113654485385*^9, 3.6711365694738503`*^9}, {3.67113690042985*^9,
3.67113691540235*^9}, {3.6711370675921893`*^9, 3.671137074021472*^9},
3.6711389651969585`*^9, 3.671139130343959*^9, 3.6711392413949585`*^9, {
3.6711393473564587`*^9, 3.6711393643779583`*^9}, {3.6711396097714586`*^9,
3.6711396108564587`*^9}, {3.6711398702109585`*^9,
3.6711398728984585`*^9}, {3.6711408087409587`*^9,
3.6711408735459585`*^9}, {3.671140943109459*^9, 3.671140979387459*^9}, {
3.671141374182639*^9, 3.6711413771578484`*^9}, {3.6711414226245346`*^9,
3.6711414750887117`*^9}, {3.6711417056090508`*^9,
3.6711417251981406`*^9}, {3.6711417797479143`*^9,
3.6711417824504957`*^9}, {3.6711418295798984`*^9, 3.671141858550769*^9},
3.671141982309085*^9, {3.6711420565605803`*^9, 3.6711420948263516`*^9}, {
3.6711421389484377`*^9, 3.6711421530758176`*^9}, {3.67114220210415*^9,
3.6711422818295317`*^9}, {3.6711423390170927`*^9, 3.671142340257217*^9}, {
3.671142420227969*^9, 3.6711424314705796`*^9}, {3.6711427546607327`*^9,
3.671142785764284*^9}, {3.671469969597288*^9, 3.671469986138234*^9}, {
3.671470063839117*^9, 3.671470117207165*^9}, {3.67147027476044*^9,
3.6714703125035195`*^9}, {3.671470381227075*^9, 3.671470435235405*^9}, {
3.671470709409917*^9, 3.6714707232751293`*^9}, {3.671470755738629*^9,
3.671470769946347*^9}, {3.671470863386237*^9, 3.6714708743664055`*^9},
3.6714709582688637`*^9, {3.671471056621549*^9, 3.67147110095723*^9}, {
3.671471519113989*^9, 3.67147157975492*^9}, {3.6714721088688927`*^9,
3.6714721424194083`*^9}, {3.6714723970333385`*^9,
3.6714723998990016`*^9}, {3.671472464121669*^9, 3.671472466314293*^9}, {
3.671472712764287*^9, 3.6714727389087734`*^9}, {3.6714730485680885`*^9,
3.671473067145874*^9}, {3.6714737256554594`*^9, 3.6714737424432173`*^9}, {
3.6714739634463873`*^9, 3.6714739643589015`*^9}, {3.6714740091066504`*^9,
3.671474012394201*^9}, {3.6714740894786634`*^9, 3.671474096298768*^9}, {
3.671474190053355*^9, 3.6714741910258703`*^9}, {3.6714742396709347`*^9,
3.671474257321205*^9}, {3.671474547684614*^9, 3.671474552839693*^9}, {
3.671495300665107*^9, 3.6714953018941774`*^9}, {3.671532410380936*^9,
3.671532412918141*^9}, {3.6715327143757257`*^9, 3.6715327264073906`*^9}, {
3.671534280955527*^9, 3.6715343125662923`*^9}, {3.6715348411489115`*^9,
3.671534842032962*^9}, {3.6715353439956617`*^9, 3.671535344808708*^9}, {
3.6715354495026965`*^9, 3.6715354504837523`*^9}, {3.6715355144964123`*^9,
3.6715355205887604`*^9}, {3.67153557176464*^9, 3.6715355995822287`*^9}, {
3.6715356865321846`*^9, 3.6715356888013144`*^9}, {3.6715380894596186`*^9,
3.671538091633023*^9}, {3.671538121874077*^9, 3.671538156593039*^9}, {
3.671538212667715*^9, 3.6715382156118803`*^9}, {3.6715383070409603`*^9,
3.6715383071501603`*^9}, 3.6715383875468655`*^9, {3.671538620030691*^9,
3.671538622089895*^9}, {3.671538697448866*^9, 3.6715387034392767`*^9}, {
3.6715387789550905`*^9, 3.671538780951894*^9}, {3.6715390575581226`*^9,
3.6715390627111316`*^9}, {3.6715393041435623`*^9, 3.671539304752597*^9}, {
3.671539335160709*^9, 3.67153934116492*^9}, {3.6715399134831047`*^9,
3.6715399220953197`*^9}, {3.6715400587818947`*^9,
3.6715400611080275`*^9}, {3.6715406525597773`*^9,
3.6715406613172765`*^9}, {3.671540769928338*^9, 3.6715407751115475`*^9}, {
3.671541233790223*^9, 3.6715412360343504`*^9}, {3.67163000492579*^9,
3.671630007626595*^9}, {3.6717064838252563`*^9, 3.6717064917276707`*^9}, {
3.6717066625778813`*^9, 3.6717066632798824`*^9}, {3.6717456715138917`*^9,
3.671745682025456*^9}, {3.6717496829687433`*^9, 3.6717496939023676`*^9}, {
3.671793397057126*^9, 3.6717933993362556`*^9}, {3.671794485061555*^9,
3.6717944877507086`*^9}, {3.6717956198683753`*^9,
3.6717956554534006`*^9}, {3.671795788871785*^9, 3.6717958045251694`*^9}, {
3.6717959413773994`*^9, 3.671795951468971*^9}, {3.6717960787616606`*^9,
3.671796082214267*^9}, {3.6717961378783193`*^9, 3.6717961506065564`*^9}, {
3.671798132523776*^9, 3.6717981591832514`*^9}, {3.6717981963863316`*^9,
3.6717982426624537`*^9}, {3.671798587798154*^9, 3.671798618160373*^9}, {
3.6717986525802903`*^9, 3.671798695435657*^9}, {3.6717987925900917`*^9,
3.671798863785584*^9}, {3.6717989470327578`*^9, 3.6717989479388075`*^9}, {
3.67179899495043*^9, 3.671798995214445*^9}, {3.6717991029980016`*^9,
3.671799118040843*^9}, {3.6718978000486317`*^9, 3.6718978034428225`*^9}, {
3.6719580574529624`*^9, 3.6719580937940207`*^9}, 3.6719583638723183`*^9, {
3.6719584238146286`*^9, 3.6719584342241983`*^9}, {3.671959929021289*^9,
3.6719599332970123`*^9}, {3.6719747388794103`*^9,
3.6719747588145504`*^9}, {3.6719779161826916`*^9, 3.671977965394492*^9}, {
3.6878717732965364`*^9, 3.6878717781711893`*^9}, {3.687874830412199*^9,
3.6878748443627768`*^9}, {3.687875039613661*^9, 3.6878750425516014`*^9},
3.6878833594179387`*^9, {3.6878834049102163`*^9, 3.687883408657976*^9}, {
3.6981410001982393`*^9, 3.6981410122623754`*^9}}],
Cell[BoxData[
RowBox[{
StyleBox[
RowBox[{"CreateScheduledTask", "::", "timt"}], "MessageName"],
RowBox[{
":", " "}], "\<\"Number of seconds \[NoBreak]\\!\\(1\\/perSecond\\)\
\[NoBreak] is not a positive number. \
\\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", ButtonStyle->\\\"Link\\\", \
ButtonFrame->None, ButtonData:>\\\"paclet:ref/CreateScheduledTask\\\", \
ButtonNote -> \\\"CreateScheduledTask::timt\\\"]\\)\"\>"}]], "Message", "MSG",
CellChangeTimes->{3.6981414611158047`*^9, 3.6981646053863034`*^9}]
}, Open ]]
}, Closed]],
Cell[CellGroupData[{
Cell["turnOffFrightened", "Subsubsection",
CellChangeTimes->{{3.670714174891605*^9, 3.670714177942727*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{"turnOffFrightened", "=",
RowBox[{"CreateScheduledTask", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"isFrightened", "=",
RowBox[{"Table", "[",