-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
1505 lines (1429 loc) · 49.5 KB
/
main.js
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
const stateData = {
Kerala: {
photo: "Assets/images/kerala.jpg",
questions: {
ques1: {
text: "On which coast Kerala is located?",
options: ["Karavali", "Malabar coast", "Konkan"],
correct: "Malabar coast",
},
ques2: {
text: "It is considered among the “50 must-see destinations of a lifetime",
options: ["True", "False"],
correct: "True",
},
ques3: {
text: "Kera in Kerala means",
options: ["Coconut", "Palm", "Beach"],
correct: "Coconut",
},
},
},
Tamil_Nadu: {
photo: "Assets/images/tamil_nadu.jpg",
questions: {
ques1: {
text: "What is the capital of Tamil Nadu?",
options: ["Chennai", "Bangalore", "Kanyakumari"],
correct: "Chennai",
},
ques2: {
text: "What is the former name of Chennai?",
options: ["Madras", "Mysore", "Katappa"],
correct: "Madras",
},
ques3: {
text: "Which festival is widely celebrated in Tamil Nadu?",
options: ["Pongal", "Halloween", "Baisakhi"],
correct: "Pongal",
},
},
},
Andaman_Nicobar: {
photo: "Assets/images/andaman_nicobar.jpeg",
questions: {
ques1: {
text: "What is the capital of Andaman and Nicobar Islands?",
options: ["Port Blair", "Leh", "Puducherry"],
correct: "Port Blair",
},
ques2: {
text: "Which is the most important and oldest traditional dance of the islands?",
options: ["Nicobari Dance", "Kathak", "Hip Hop"],
correct: "Nicobari Dance",
},
ques3: {
text: "A small part of the islands belong to which country?",
options: ["Nepal", "Bhutan", "Mayanmar"],
correct: "Mayanmar",
},
},
},
Puducherry: {
photo: "Assets/images/puducherry.jpg",
questions: {
ques1: {
text: "What is the former name of Puducherry?",
options: ["Pondicherry", "Cherry", "Ponducherry"],
correct: "Pondicherry",
},
ques2: {
text: "Puducherry gives the glimpse of which country?",
options: ["France", "Italy", "Switzerland"],
correct: "France",
},
ques3: {
text: "Which international language is spoken by the people of Puducherry?",
options: ["French", "Spanish", "Arabic"],
correct: "French",
},
},
},
Andhra_Pradesh: {
photo: "Assets/images/andhra_pradesh.jpg",
questions: {
ques1: {
text: "How many capitals does Andhra Pradesh have?",
options: [4, 3, 1],
correct: 3,
},
ques2: {
text: "Which is the official language spoken by natives in Andhra Pradesh?",
options: ["Tamil", "Hindi", "Telugu"],
correct: "Telugu",
},
ques3: {
text: "Which mine is a very traditional place of the state?",
options: ["Golconda", "Anaconda", "Ratnagiri"],
correct: "Golconda",
},
},
},
Karnataka: {
photo: "Assets/images/karnataka.jpg",
questions: {
ques1: {
text: "Karnataka is bordered by which sea?",
options: ["Arabian Sea", "Caspian Sea", "Red Sea"],
correct: "Arabian Sea",
},
ques2: {
text: "Karnataka was originally known as",
options: ["Masoori", "Mysore", "Karna"],
correct: "Mysore",
},
ques3: {
text: "Which city in Karnataka is known as the silicon valley of India?",
options: ["Bangalore", "Mangaluru", "Udupi"],
correct: "Bangalore",
},
},
},
Lakshadweep: {
photo: "Assets/images/lakshadweep.jpg",
questions: {
ques1: {
text: "What is the capital of Lakshwadeep?",
options: ["Kavaratti", "Puducherry", "Gangtok"],
correct: "Kavaratti",
},
ques2: {
text: "Lakshadweep was carved out from which city?",
options: ["Madras", "Bangalore", "Visakhapatnam"],
correct: "Madras",
},
ques3: {
text: "People of Lakshwadeep speak in which language?",
options: ["Malayalam", "Kannada", "Arabic"],
correct: "Malayalam",
},
},
},
Goa: {
photo: "Assets/images/goa.jpg",
questions: {
ques1: {
text: "Goa is also fondly known as the",
options: [
"Rome of the East",
"Rome of the West",
"Rome of the India",
],
correct: "Rome of the East",
},
ques2: {
text: "The staple food of Goa is:",
options: [
"staple is the combination of fish curry and rice",
"staple is the combination of sarso ka saag and makke ki roti",
"staple is the combination of chicken curry and rice",
],
correct: "staple is the combination of fish curry and rice",
},
ques3: {
text: "The most common occupation of locals is",
options: ["Fishing", "Harvesting", "Growing cotton"],
correct: "Fishing",
},
},
},
Telangana: {
photo: "Assets/images/telangana.jpg",
questions: {
ques1: {
text: "What is the capital of Telangana?",
options: ["Hyderabad", "Ramagundam", "Nizamabad"],
correct: "Hyderabad",
},
ques2: {
text: "Telangana is carved out from which state?",
options: ["Andhra Pradesh", "Arunachal Pradesh", "Tamil Nadu"],
correct: "Andhra Pradesh",
},
ques3: {
text: "Which popular actress was born in Hyderabad?",
options: ["Dia Mirza", "Katrina Kaif", "Rani Mukherji"],
correct: "Dia Mirza",
},
},
},
Odisha: {
photo: "Assets/images/odisha.jpg",
questions: {
ques1: {
text: "Odisha borders which state?",
options: ["West Bengal", "Kerala", "Uttrakhand"],
correct: "West Bengal",
},
ques2: {
text: "What is the capital of Odisha?",
options: ["Bhubaneshwar", "Kolkata", "Rai Bareilly"],
correct: "Bhubaneshwar",
},
ques3: {
text: "Is Telugu spoken in Odisha?",
options: ["Yes", "No"],
correct: "Yes",
},
},
},
Chhattisgarh: {
photo: "Assets/images/chhattisgarh.jpg",
questions: {
ques1: {
text: "What does Chattisgarh mean?",
options: ["36 forts", "36 cows", "36 kings"],
correct: "36 forts",
},
ques2: {
text: "Which is the capital of Chattisgarh?",
options: ["Ranchi", "Raipur", "Rampur"],
correct: "Raipur",
},
ques3: {
text: "The state is called a rice bowl because of the rich paddy crop",
options: ["True", "False"],
correct: "True",
},
},
},
Maharashtra: {
photo: "Assets/images/mumbai.jpg",
questions: {
ques1: {
text: "Most famous festival in Maharashtra",
options: ["Ganesh Chaturthi", "Chatta Pooja", "Durga Pooja"],
correct: "Ganesh Chaturthi",
},
ques2: {
text: "Which ruler holds the highest place in Maratha history?",
options: ["Maharana Pratap", "Shivaji", "Shah Jahan"],
correct: "Shivaji",
},
ques3: {
text: "Go-to food of Mumbai",
options: ["Pav Bhaji", "Masala Dosa", "Momos"],
correct: "Pav Bhaji",
},
},
},
Daman_Diu: {
photo: "Assets/images/daman_and_diu.jpeg",
questions: {
ques1: {
text: "Mostly people converse in which language?",
options: ["Gujarati", "Bengali", "Kannada"],
correct: "Gujarati",
},
ques2: {
text: "The people tend to follow the mix of Gujarati and Portugese culture",
options: ["True", "False"],
correct: "True",
},
ques3: {
text: "Diu is located near which port?",
options: [".Mumbai Port", "Gujarat port", "Veraval port"],
correct: "Veraval port",
},
},
},
Gujarat: {
photo: "Assets/images/gujarat.jpg",
questions: {
ques1: {
text: "One of the famous Gujarati dishes",
options: ["Samosa", "Dhokla", "Noodles"],
correct: "Dhokla",
},
ques2: {
text: "Which famous Indian freedom fighter hailed from Gujarat?",
options: [
"Mohandas Karamchand Gandhi",
"Jawahar Lal Nehru",
"BR Ambedkar",
],
correct: "Mohandas Karamchand Gandhi",
},
ques3: {
text: "Gujarat is also called as “Jewel of Western India” ",
options: ["True", "False"],
correct: "True",
},
},
},
Rajasthan: {
photo: "Assets/images/rajasthan.jpg",
questions: {
ques1: {
text: "Which city in Rajasthan is known as the pink city?",
options: ["Jodhpur", "Udaipur", "Jaipur"],
correct: "Jaipur",
},
ques2: {
text: "Which dance of Rajashthan is famous world wide?",
options: ["Ghoomar dance", "Jhoomar dance", "Gidda"],
correct: "Ghoomar dance",
},
ques3: {
text: "The dominant population of Rajasthan is",
options: ["Jatts", "Rajputs", "Gujars"],
correct: "Rajputs",
},
},
},
Madhya_Pradesh: {
photo: "Assets/images/madhya_pradesh.jpg",
questions: {
ques1: {
text: "Which city in MP is called 'Meat Lovers Paradise'?",
options: ["Bhopal", "Ujjain", "Indore"],
correct: "Bhopal",
},
ques2: {
text: "Madhya Pradesh is called the 'Heart of India'.",
options: ["True", "False"],
correct: "True",
},
ques3: {
text: "MP is the largest in terms of area",
options: ["True", "False"],
correct: "False",
},
},
},
Jharkhand: {
photo: "Assets/images/jharkhand.jpg",
questions: {
ques1: {
text: "Which is the largest industrial city in Jharkhand?",
options: ["Dhamka", "Jamshedpur", "Hazaribagh"],
correct: "Jamshedpur",
},
ques2: {
text: "Which is the sub-capital of the state?",
options: ["Ranchi", "Dhamka", "Jamshedpur"],
correct: "Dhamka",
},
ques3: {
text: "Jharkhand is one of the richest regions of India in mineral resources",
options: ["True", "False"],
correct: "True",
},
},
},
West_Bengal: {
photo: "Assets/images/west_bengal.jpg",
questions: {
ques1: {
text: "What is the capital of West Bengal?",
options: ["Kolkata", "Dhaka", "Kharagpur"],
correct: "Kolkata",
},
ques2: {
text: "Which is the widely spoken language of the state?",
options: ["Bengali", "Marathi", "Hindi"],
correct: "Bengali",
},
ques3: {
text: "Which is the most popular festival of West Bengal?",
options: ["Chath pooja", "Durga pooja", "Ganesh chaturthi"],
correct: "Durga pooja",
},
},
},
Tripura: {
photo: "Assets/images/tripura.jpg",
questions: {
ques1: {
text: "Tripura is one of the third smallest states of India",
options: ["True", "False"],
correct: "True",
},
ques2: {
text: "How many districts are there in Tripura?",
options: [4, 8, 25],
correct: 8,
},
ques3: {
text: "What does Tripura mean?",
options: ["Near water", "Near god", "Near land"],
correct: "Near water",
},
},
},
Mizoram: {
photo: "Assets/images/mizoram.jpg",
questions: {
ques1: {
text: "Which is the main religion in Mizoram?",
options: ["Sikhism", "Christianity", "Judaism"],
correct: "Christianity",
},
ques2: {
text: "Mizoram is also part of the Seven Sisters groups",
options: ["True", "False"],
correct: "True",
},
ques3: {
text: "What is the main language of Mizoram?",
options: ["Mizo", "Urdu", "English"],
correct: "Mizo",
},
},
},
Manipur: {
photo: "Assets/images/manipur.jpg",
questions: {
ques1: {
text: "It is the birthplace of polo, the sport",
options: ["True", "False"],
correct: "True",
},
ques2: {
text: "It is the birthplace of which classical dance form.?",
options: ["Ram lila", "Ras lila", "Bharat natyam"],
correct: "Ras lila",
},
ques3: {
text: "What is the Manipuri Language Known as?",
options: ["Miti Language", "Manipuri", "Imphali"],
correct: "Miti Language",
},
},
},
Nagaland: {
photo: "Assets/images/nagaland.jpg",
questions: {
ques1: {
text: "Most popular festival organized by the state government",
options: [
"Hornbill festival",
"Falcon festival",
"Festival of boats",
],
correct: "Hornbill festival",
},
ques2: {
text: "Nagaland is the home of Bhut Jolokia, one of the spiciest chillies in the world.",
options: ["True", "False"],
correct: "True",
},
ques3: {
text: "Nagaland is known as the Falcon Capital of the World",
options: ["True", "False"],
correct: "True",
},
},
},
Arunachal_Pradesh: {
photo: "Assets/images/arunachal-pradesh.jpg",
questions: {
ques1: {
text: "What is Arunachal Pradesh known as?",
options: [
"The Land of Dawnlit",
"The Land of Mountains",
"The Land of Flaura and Fauna",
],
correct: "The Land of Dawnlit",
},
ques2: {
text: "One of the prominent festivals of Arunachal Pradesh",
options: ["Pongal", "Halloween", "Losar"],
correct: "Losar",
},
ques3: {
text: "Which is the main occupation of Arunachal Pradesh's people?",
options: [
"Agriculture",
"Embroidery Business",
"Auto Mechanics",
],
correct: "Agriculture",
},
},
},
Assam: {
photo: "Assets/images/assam.jpg",
questions: {
ques1: {
text: "Assam is not one of the Eight Sister states of northeastern India",
options: ["True", "False"],
correct: "False",
},
ques2: {
text: "The most famous festival of Assam",
options: ["Bihu", "Pihu", "Pongal"],
correct: "Bihu",
},
ques3: {
text: "Assam is well known for which plantations all over the world",
options: ["Rice", "Tea", "Cotton"],
correct: "Tea",
},
},
},
Meghalaya: {
photo: "Assets/images/meghalaya.jpg",
questions: {
ques1: {
text: "What does Meghalaya mean?",
options: [
"The abode of Gods",
"The abode of divine ",
"The abode of clouds",
],
correct: "The abode of Gods",
},
ques2: {
text: "What is the capital of Meghalaya?",
options: ["Shillong", "Aizwal", "Kohima"],
correct: "Shillong",
},
ques3: {
text: "The main food of the residents here",
options: [
"Rice and dried fish",
"Rice and Roti",
"Roti with ghee",
],
correct: "Rice and dried fish",
},
},
},
Sikkim: {
photo: "Assets/images/sikkim.jpg",
questions: {
ques1: {
text: "What is the capital of Sikkim?",
options: ["Gangtok", "Sikkim city", "Aizawal"],
correct: "Gangtok",
},
ques2: {
text: "Sikkim borders which country",
options: ["Bhutan", "China", "Both of them"],
correct: "Both of them",
},
ques3: {
text: "Sikkim state has the lowest population in the country",
options: ["True", "False"],
correct: "True",
},
},
},
Bihar: {
photo: "Assets/images/bihar.jpg",
questions: {
ques1: {
text: "One of the widely spoken languages of Bihar:",
options: ["Bhojpuri", "French", "Telugu"],
correct: "Bhojpuri",
},
ques2: {
text: "Which dynasty ruled this area for a considerable time?",
options: [
"Humayun Dynasty",
"Maurya and Gupta Dynasty",
"Shah Mir Dynasty",
],
correct: "Maurya and Gupta Dynasty",
},
ques3: {
text: "The main festival of Bihar is",
options: ["Chhath Puja", "Durga Puja", "Ganesh Chaturthi"],
correct: "Chhath Puja",
},
},
},
Uttar_Pradesh: {
photo: "Assets/images/uttar_pradesh.jpeg",
questions: {
ques1: {
text: "What is the capital of Uttar Pradesh?",
options: ["Lucknow", "Prayagraj", "Aligarh"],
correct: "Lucknow",
},
ques2: {
text: "Taj Mahal is situated in which city",
options: ["Bareilly", "Agra", "Ghaziabad"],
correct: "Agra",
},
ques3: {
text: "Uttar Pradesh is the most populous state in India",
options: ["True", "False"],
correct: "True",
},
},
},
Uttarakhand: {
photo: "Assets/images/uttarakhand.jpg",
questions: {
ques1: {
text: "What is the capital of Uttrakhand",
options: ["Dehradun", "Darjeeling", "Bilaspur"],
correct: "Dehradun",
},
ques2: {
text: "Which is the most spoken language that originates from hindi?",
options: ["Garhwali", "Pahadi", "Urdu"],
correct: "Garhwali",
},
ques3: {
text: "Which country borders Uttrakhand?",
options: ["Nepal", "China", "Bangladesh"],
correct: "Nepal",
},
},
},
Haryana: {
photo: "Assets/images/haryana.jpg",
questions: {
ques1: {
text: "Haryana is also known as The Home of Gods",
options: ["True", "False"],
correct: "True",
},
ques2: {
text: "Which is the traditional headgear for men?",
options: ["Pagri", "Topi", "Hat"],
correct: "Pagri",
},
ques3: {
text: "On which day Haryana Day is observed?",
options: ["1st November", "31st January", "29th February"],
correct: "1st November",
},
},
},
Delhi: {
photo: "Assets/images/delhi.jpg",
questions: {
ques1: {
text: "Which famous historical monument is in Delhi?",
options: ["Taj Mahal", "Qutub Minar", "Hawa Mahal"],
correct: "Qutub Minar",
},
ques2: {
text: "What was the capital of India before Delhi?",
options: ["Kolkata", "Mumbai", "Hyderabad"],
correct: "Kolkata",
},
ques3: {
text: "Delhi has only been India’s capital since",
options: [1911, 1947, 2000],
correct: 1911,
},
},
},
Punjab: {
photo: "Assets/images/punjab.jpg",
questions: {
ques1: {
text: "What does Punjab mean?",
options: [
"The land of five rivers",
"The land of five lords",
"The land of sikhs",
],
correct: "The land of five rivers",
},
ques2: {
text: "Which is Punjab's famous dance ?",
options: ["Bhangra", "Katha Kali", "Hip Hop"],
correct: "Bhangra",
},
ques3: {
text: "Golden Temple is located in which city of Punjab?",
options: ["Chandigarh", "Amritsar", "Patiala"],
correct: "Amritsar",
},
},
},
Himachal_Pradesh: {
photo: "Assets/images/himachal_pradesh.jpg",
questions: {
ques1: {
text: "What does Himachal literally mean?",
options: [
"Lap of snow-covered mountains",
"Lap of streams",
"Lap of white mountains",
],
correct: "Lap of snow-covered mountains",
},
ques2: {
text: "Which is the third smoke free city of India in Himachal Pradesh?",
options: ["Shimla", "Kullu", "Manali"],
correct: "Shimla",
},
ques3: {
text: "The people of Himachal Pradesh mostly wear which kind of clothes",
options: ["woollen", "silk", "cotton"],
correct: "woollen",
},
},
},
Jammu_Kashmir: {
photo: "Assets/images/kashmir.jpg",
questions: {
ques1: {
text: "What is the capital of J&K in summers?",
options: ["Srinagar", "Baramulla", "Pahalgam"],
correct: "Srinagar",
},
ques2: {
text: "It is called the Switzerland of India",
options: ["True", "False"],
correct: "True",
},
ques3: {
text: "What is the capital of J&K in winters?",
options: ["Gulmarg", "Jammu", "Islamabad"],
correct: "Malayalam",
},
},
},
Ladakh: {
photo: "Assets/images/ladakh.jpeg",
questions: {
ques1: {
text: "What is the capital of Ladakh?",
options: ["Leh", "Sonmarg", "Baramulla"],
correct: "Leh",
},
ques2: {
text: "leh-Ladakh is often called 'Little Tibet' or 'Land of the Broken Moon'.",
options: ["True", "False"],
correct: "True",
},
ques3: {
text: "Ladakh borders which country?",
options: ["China", "Bangladesh", "Mayanmar"],
correct: "China",
},
},
},
};
function StateCard() {
/**
* This is a factory function same like class,
* It is use to create states cards, all the property & methods
* of cards are stored inside this.
*/
const drawCard = (stateName, stateImg, stateCardId) => {
/**
* This will create a card element
* It will take a name, image
* Then assign classes and return the card.
*/
const cardClasses = [
"w-36",
"rounded",
"overflow-hidden",
"shadow-lg",
"relative",
"flex-auto",
];
const card = document.createElement("div");
card.classList.add(...cardClasses);
const imgClasses = ["w-full", "h-[90px]"];
const img = document.createElement("img");
img.src = stateImg;
img.classList.add(...imgClasses);
const nameClasses = ["flex", "justify-center"];
const name = document.createElement("div");
name.textContent = stateName;
name.classList.add(...nameClasses);
card.setAttribute("data-id", stateCardId);
card.append(img, name);
return card;
};
return { drawCard };
}
function BonusAndTrapCard() {
/**
* This is the factory same like classes
* It is for creating the bonus and trap cards
* All the properties and methods of these cards will be
* store here.
*/
const drawBonusCard = (bonusCardId) => {
const cardClasses = [
"w-36",
"rounded",
"overflow-hidden",
"shadow-lg",
"flex",
"justify-center",
"items-center",
"bg-green-100",
"border-2",
"border-green-400",
"border-solid",
"relative",
"flex-auto",
];
const card = document.createElement("div");
card.classList.add(...cardClasses);
card.textContent = "Bonus";
card.setAttribute("data-id", bonusCardId);
return card;
};
const drawTrapCard = (trapCardId) => {
const cardClasses = [
"w-36",
"rounded",
"overflow-hidden",
"shadow-lg",
"flex",
"justify-center",
"items-center",
"bg-red-100",
"border-2",
"border-red-400",
"border-solid",
"relative",
"flex-auto",
];
const card = document.createElement("div");
card.classList.add(...cardClasses);
card.textContent = "Trap";
card.setAttribute("data-id", trapCardId);
return card;
};
return { drawBonusCard, drawTrapCard };
}
function Dice() {
let sides = 6;
const roll = () => {
let randomNumber = Math.floor(Math.random() * sides) + 1;
return randomNumber;
};
//Prints dice roll to the page
const printNumber = (number) => {
var placeholder = document.getElementById("placeholder");
placeholder.textContent = number;
};
return { roll, printNumber };
}
function Player(bgColor, posTop, posLeft) {
let currentPosition = 1;
let playerId = "";
// Will get the first card from the board
let currentParentElement = "";
const drawPlayer = () => {
currentParentElement = document.querySelector(
`[data-id="${currentPosition}"]`
);
const playerDivClasses = [
"h-[36px]",
"w-[36px]",
"rounded-full",
`bg-[${bgColor}]`,
"absolute",
`top-[${posTop}]`,
`left-[${posLeft}]`,
];
const playerDiv = document.createElement("div");
playerDiv.classList.add(...playerDivClasses);
playerDiv.setAttribute("data-player-id", playerId);
currentParentElement.appendChild(playerDiv);
};
const move = (newStepsToMove, idOfPlayer) => {
// First removed the the player from the current card element
removePlayer(currentParentElement, idOfPlayer);
// Updating the positon as per dice
let nextPositon = currentPosition + newStepsToMove;
currentPosition = nextPositon;
// Also changing the current card to the next state
currentParentElement = document.querySelector(
`[data-id="${currentPosition}"]`
);
// drawing the player again
drawPlayer();
if (
currentPosition === 3 ||
currentPosition === 16 ||
currentPosition === 31
) {
switch (currentPosition) {
case 3:
currentPosition = 11;
break;
case 16:
currentPosition = 23;
break;
case 31:
currentPosition = 37;
break;
default:
break;
}
// First removed the the player from the card where the player reached after its turn
removePlayer(currentParentElement, idOfPlayer);
// // Updating the positon as per dice
// currentPosition = 3;
// Also changing the card to the card where the player will be teleported
currentParentElement = document.querySelector(
`[data-id="${currentPosition}"]`
);
// drawing the player again
setTimeout(() => {
drawPlayer();
alert("Yay!! You took a tunnel!")
}, 2000);
} else if (
currentPosition === 10 ||
currentPosition === 20 ||
currentPosition === 26 ||
currentPosition === 41
) {
switch (currentPosition) {
case 10:
currentPosition = 2;
break;
case 20:
currentPosition = 11;
break;
case 26:
currentPosition = 15;
break;
case 41:
currentPosition = 5;
default:
break;
}
// First removed the the player from the card where the player reached after its turn
removePlayer(currentParentElement, idOfPlayer);
// // Updating the positon as per dice
// currentPosition = 10;
// Also changing the card to the card where the player will be teleported
currentParentElement = document.querySelector(
`[data-id="${currentPosition}"]`
);
// drawing the player again
setTimeout(() => {
drawPlayer();
alert("ohh..NO!! You don't have licence for this state!! :(")
}, 2000);
} else {
const quizObj = Quiz();
let index = 0;
let stateKey = Object.keys(stateData)[index];
let bgImg = stateData[stateKey].photo;
let ques1 = "";
let ques1Options = [];
let que1Correct = "";
let ques2 = "";
let ques2Options = [];
let que2Correct = "";
let ques3 = "";
let ques3Options = [];
let que3Correct = "";
switch (currentPosition) {
case 2:
index = 33;
break;
case 4:
index = 32;
break;
case 5:
index = 31;