-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript.js
More file actions
809 lines (777 loc) · 42.9 KB
/
script.js
File metadata and controls
809 lines (777 loc) · 42.9 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
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
const select = document.getElementById('sort-by'); // the sort-by select element
const searchAlgorithmBtn = document.getElementById('search-algorithm'); // the search algorithm select element
const pElementSearchAlgorithm = document.getElementById('search-algorithm-p'); // the text above the search algorithm select element
const previousBtn = document.getElementById('previousBtn');
const nextBtn = document.getElementById('nextBtn');
const gameSectionInfo = document.querySelector('.game-section-info'); // the text showing up above all the games
const numOfNodesDiv = document.getElementById('number-of-nodes'); // this is the div container that has the text for the number of nodes visited
const numOfNodesText = document.getElementById('nodes-visited'); // text for the number of nodes visited
previousBtn.style.display = 'none'; // initially don't show previous and next btn
nextBtn.style.display = 'none';
numOfNodesDiv.style.display = 'none'; // initially don't display the text for the num of nodes visited
/* === Event Listener for when a user selects a sort-by element, then the selection for choosing a search algorithm goes away === */
select.addEventListener('change', function() {
if (this.value != '0') {
searchAlgorithmBtn.style.display = 'none';
pElementSearchAlgorithm.style.display = 'none';
}
else {
searchAlgorithmBtn.style.display = 'block';
pElementSearchAlgorithm.style.display = 'block';
}
});
let salesTree = new window.AVL(window.globalSalesComparison) // AVL tree sorted by global sales
let criticTree = new window.AVL(window.criticScoreComparison) // AVL tree sorted by critic score
let userTree = new window.AVL(window.userScoreComparison) // AVL tree sorted by user score
/* === Fetching data from data.json and creating the three different AVL trees === */
const listOfAvlTrees = [salesTree, criticTree, userTree];
fetch('data.json')
.then(response => {
if(!response.ok){
throw new Error("Issue creating avl trees in front end")
}
return response.json();
})
.then(data => {
for(let i = 0; i < data.length; i++){
salesTree.root = salesTree.insertNode(salesTree.root,data[i])
criticTree.root = criticTree.insertNode(criticTree.root,data[i])
userTree.root = userTree.insertNode(userTree.root,data[i])
}
})
/* === Setting up the tagify for the publisher filter, with including the selections the user can make in whitelist === */
var input1 = document.querySelector('input[name=tagify-publisher]');
var publisherTagify = new Tagify(input1, {
whitelist: [
{ value: "Nintendo", full: "Nintendo" },
{ value: "Microsoft Game Studios", full: "Microsoft Game Studios" },
{ value: "Take-Two Interactive", full: "Take-Two Interactive" },
{ value: "Sony Computer Entertainment", full: "Sony Computer Entertainment" },
{ value: "Activision", full: "Activision" },
{ value: "Ubisoft", full: "Ubisoft" },
{ value: "Bethesda Softworks", full: "Bethesda Softworks" },
{ value: "Electronic Arts", full: "Electronic Arts" },
{ value: "Sega", full: "Sega" },
{ value: "SquareSoft", full: "SquareSoft" },
{ value: "Atari", full: "Atari" },
{ value: "505 Games", full: "505 Games" },
{ value: "Capcom", full: "Capcom" },
{ value: "GT Interactive", full: "GT Interactive" },
{ value: "Konami Digital Entertainment", full: "Konami Digital Entertainment" },
{ value: "Square Enix", full: "Square Enix" },
{ value: "Sony Computer Entertainment Europe", full: "Sony Computer Entertainment Europe" },
{ value: "Virgin Interactive", full: "Virgin Interactive" },
{ value: "LucasArts", full: "LucasArts" },
{ value: "Warner Bros. Interactive Entertainment", full: "Warner Bros. Interactive Entertainment" },
{ value: "Universal Interactive", full: "Universal Interactive" },
{ value: "Eidos Interactive", full: "Eidos Interactive" },
{ value: "RedOctane", full: "RedOctane" },
{ value: "Vivendi Games", full: "Vivendi Games" },
{ value: "Enix Corporation", full: "Enix Corporation" },
{ value: "Namco Bandai Games", full: "Namco Bandai Games" },
{ value: "Palcom", full: "Palcom" },
{ value: "Hasbro Interactive", full: "Hasbro Interactive" },
{ value: "THQ", full: "THQ" },
{ value: "Fox Interactive", full: "Fox Interactive" },
{ value: "Acclaim Entertainment", full: "Acclaim Entertainment" },
{ value: "MTV Games", full: "MTV Games" },
{ value: "Disney Interactive Studios", full: "Disney Interactive Studios" },
{ value: "N/A", full: "N/A" },
{ value: "Codemasters", full: "Codemasters" },
{ value: "Majesco Entertainment", full: "Majesco Entertainment" },
{ value: "Red Orb", full: "Red Orb" },
{ value: "Level 5", full: "Level 5" },
{ value: "Arena Entertainment", full: "Arena Entertainment" },
{ value: "Midway Games", full: "Midway Games" },
{ value: "JVC", full: "JVC" },
{ value: "Deep Silver", full: "Deep Silver" },
{ value: "NCSoft", full: "NCSoft" },
{ value: "989 Studios", full: "989 Studios" },
{ value: "UEP Systems", full: "UEP Systems" },
{ value: "Parker Bros.", full: "Parker Bros." },
{ value: "Maxis", full: "Maxis" },
{ value: "Imagic", full: "Imagic" },
{ value: "Tecmo Koei", full: "Tecmo Koei" },
{ value: "ASCII Entertainment", full: "ASCII Entertainment" },
{ value: "Valve Software", full: "Valve Software" },
{ value: "Mindscape", full: "Mindscape" },
{ value: "Infogrames", full: "Infogrames" },
{ value: "Unknown", full: "Unknown" },
{ value: "Square", full: "Square" },
{ value: "Valve", full: "Valve" },
{ value: "Banpresto", full: "Banpresto" },
{ value: "Hello Games", full: "Hello Games" },
{ value: "D3Publisher", full: "D3Publisher" },
{ value: "Activision Value", full: "Activision Value" },
{ value: "Oxygen Interactive", full: "Oxygen Interactive" },
{ value: "Red Storm Entertainment", full: "Red Storm Entertainment" },
{ value: "Video System", full: "Video System" },
{ value: "Global Star", full: "Global Star" },
{ value: "Gotham Games", full: "Gotham Games" },
{ value: "Westwood Studios", full: "Westwood Studios" },
{ value: "GungHo", full: "GungHo" },
{ value: "Crave Entertainment", full: "Crave Entertainment" },
{ value: "Hudson Soft", full: "Hudson Soft" },
{ value: "Coleco", full: "Coleco" },
{ value: "Rising Star Games", full: "Rising Star Games" },
{ value: "TDK Mediactive", full: "TDK Mediactive" },
{ value: "ASC Games", full: "ASC Games" },
{ value: "Accolade", full: "Accolade" },
{ value: "Zoo Games", full: "Zoo Games" },
{ value: "Sony Online Entertainment", full: "Sony Online Entertainment" },
{ value: "3DO", full: "3DO" },
{ value: "Natsume", full: "Natsume" },
{ value: "RTL", full: "RTL" },
{ value: "Alchemist", full: "Alchemist" },
{ value: "Black Label Games", full: "Black Label Games" },
{ value: "SouthPeak Games", full: "SouthPeak Games" },
{ value: "Focus Home Interactive", full: "Focus Home Interactive" },
{ value: "Ocean", full: "Ocean" },
{ value: "Zoo Digital Publishing", full: "Zoo Digital Publishing" },
{ value: "Psygnosis", full: "Psygnosis" },
{ value: "City Interactive", full: "City Interactive" },
{ value: "Empire Interactive", full: "Empire Interactive" },
{ value: "Success", full: "Success" },
{ value: "Compile", full: "Compile" },
{ value: "Russel", full: "Russel" },
{ value: "Atlus", full: "Atlus" },
{ value: "Mastertronic", full: "Mastertronic" },
{ value: "Slightly Mad Studios", full: "Slightly Mad Studios" },
{ value: "Taito", full: "Taito" },
{ value: "Agetec", full: "Agetec" },
{ value: "Microprose", full: "Microprose" },
{ value: "Play It", full: "Play It" },
{ value: "GSP", full: "GSP" },
{ value: "Tomy Corporation", full: "Tomy Corporation" },
{ value: "Sammy Corporation", full: "Sammy Corporation" },
{ value: "Koch Media", full: "Koch Media" },
{ value: "Game Factory", full: "Game Factory" },
{ value: "Titus", full: "Titus" },
{ value: "Marvelous Entertainment", full: "Marvelous Entertainment" },
{ value: "Genki", full: "Genki" },
{ value: "Mojang", full: "Mojang" },
{ value: "CTO SpA", full: "CTO SpA" },
{ value: "TalonSoft", full: "TalonSoft" },
{ value: "Crystal Dynamics", full: "Crystal Dynamics" },
{ value: "Square Enix", full: "Square Enix" },
{ value: "mixi, Inc", full: "mixi, Inc" },
{ value: "Pinnacle", full: "Pinnacle" },
{ value: "SCi", full: "SCi" },
{ value: "Quelle", full: "Quelle" },
{ value: "Rage Software", full: "Rage Software" },
{ value: "Ubisoft Annecy", full: "Ubisoft Annecy" },
{ value: "Interplay", full: "Interplay" },
{ value: "Scholastic Inc.", full: "Scholastic Inc." },
{ value: "Mystique", full: "Mystique" },
{ value: "ChunSoft", full: "ChunSoft" },
{ value: "Square EA", full: "Square EA" },
{ value: "20th Century Fox Video Games", full: "20th Century Fox Video Games" },
{ value: "Hudson Entertainment", full: "Hudson Entertainment" },
{ value: "Men-A-Vision", full: "Men-A-Vision" },
{ value: "Nobilis", full: "Nobilis" },
{ value: "Avanquest Software", full: "Avanquest Software" },
{ value: "Big Ben Interactive", full: "Big Ben Interactive" },
{ value: "Nordic Games", full: "Nordic Games" },
{ value: "Touchstone", full: "Touchstone" },
{ value: "Spike", full: "Spike" },
{ value: "Nippon Ichi Software", full: "Nippon Ichi Software" },
{ value: "Sony Computer Entertainment America", full: "Sony Computer Entertainment America" },
{ value: "Jester Interactive", full: "Jester Interactive" },
{ value: "LEGO Media", full: "LEGO Media" },
{ value: "Quest", full: "Quest" },
{ value: "Illusion Softworks", full: "Illusion Softworks" },
{ value: "Tigervision", full: "Tigervision" },
{ value: "Rocket Company", full: "Rocket Company" },
{ value: "Metro 3D", full: "Metro 3D" },
{ value: "Mattel Interactive", full: "Mattel Interactive" },
{ value: "IE Institute", full: "IE Institute" },
{ value: "Funbox Media", full: "Funbox Media" },
{ value: "Rondomedia", full: "Rondomedia" },
{ value: "Universal Gamex", full: "Universal Gamex" },
{ value: "Ghostlight", full: "Ghostlight" },
{ value: "Wizard Video Games", full: "Wizard Video Games" },
{ value: "BMG Interactive Entertainment", full: "BMG Interactive Entertainment" },
{ value: "PQube", full: "PQube" },
{ value: "Trion Worlds", full: "Trion Worlds" },
{ value: "Xseed Games", full: "Xseed Games" },
{ value: "Laguna", full: "Laguna" },
{ value: "Takara", full: "Takara" },
{ value: "Ignition Entertainment", full: "Ignition Entertainment" },
{ value: "Kadokawa Shoten", full: "Kadokawa Shoten" },
{ value: "Enterbrain", full: "Enterbrain" },
{ value: "Imagineer", full: "Imagineer" },
{ value: "CPG Products", full: "CPG Products" },
{ value: "System 3 Arcade Software", full: "System 3 Arcade Software" },
{ value: "Aruze Corp", full: "Aruze Corp" },
{ value: "Destineer", full: "Destineer" },
{ value: "Gamebridge", full: "Gamebridge" },
{ value: "Midas Interactive Entertainment", full: "Midas Interactive Entertainment" },
{ value: "Jaleco", full: "Jaleco" },
{ value: "Answer Software", full: "Answer Software" },
{ value: "Pack In Soft", full: "Pack In Soft" },
{ value: "XS Games", full: "XS Games" },
{ value: "Rebellion", full: "Rebellion" },
{ value: "Ultravision", full: "Ultravision" },
{ value: "Harmonix Music Systems", full: "Harmonix Music Systems" },
{ value: "Activision Blizzard", full: "Activision Blizzard" },
{ value: "Xplosiv", full: "Xplosiv" },
{ value: "Wanadoo", full: "Wanadoo" },
{ value: "Telltale Games", full: "Telltale Games" },
{ value: "NovaLogic", full: "NovaLogic" },
{ value: "Epoch", full: "Epoch" },
{ value: "BAM! Entertainment", full: "BAM! Entertainment" },
{ value: "GameMill Entertainment", full: "GameMill Entertainment" },
{ value: "Knowledge Adventure", full: "Knowledge Adventure" },
{ value: "Tetris Online", full: "Tetris Online" },
{ value: "Mastiff", full: "Mastiff" },
{ value: "ESP", full: "ESP" },
{ value: "TYO", full: "TYO" },
{ value: "Telegames", full: "Telegames" },
{ value: "Mud Duck Productions", full: "Mud Duck Productions" },
{ value: "Screenlife", full: "Screenlife" },
{ value: "Pioneer LDC", full: "Pioneer LDC" },
{ value: "Magical Company", full: "Magical Company" },
{ value: "Kemco", full: "Kemco" },
{ value: "Mentor Interactive", full: "Mentor Interactive" },
{ value: "Human Entertainment", full: "Human Entertainment" },
{ value: "Data Age", full: "Data Age" },
{ value: "Electronic Arts Victor", full: "Electronic Arts Victor" },
{ value: "Jack of All Games", full: "Jack of All Games" },
{ value: "Avanquest", full: "Avanquest" },
{ value: "Black Bean Games", full: "Black Bean Games" },
{ value: "989 Sports", full: "989 Sports" },
{ value: "Takara Tomy", full: "Takara Tomy" },
{ value: "Media Rings", full: "Media Rings" },
{ value: "Elf", full: "Elf" },
{ value: "Starfish", full: "Starfish" },
{ value: "Zushi Games", full: "Zushi Games" },
{ value: "Jorudan", full: "Jorudan" },
{ value: "Destination Software, Inc", full: "Destination Software, Inc" },
{ value: "New", full: "New" },
{ value: "Brash Entertainment", full: "Brash Entertainment" },
{ value: "Kalypso Media", full: "Kalypso Media" },
{ value: "ITT Family Games", full: "ITT Family Games" },
{ value: "Ackkstudios", full: "Ackkstudios" },
{ value: "PopCap Games", full: "PopCap Games" },
{ value: "Starpath Corp.", full: "Starpath Corp." },
{ value: "BPS", full: "BPS" },
{ value: "Gathering of Developers", full: "Gathering of Developers" },
{ value: "NewKidCo", full: "NewKidCo" },
{ value: "Marvelous Interactive", full: "Marvelous Interactive" },
{ value: "Storm City Games", full: "Storm City Games" },
{ value: "CokeM Interactive", full: "CokeM Interactive" },
{ value: "P2 Games", full: "P2 Games" },
{ value: "CBS Electronics", full: "CBS Electronics" },
{ value: "Home Entertainment Suppliers", full: "Home Entertainment Suppliers" },
{ value: "Magix", full: "Magix" },
{ value: "Arc System Works", full: "Arc System Works" },
{ value: "Angel Studios", full: "Angel Studios" },
{ value: "Wargaming.net", full: "Wargaming.net" },
{ value: "Playmates", full: "Playmates" },
{ value: "SNK Playmore", full: "SNK Playmore" },
{ value: "Hamster Corporation", full: "Hamster Corporation" },
{ value: "From Software", full: "From Software" },
{ value: "Nippon Columbia", full: "Nippon Columbia" },
{ value: "Nichibutsu", full: "Nichibutsu" },
{ value: "Conspiracy Entertainment", full: "Conspiracy Entertainment" },
{ value: "Hect", full: "Hect" },
{ value: "Mumbo Jumbo", full: "Mumbo Jumbo" },
{ value: "DTP Entertainment", full: "DTP Entertainment" },
{ value: "Pacific Century Cyber Works", full: "Pacific Century Cyber Works" },
{ value: "Indie Games", full: "Indie Games" },
{ value: "Liquid Games", full: "Liquid Games" },
{ value: "NEC", full: "NEC" },
{ value: "Axela", full: "Axela" },
{ value: "ArtDink", full: "ArtDink" },
{ value: "Sunsoft", full: "Sunsoft" },
{ value: "Little Orbit", full: "Little Orbit" },
{ value: "FuRyu", full: "FuRyu" },
{ value: "Gust", full: "Gust" },
{ value: "SNK", full: "SNK" },
{ value: "NEC Interchannel", full: "NEC Interchannel" },
{ value: "Nihon Falcom Corporation", full: "Nihon Falcom Corporation" },
{ value: "Xing Entertainment", full: "Xing Entertainment" },
{ value: "ValuSoft", full: "ValuSoft" },
{ value: "Victor Interactive", full: "Victor Interactive" },
{ value: "American Softworks", full: "American Softworks" },
{ value: "Falcom Corporation", full: "Falcom Corporation" },
{ value: "Detn8 Games", full: "Detn8 Games" },
{ value: "Bomb", full: "Bomb" },
{ value: "Nordcurrent", full: "Nordcurrent" },
{ value: "Milestone S.r.l.", full: "Milestone S.r.l." },
{ value: "AQ Interactive", full: "AQ Interactive" },
{ value: "Sears", full: "Sears" },
{ value: "Seta Corporation", full: "Seta Corporation" },
{ value: "On Demand", full: "On Demand" },
{ value: "CCP", full: "CCP" },
{ value: "NCS", full: "NCS" },
{ value: "Rebellion Developments", full: "Rebellion Developments" },
{ value: "Agatsuma Entertainment", full: "Agatsuma Entertainment" },
{ value: "Gremlin Interactive Ltd", full: "Gremlin Interactive Ltd" },
{ value: "Aspyr", full: "Aspyr" },
{ value: "Compile Heart", full: "Compile Heart" },
{ value: "Culture Brain", full: "Culture Brain" },
{ value: "Mad Catz", full: "Mad Catz" },
{ value: "Shogakukan", full: "Shogakukan" },
{ value: "Merscom LLC", full: "Merscom LLC" },
{ value: "JoWood Productions", full: "JoWood Productions" },
{ value: "Nippon Telenet", full: "Nippon Telenet" },
{ value: "TDK Core", full: "TDK Core" },
{ value: "Kadokawa Games", full: "Kadokawa Games" },
{ value: "SSI", full: "SSI" },
{ value: "Foreign Media Games", full: "Foreign Media Games" },
{ value: "Core Design Ltd.", full: "Core Design Ltd." },
{ value: "bitComposer Games", full: "bitComposer Games" },
{ value: "Astragon", full: "Astragon" },
{ value: "Asylum Entertainment", full: "Asylum Entertainment" },
{ value: "Performance Designed Products", full: "Performance Designed Products" },
{ value: "UFO Interactive", full: "UFO Interactive" },
{ value: "Essential Games", full: "Essential Games" },
{ value: "Adeline Software", full: "Adeline Software" },
{ value: "Funcom", full: "Funcom" },
{ value: "PlayV", full: "PlayV" },
{ value: "Panther Software", full: "Panther Software" },
{ value: "Blast! Entertainment Ltd", full: "Blast! Entertainment Ltd" },
{ value: "Playlogic Game Factory", full: "Playlogic Game Factory" },
{ value: "DSI Games", full: "DSI Games" },
{ value: "Avalon Interactive", full: "Avalon Interactive" },
{ value: "Game Life", full: "Game Life" },
{ value: "Popcorn Arcade", full: "Popcorn Arcade" },
{ value: "Aques", full: "Aques" },
{ value: "System 3", full: "System 3" },
{ value: "Syscom", full: "Syscom" },
{ value: "Vir2L Studios", full: "Vir2L Studios" },
{ value: "Vatical Entertainment", full: "Vatical Entertainment" },
{ value: "Neko Entertainment", full: "Neko Entertainment" },
{ value: "White Park Bay Software", full: "White Park Bay Software" },
{ value: "Vic Tokai", full: "Vic Tokai" },
{ value: "Media Factory", full: "Media Factory" },
{ value: "Daedalic", full: "Daedalic" },
{ value: "Game Arts", full: "Game Arts" },
{ value: "The Adventure Company", full: "The Adventure Company" },
{ value: "EA Games", full: "EA Games" },
{ value: "Acquire", full: "Acquire" },
{ value: "Broccoli", full: "Broccoli" },
{ value: "General Entertainment", full: "General Entertainment" },
{ value: "Paradox Interactive", full: "Paradox Interactive" },
{ value: "Yacht Club Games", full: "Yacht Club Games" },
{ value: "Imadio", full: "Imadio" },
{ value: "Swing! Entertainment", full: "Swing! Entertainment" },
{ value: "Sony Music Entertainment", full: "Sony Music Entertainment" },
{ value: "Aqua Plus", full: "Aqua Plus" },
{ value: "Excalibur Publishing", full: "Excalibur Publishing" },
{ value: "Hip Interactive", full: "Hip Interactive" },
{ value: "Tripwire Interactive", full: "Tripwire Interactive" },
{ value: "DreamCatcher Interactive", full: "DreamCatcher Interactive" },
{ value: "SCS Software", full: "SCS Software" },
{ value: "Havas Interactive", full: "Havas Interactive" },
{ value: "Sting", full: "Sting" },
{ value: "Idea Factory", full: "Idea Factory" },
{ value: "Telstar", full: "Telstar" },
{ value: "U.S. Gold", full: "U.S. Gold" },
{ value: "Funsta", full: "Funsta" },
{ value: "DreamWorks Interactive", full: "DreamWorks Interactive" },
{ value: "Slitherine Software", full: "Slitherine Software" },
{ value: "MTO", full: "MTO" },
{ value: "Graffiti", full: "Graffiti" },
{ value: "Tru Blu Entertainment", full: "Tru Blu Entertainment" },
{ value: "DHM Interactive", full: "DHM Interactive" },
{ value: "Crytek", full: "Crytek" },
{ value: "FunSoft", full: "FunSoft" },
{ value: "Data Design Interactive", full: "Data Design Interactive" },
{ value: "SPS", full: "SPS" },
{ value: "Moss", full: "Moss" },
{ value: "T&E Soft", full: "T&E Soft" },
{ value: "NDA Productions", full: "NDA Productions" },
{ value: "Bigben Interactive", full: "Bigben Interactive" },
{ value: "Data East", full: "Data East" },
{ value: "Idea Factory International", full: "Idea Factory International" },
{ value: "Time Warner Interactive", full: "Time Warner Interactive" },
{ value: "Gainax Network Systems", full: "Gainax Network Systems" },
{ value: "Daito", full: "Daito" },
{ value: "O3 Entertainment", full: "O3 Entertainment" },
{ value: "O-Games", full: "O-Games" },
{ value: "Gameloft", full: "Gameloft" },
{ value: "Xicat Interactive", full: "Xicat Interactive" },
{ value: "Simon & Schuster Interactive", full: "Simon & Schuster Interactive" },
{ value: "Valcon Games", full: "Valcon Games" },
{ value: "PopTop Software", full: "PopTop Software" },
{ value: "TOHO", full: "TOHO" },
{ value: "PM Studios", full: "PM Studios" },
{ value: "Bohemia Interactive", full: "Bohemia Interactive" },
{ value: "Reef Entertainment", full: "Reef Entertainment" },
{ value: "5pb", full: "5pb" },
{ value: "HMH Interactive", full: "HMH Interactive" },
{ value: "inXile Entertainment", full: "inXile Entertainment" },
{ value: "Cave", full: "Cave" },
{ value: "Microids", full: "Microids" },
{ value: "Paon", full: "Paon" },
{ value: "CDV Software Entertainment", full: "CDV Software Entertainment" },
{ value: "Micro Cabin", full: "Micro Cabin" },
{ value: "GameTek", full: "GameTek" },
{ value: "Benesse", full: "Benesse" },
{ value: "Type-Moon", full: "Type-Moon" },
{ value: "Enjoy Gaming ltd.", full: "Enjoy Gaming ltd." },
{ value: "Asmik Corp", full: "Asmik Corp" },
{ value: "Interplay Productions", full: "Interplay Productions" },
{ value: "Asmik Ace Entertainment", full: "Asmik Ace Entertainment" },
{ value: "Image Epoch", full: "Image Epoch" },
{ value: "Phantom EFX", full: "Phantom EFX" },
{ value: "Evolved Games", full: "Evolved Games" },
{ value: "responDESIGN", full: "responDESIGN" },
{ value: "Griffin International", full: "Griffin International" },
{ value: "Culture Publishers", full: "Culture Publishers" },
{ value: "Hackberry", full: "Hackberry" },
{ value: "Hearty Robin", full: "Hearty Robin" },
{ value: "Nippon Amuse", full: "Nippon Amuse" },
{ value: "Origin Systems", full: "Origin Systems" },
{ value: "Seventh Chord", full: "Seventh Chord" },
{ value: "Abylight", full: "Abylight" },
{ value: "Mitsui", full: "Mitsui" },
{ value: "Insomniac Games", full: "Insomniac Games" },
{ value: "Flight-Plan", full: "Flight-Plan" },
{ value: "Milestone", full: "Milestone" },
{ value: "Glams", full: "Glams" },
{ value: "Aksys Games", full: "Aksys Games" },
{ value: "Locus", full: "Locus" },
{ value: "Warp", full: "Warp" },
{ value: "Irem Software Engineering", full: "Irem Software Engineering" },
{ value: "Myelin Media", full: "Myelin Media" },
{ value: "Global A Entertainment", full: "Global A Entertainment" },
{ value: "Alternative Software", full: "Alternative Software" },
{ value: "Mercury Games", full: "Mercury Games" },
{ value: "Sunrise Interactive", full: "Sunrise Interactive" },
{ value: "Elite", full: "Elite" },
{ value: "Evolution Games", full: "Evolution Games" },
{ value: "Daedalic Entertainment", full: "Daedalic Entertainment" },
{ value: "Edia", full: "Edia" },
{ value: "Athena", full: "Athena" },
{ value: "Aria", full: "Aria" },
{ value: "Tivola", full: "Tivola" },
{ value: "Happinet", full: "Happinet" },
{ value: "Tommo", full: "Tommo" },
{ value: "Altron", full: "Altron" },
{ value: "Revolution Software", full: "Revolution Software" },
{ value: "Media Works", full: "Media Works" },
{ value: "Fortyfive", full: "Fortyfive" },
{ value: "Gamecock", full: "Gamecock" },
{ value: "Imax", full: "Imax" },
{ value: "10TACLE Studios", full: "10TACLE Studios" },
{ value: "Groove Games", full: "Groove Games" },
{ value: "Pack-In-Video", full: "Pack-In-Video" },
{ value: "Crimson Cow", full: "Crimson Cow" },
{ value: "iWin", full: "iWin" },
{ value: "Asgard", full: "Asgard" },
{ value: "Ecole", full: "Ecole" },
{ value: "Yumedia", full: "Yumedia" },
{ value: "Ascaron Entertainment GmbH", full: "Ascaron Entertainment GmbH" },
{ value: "HAL Laboratory", full: "HAL Laboratory" },
{ value: "Phenomedia", full: "Phenomedia" },
{ value: "Grand Prix Games", full: "Grand Prix Games" },
{ value: "DigiCube", full: "DigiCube" },
{ value: "Creative Core", full: "Creative Core" },
{ value: "Kaga Create", full: "Kaga Create" },
{ value: "WayForward Technologies", full: "WayForward Technologies" },
{ value: "LSP Games", full: "LSP Games" },
{ value: "ASCII Media Works", full: "ASCII Media Works" },
{ value: "1C Company", full: "1C Company" },
{ value: "Coconuts Japan", full: "Coconuts Japan" },
{ value: "Arika", full: "Arika" },
{ value: "Marvel Entertainment", full: "Marvel Entertainment" },
{ value: "Ertain", full: "Ertain" },
{ value: "Prototype", full: "Prototype" },
{ value: "Phantagram", full: "Phantagram" },
{ value: "The Learning Company", full: "The Learning Company" },
{ value: "TechnoSoft", full: "TechnoSoft" },
{ value: "MLB.com", full: "MLB.com" },
{ value: "Vap", full: "Vap" },
{ value: "Misawa", full: "Misawa" },
{ value: "Yeti", full: "Yeti" },
{ value: "Dusenberry Martin Racing", full: "Dusenberry Martin Racing" },
{ value: "Navarre Corp", full: "Navarre Corp" },
{ value: "Pow", full: "Pow" },
{ value: "MediaQuest", full: "MediaQuest" },
{ value: "Team17 Software", full: "Team17 Software" },
{ value: "Max Five", full: "Max Five" },
{ value: "Tradewest", full: "Tradewest" },
{ value: "Comfort", full: "Comfort" },
{ value: "Milestone S.r.l", full: "Milestone S.r.l" },
{ value: "Pony Canyon", full: "Pony Canyon" },
{ value: "Riverhillsoft", full: "Riverhillsoft" },
{ value: "Summitsoft", full: "Summitsoft" },
{ value: "Playmore", full: "Playmore" },
{ value: "Kool Kizz", full: "Kool Kizz" },
{ value: "Monte Christo Multimedia", full: "Monte Christo Multimedia" },
{ value: "TopWare Interactive", full: "TopWare Interactive" },
{ value: "Legacy Interactive", full: "Legacy Interactive" },
{ value: "Cloud Imperium Games Corporation", full: "Cloud Imperium Games Corporation" },
{ value: "Flashpoint Games", full: "Flashpoint Games" },
{ value: "CyberFront", full: "CyberFront" },
{ value: "Alawar Entertainment", full: "Alawar Entertainment" },
{ value: "Societa", full: "Societa" },
{ value: "Interchannel", full: "Interchannel" },
{ value: "Experience Inc.", full: "Experience Inc." },
{ value: "Sonnet", full: "Sonnet" },
{ value: "Virtual Play Games", full: "Virtual Play Games" },
{ value: "Zenrin", full: "Zenrin" },
{ value: "Iceberg Interactive", full: "Iceberg Interactive" },
{ value: "Ivolgamus", full: "Ivolgamus" },
{ value: "MC2 Entertainment", full: "MC2 Entertainment" },
{ value: "2D Boy", full: "2D Boy" },
{ value: "Games Workshop", full: "Games Workshop" },
{ value: "Kando Games", full: "Kando Games" },
{ value: "Office Create", full: "Office Create" },
{ value: "Maximum Family Games", full: "Maximum Family Games" },
{ value: "Fields", full: "Fields" },
{ value: "Gearbox Software", full: "Gearbox Software" },
{ value: "Princess Soft", full: "Princess Soft" },
{ value: "Extreme Entertainment Group", full: "Extreme Entertainment Group" },
{ value: "Big Fish Games", full: "Big Fish Games" },
{ value: "Berkeley", full: "Berkeley" },
{ value: "Mamba Games", full: "Mamba Games" },
{ value: "Fuji", full: "Fuji" },
{ value: "FuRyu Corporation", full: "FuRyu Corporation" },
{ value: "Her Interactive", full: "Her Interactive" },
{ value: "imageepoch Inc.", full: "imageepoch Inc." },
{ value: "Just Flight", full: "Just Flight" },
{ value: "Kamui", full: "Kamui" },
{ value: "ASK", full: "ASK" },
{ value: "Cygames", full: "Cygames" },
{ value: "Introversion Software", full: "Introversion Software" },
{ value: "49Games", full: "49Games" },
{ value: "KSS", full: "KSS" },
{ value: "dramatic create", full: "dramatic create" },
{ value: "TGL", full: "TGL" },
{ value: "KID", full: "KID" },
{ value: "Quinrose", full: "Quinrose" },
{ value: "Sold Out", full: "Sold Out" },
{ value: "Encore", full: "Encore" },
{ value: "G.Rev", full: "G.Rev" },
{ value: "Sunflowers", full: "Sunflowers" },
{ value: "Headup Games", full: "Headup Games" },
{ value: "Sweets", full: "Sweets" },
{ value: "Kokopeli Digital Studios", full: "Kokopeli Digital Studios" },
{ value: "id Software", full: "id Software" },
{ value: "Nexon", full: "Nexon" },
{ value: "BushiRoad", full: "BushiRoad" },
{ value: "Devolver Digital", full: "Devolver Digital" },
{ value: "Number None", full: "Number None" },
{ value: "Tryfirst", full: "Tryfirst" },
{ value: "GN Software", full: "GN Software" },
{ value: "Yuke's", full: "Yuke's" },
{ value: "Strategy First", full: "Strategy First" },
{ value: "Lexicon Entertainment", full: "Lexicon Entertainment" },
{ value: "Paon Corporation", full: "Paon Corporation" },
{ value: "Kids Station", full: "Kids Station" },
{ value: "Licensed 4U", full: "Licensed 4U" },
{ value: "GOA", full: "GOA" },
{ value: "7G//AMES", full: "7G//AMES" },
{ value: "King Records", full: "King Records" },
{ value: "Minato Station", full: "Minato Station" },
{ value: "Graphsim Entertainment", full: "Graphsim Entertainment" },
{ value: "Easy Interactive", full: "Easy Interactive" },
{ value: "Gaga", full: "Gaga" },
{ value: "Yamasa Entertainment", full: "Yamasa Entertainment" },
{ value: "Plenty", full: "Plenty" },
{ value: "Views", full: "Views" },
{ value: "Blue Byte", full: "Blue Byte" },
{ value: "fonfun", full: "fonfun" },
{ value: "NetRevo", full: "NetRevo" },
{ value: "Epic Games", full: "Epic Games" },
{ value: "Quintet", full: "Quintet" },
{ value: "Focus Multimedia", full: "Focus Multimedia" },
{ value: "Phoenix Games", full: "Phoenix Games" },
{ value: "Marvelous Games", full: "Marvelous Games" },
{ value: "Dorart", full: "Dorart" },
{ value: "Codemasters Online", full: "Codemasters Online" },
{ value: "Stainless Games", full: "Stainless Games" },
{ value: "Aerosoft", full: "Aerosoft" },
{ value: "Imageworks", full: "Imageworks" },
{ value: "Karin Entertainment", full: "Karin Entertainment" },
{ value: "Technos Japan Corporation", full: "Technos Japan Corporation" },
{ value: "Masque Publishing", full: "Masque Publishing" },
{ value: "Gakken", full: "Gakken" },
{ value: "New World Computing", full: "New World Computing" },
{ value: "Mirai Shounen", full: "Mirai Shounen" },
{ value: "Datam Polystar", full: "Datam Polystar" },
{ value: "HuneX", full: "HuneX" },
{ value: "Visco", full: "Visco" },
{ value: "Saurus", full: "Saurus" },
{ value: "Revolution (Japan)", full: "Revolution (Japan)" },
{ value: "Giza10", full: "Giza10" },
{ value: "Alvion", full: "Alvion" },
{ value: "Giga", full: "Giga" },
{ value: "Mycom", full: "Mycom" },
{ value: "Warashi", full: "Warashi" },
{ value: "System Soft", full: "System Soft" },
{ value: "RED Entertainment", full: "RED Entertainment" },
{ value: "Lighthouse Interactive", full: "Lighthouse Interactive" },
{ value: "Michaelsoft", full: "Michaelsoft" },
{ value: "Media Entertainment", full: "Media Entertainment" },
{ value: "Genterprise", full: "Genterprise" },
{ value: "Interworks Unlimited, Inc.", full: "Interworks Unlimited, Inc." },
{ value: "Inti Creates", full: "Inti Creates" },
{ value: "Boost On", full: "Boost On" },
{ value: "EON Digital Entertainment", full: "EON Digital Entertainment" },
{ value: "Nitroplus", full: "Nitroplus" },
{ value: "Naxat Soft", full: "Naxat Soft" },
{ value: "Piacci", full: "Piacci" },
{ value: "Paradox Development", full: "Paradox Development" },
{ value: "Otomate", full: "Otomate" },
{ value: "Ascaron Entertainment", full: "Ascaron Entertainment" },
{ value: "Ongakukan", full: "Ongakukan" },
{ value: "Commseed", full: "Commseed" },
{ value: "UIG Entertainment", full: "UIG Entertainment" },
{ value: "Takuyo", full: "Takuyo" },
{ value: "Interchannel-Holon", full: "Interchannel-Holon" },
{ value: "Red Flagship", full: "Red Flagship" }
],
enforceWhitelist: true,
dropdown: {
mapValueTo: 'full',
classname: 'tagify__dropdown--custom',
enabled: 0, // shows the suggestiosn dropdown once field is focused
RTL: false,
escapeHTML: false // allows HTML inside each suggestion item
}
})
let filteredGames = []; // Where filtered games will be stored
let currentPage = 0; // The current page the user is on
const gamesPerPage = 10; // Number of games to show per page
// Increases the page number by 1 and then loads the next 10 games with renderGamesPage()
nextBtn.addEventListener('click', () => {
if ((currentPage + 1) * gamesPerPage < filteredGames.length) {
currentPage++;
renderGamesPage();
}
});
// Decreases the page number by 1 and then loads the previous 10 games with renderGamesPage()
previousBtn.addEventListener('click', () => {
if (currentPage > 0) {
currentPage--;
renderGamesPage();
}
});
/*=== Renders the games on the current page based on the filteredGames array and currentPage variable. ===*/
function renderGamesPage() {
const gameContainer = document.getElementById('game-results');
gameContainer.innerHTML = ""; // Clear previous results
if (filteredGames.length === 0) {
gameContainer.innerHTML = "<p>No games found with the applied filters.</p>";
return;
}
const start = currentPage * gamesPerPage; // calculating when to start slicing in the filteredGames
const end = start + gamesPerPage; // calculating when to end slicing in the filteredGames
const gamesToDisplay = filteredGames.slice(start, end); // the 10 games for the current page
// Displaying each game from gamesToDisplay to the frontend
gamesToDisplay.forEach(game => {
const div = document.createElement('div');
div.classList.add('game-item');
div.innerHTML = `
<div class="game-name">
<h3>${game.Name}</h3>
</div>
<div class="game-details">
<div class="left-side">
<p><strong>Platform:</strong> ${game.Platform}</p>
<p><strong>Year:</strong> ${game.Year_of_Release}</p>
<p><strong>Genre:</strong> ${game.Genre}</p>
<p><strong>Publisher:</strong> ${game.Publisher}</p>
<p><strong>Developer:</strong> ${game.Developer}</p>
</div>
<div class="right-side">
<p><strong>Global Sales:</strong> ${game.Global_Sales} million</p>
<p><strong>Critic Score:</strong> ${game.Critic_Score}/100</p>
<p><strong>User Score:</strong> ${game.User_Score}/10</p>
<p><strong>Rating:</strong> ${game.Rating}</p>
</div>
</div>
`;
gameContainer.appendChild(div);
});
/* === If the current page is the first page, hide the previous button. Otherwise, show it. === */
if (currentPage === 0) {
previousBtn.style.display = 'none';
}
else {
previousBtn.style.display = 'block';
}
/* === If the end index exceeds the length of filteredGames, hide the next button. Otherwise, show it. === */
if (end >= filteredGames.length) {
nextBtn.style.display = 'none';
}
else {
nextBtn.style.display = 'block';
}
}
/*=== Event listener for the "Apply Filters" button. Gathers all selected filters and performs the search. ===*/
const applyBtn = document.getElementById('applyBtn');
applyBtn.addEventListener('click', () => {
const filters = {}; // where all the selected filters will be stored
// genre: [platformer, adventure], platform: [PC, PS4], year: [2020, 2021], rating: [E, T] etc
const platformCheckboxes = document.querySelectorAll('.platform-content input[type="checkbox"]');
const genreCheckboxes = document.querySelectorAll('.genre-content input[type="checkbox"]');
const yearCheckboxes = document.querySelectorAll('.year-content input[type="checkbox"]');
const ratingCheckboxes = document.querySelectorAll('.rating-content input[type="checkbox"]');
const gameTitleInput = document.querySelector('input[name="game-search"]');
const sortSelect = document.getElementById('sort-by');
const searchAlgoSelect = document.getElementById('search-algorithm');
/* === Checks to see all the selected checkboxes from each filter div === */
const platformFilters = Array.from(platformCheckboxes).filter(cb => cb.checked).map(cb => cb.value);
const genreFilters = Array.from(genreCheckboxes).filter(cb => cb.checked).map(cb => cb.value);
const yearFilters = Array.from(yearCheckboxes).filter(cb => cb.checked).map(cb => cb.value);
const ratingFilters = Array.from(ratingCheckboxes).filter(cb => cb.checked).map(cb => cb.value);
const publisherFilters = publisherTagify.value.map(tag => tag.value);
/* === If there are any selected filters, add them to the filters object === */
if (platformFilters.length > 0) filters.Platform = platformFilters;
if (genreFilters.length > 0) filters.Genre = genreFilters;
if (yearFilters.length > 0) filters.Year_of_Release = yearFilters;
if (ratingFilters.length > 0) filters.Rating = ratingFilters;
if (publisherFilters.length > 0) filters.Publisher = publisherFilters;
/* === If there is a game title input, add it to the filters object === */
if (gameTitleInput.value.trim() !== '') {
filters.Name = gameTitleInput.value.trim();
}
/* === Perform the search based on the selected sorting method selected === */
if (sortSelect.value == 'best-selling') {
filteredGames = salesTree.InorderSearch(filters);
}
else if (sortSelect.value == 'critic-score') {
filteredGames = criticTree.InorderSearch(filters);
}
else if (sortSelect.value == 'user-score') {
filteredGames = userTree.InorderSearch(filters);
}
// If the sort-by method is left none, use the selected search algorithm
else {
if (searchAlgoSelect.value == 'DFS') {
filteredGames = salesTree.InorderSearch(filters);
}
else {
filteredGames = salesTree.BFS(filters);
}
}
// The div that will contain all the game objects after filtering
const gameContainer = document.getElementById('game-results');
gameContainer.innerHTML = ""; // Clear previous results
// If there are no filtered games, show the info message and hide the numOfNodesDiv that have the nodes passed
if (filteredGames.length === 0) {
gameSectionInfo.style.display = 'block';
numOfNodesDiv.style.display = 'none';
return;
}
// Hide the info message since there are filtered games to show
gameSectionInfo.style.display = 'none';
// If there are no filters selected or game title input, hide the numOfNodesDiv that have the nodes passed
if (platformFilters.length === 0 && genreFilters.length === 0 && yearFilters.length === 0 && ratingFilters.length === 0 && publisherFilters.length === 0 && gameTitleInput.value.trim() === '') {
numOfNodesDiv.style.display = 'none';
}
// If there are filters selected or game title input, show the numOfNodesDiv that have the nodes passed
else {
numOfNodesDiv.style.display = 'block';
numOfNodesDiv.innerText = `Number of nodes until first match: ${filteredGames[0].nodesPassed}`;
}
// Sets the currentPage to 0 and renders the first page of results
currentPage = 0;
renderGamesPage();
});