-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathchooser.js
1208 lines (1168 loc) · 36.3 KB
/
chooser.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
//@ts-check
'use strict';
const VERSION = '20.2.10.0'; // examined by bake.tcl
const Variants = [
{
'Name':'Klondike',
'Type':'All,Klondike,Classic,Small Screen',
'Desc':'one pack, unlimited redeals',
'File':'Klondike1',
'Wikipedia':'https://en.wikipedia.org/wiki/Klondike_(solitaire)'
},
{
'Name':'Klondike Hard',
'Type':'All,Klondike,Hard,Small Screen',
'Desc':'one pack, no redeals',
'File':'Klondike1-1',
'Wikipedia':'https://en.wikipedia.org/wiki/Klondike_(solitaire)'
},
{
'Name':'Klondike Draw Three',
'Type':'All,Klondike,Small Screen',
'Desc':'one pack, draw three, unlimited redeals',
'File':'Klondike3',
'Wikipedia':'https://en.wikipedia.org/wiki/Klondike_(solitaire)'
},
{
'Name':'Double Klondike',
'Type':'All,Klondike,Two Packs',
'Desc':'two packs, draw one, unlimited redeals',
'File':'DoubleKlondike',
'Wikipedia':'https://en.wikipedia.org/wiki/Klondike_(solitaire)'
},
{
'Name':'Triple Klondike',
'Type':'All,Klondike,Three Packs',
'Desc':'three packs, draw one, unlimited redeals',
'File':'TripleKlondike',
'Wikipedia':'https://en.wikipedia.org/wiki/Klondike_(solitaire)'
},
{
'Name':'Quadruple Klondike',
'Type':'All,Klondike',
'Desc':'four packs, draw one, unlimited redeals',
'File':'QuadKlondike',
'Wikipedia':'https://en.wikipedia.org/wiki/Klondike_(solitaire)'
},
{
'Name':'Thoughtful',
'Type':'All,Klondike,Small Screen',
'Desc':'aka Saratoga. Klondike but with all tableau cards face up',
'File':'Thoughtful',
'Wikipedia':'https://en.wikipedia.org/wiki/Klondike_(solitaire)'
},
{
'Name':'Lady Jane',
'Type':'All,Klondike,Two Packs',
'Desc':'an easy two-deck Spider/Klondike blend by Thomas Warfield',
'File':'LadyJane',
'Wikipedia':''
},
{
'Name':'Blockade',
'Type':'All,Easy,Spider,Two Packs',
'Desc':'an easy mix of Klondike and Spider',
'File':'Blockade',
'Wikipedia':'https://en.wikipedia.org/wiki/Blockade_(solitaire)'
},
{
'Name':'Napoleon\'s Square',
'Type':'All,Easy,Forty Thieves,Two Packs',
'Desc':'an easier version of Forty Thieves',
'File':'NapSq',
'Wikipedia':'https://en.wikipedia.org/wiki/Napoleon%27s_Square'
},
{
'Name':'Whitehead',
'Type':'All,Klondike,Easy,Small Screen',
'Desc':'build down regardless of color, can only move cards of same suit',
'File':'Whitehead',
'Wikipedia':'https://en.wikipedia.org/wiki/Klondike_(solitaire)#Variations'
},
{
'Name':'Agnes Bernauer',
'Type':'All,Canfield,Small Screen',
'Desc':'aka Agnes, a variation of Klondike with reserve piles',
'File':'AgnesBernauer',
'Wikipedia':'https://en.wikipedia.org/wiki/Agnes_(card_game)'
},
{
'Name':'Agnes Sorel',
'Type':'All,Canfield,Hard,Small Screen',
'Desc':'a David Parlett original which is almost impossible to win',
'File':'AgnesSorel',
'Wikipedia':'https://en.wikipedia.org/wiki/Agnes_(card_game)'
},
{
'Name':'Easthaven',
'Type':'All,Klondike,Hard',
'Desc':'aka Aces Up - Klondike-like with a Spider-like stock',
'File':'Easthaven',
'Wikipedia':''
},
{
'Name':'Double Easthaven',
'Type':'All,Klondike,Hard,Two Packs',
'Desc':'aka Aces Up - Klondike-like with a Spider-like stock',
'File':'DoubleEasthaven',
'Wikipedia':''
},
{
'Name':'Westcliff',
'Type':'All,Klondike,Easy',
'Desc':'probably the easiest game in this collection',
'File':'Westcliff',
'Wikipedia':'https://en.wikipedia.org/wiki/Westcliff_(solitaire)'
},
{
'Name':'Yukon',
'Type':'All,Yukon,Classic,Small Screen',
'Desc':'build the tableau down by alternate color',
'File':'Yukon',
'Wikipedia':'https://en.wikipedia.org/wiki/Yukon_(solitaire)'
},
{
'Name':'Russian',
'Type':'All,Yukon,Small Screen',
'Desc':'build the tableau down in suit',
'File':'Russian',
'Wikipedia':'https://en.wikipedia.org/wiki/Russian_(solitaire)'
},
{
'Name':'Yukon One Suit',
'Type':'All,Easy,Yukon,Small Screen,One Suit',
'Desc':'easy version of Yukon',
'File':'Yukon1',
'Wikipedia':'https://en.wikipedia.org/wiki/Yukon_(solitaire)'
},
{
'Name':'Yukon Cells',
'Type':'All,Easy,Yukon',
'Desc':'easy version of Yukon with two free cells',
'File':'YukonCells',
'Wikipedia':'https://en.wikipedia.org/wiki/Yukon_(solitaire)'
},
{
'Name':'Double Yukon',
'Type':'All,Yukon,Two Packs',
'Desc':'harder version of Yukon',
'File':'DoubleYukon',
'Wikipedia':'https://en.wikipedia.org/wiki/Yukon_(solitaire)'
},
{
'Name':'Alaska',
'Type':'All,Yukon,Hard,Small Screen',
'Desc':'a version of Yukon, but the tableau is built up or down by suit',
'File':'Alaska',
'Wikipedia':'https://en.wikipedia.org/wiki/Yukon_(solitaire)'
},
{
'Name':'Brisbane',
'Type':'All,Easy,Yukon,Small Screen',
'Desc':'a version of Yukon, build the tableau down regardless of suit',
'File':'Brisbane',
'Wikipedia':'https://en.wikipedia.org/wiki/Yukon_(solitaire)'
},
{
'Name':'Australian',
'Type':'All,Klondike,Yukon,Easy,Small Screen',
'Desc':'an easy mix of Klondike and Yukon, the tableau is built down by suit',
'File':'Australian',
'Wikipedia':'https://en.wikipedia.org/wiki/Australian_Patience'
},
{
'Name':'Canfield',
'Type':'All,Canfield,Classic,Small Screen',
'Desc':'aka Fascination, Demon, Thirteen',
'File':'Canfield',
'Wikipedia':'https://en.wikipedia.org/wiki/Canfield_(solitaire)'
},
{
'Name':'Rainbow',
'Type':'All,Canfield,Small Screen',
'Desc':'a slightly easier version of Canfield',
'File':'Rainbow',
'Wikipedia':'https://en.wikipedia.org/wiki/Canfield_(solitaire)'
},
{
'Name':'Storehouse',
'Type':'All,Canfield',
'Desc':'an easier version of Canfield',
'File':'Storehouse',
'Wikipedia':'https://en.wikipedia.org/wiki/Canfield_(solitaire)'
},
{
'Name':'American Toad',
'Type':'All,Canfield,Two Packs,Easy',
'Desc':'an easier version of Canfield',
'File':'AmericanToad',
'Wikipedia':'https://en.wikipedia.org/wiki/American_Toad_(solitaire)'
},
{
'Name':'Duchess',
'Type':'All,Canfield',
'Desc':'Similar to Canfield, but has more scope for strategy.',
'File':'Duchess',
'Wikipedia':'https://en.wikipedia.org/wiki/Duchess_(solitaire)',
},
{
'Name':'Golf',
'Type':'All,Golf',
'Desc':'move cards that are one rank higher or one rank lower than the top card of the foundation',
'File':'Golf',
'Wikipedia':'https://en.wikipedia.org/wiki/Golf_(patience)'
},
{
'Name':'Golf Relaxed',
'Type':'All,Golf',
'Desc':'Aces and Kings can go on each other',
'File':'GolfRelaxed',
'Wikipedia':'https://en.wikipedia.org/wiki/Golf_(patience)'
},
{
'Name':'Alternation',
'Type':'All,Other,Two Packs',
'Desc':'alternate cards face down, built up alternate colors',
'File':'Alternation',
'Wikipedia':'https://en.wikipedia.org/wiki/Alternation_(solitaire)'
},
{
'Name':'Flower Garden',
'Type':'All,Other',
'Desc':'aka The Garden or Bouquet',
'File':'FlowerGarden',
'Wikipedia':'https://en.wikipedia.org/wiki/Flower_Garden_(solitaire)'
},
{
'Name':'Brigade',
'Type':'All,Other',
'Desc':'easier version of Flower Garden',
'File':'Brigade',
'Wikipedia':'https://en.wikipedia.org/wiki/Flower_Garden_(solitaire)'
},
{
'Name':'Carpet',
'Type':'All,Easy,Other',
'Desc':'easy game with twenty reserve piles, no tableau and no building',
'File':'Carpet',
'Wikipedia':'https://en.wikipedia.org/wiki/Carpet_(solitaire)'
},
{
'Name':'Forty Thieves',
'Type':'All,Forty Thieves,Classic,Two Packs,Hard',
'Desc':'aka Napoleon at St Helena',
'File':'FortyThieves',
'Wikipedia':'https://en.wikipedia.org/wiki/Forty_Thieves_(card_game)'
},
{
'Name':'Squadron',
'Type':'All,Forty Thieves,Two Packs',
'Desc':'Forty Thieves with three free cells',
'File':'Squadron',
'Wikipedia':'https://en.wikipedia.org/wiki/Forty_Thieves_(card_game)'
},
{
'Name':'Forty and Eight',
'Type':'All,Forty Thieves,Two Packs',
'Desc':'easier version of Forty Thieves, allows two stock redeals',
'File':'FortyAndEight',
'Wikipedia':'https://en.wikipedia.org/wiki/Forty_Thieves_(card_game)'
},
{
'Name':'Congress',
'Type':'All,Forty Thieves,Two Packs',
'Desc':'empty tableaux are automatically filled from waste or stock piles',
'File':'Congress',
'Wikipedia':'https://en.wikipedia.org/wiki/Congress_(solitaire)'
},
{
'Name':'Parliament',
'Type':'All,Forty Thieves,Two Packs',
'Desc':'an easier version of Congress',
'File':'Parliament',
'Wikipedia':'https://en.wikipedia.org/wiki/Congress_(solitaire)'
},
{
'Name':'Josephine',
'Type':'All,Forty Thieves,Two Packs',
'Desc':'aka Forty Bandits - an easier version of Forty Thieves',
'File':'Josephine',
'Wikipedia':'https://en.wikipedia.org/wiki/Josephine_(solitaire)'
},
{
'Name':'Maria',
'Type':'All,Forty Thieves,Two Packs',
'Desc':'like Forty Thieves, but build tableau down in alternate colors',
'File':'Maria',
'Wikipedia':'https://en.wikipedia.org/wiki/Forty_Thieves_(card_game)'
},
{
'Name':'Number Ten',
'Type':'All,Forty Thieves,Two Packs',
'Desc':'like Forty Thieves, but build tableau down in alternate colors',
'File':'NumberTen',
'Wikipedia':'https://en.wikipedia.org/wiki/Forty_Thieves_(card_game)'
},
{
'Name':'Indian',
'Type':'All,Forty Thieves,Two Packs',
'Desc':'',
'File':'Indian',
'Wikipedia':'https://en.wikipedia.org/wiki/Forty_Thieves_(card_game)'
},
{
'Name':'Lucas',
'Type':'All,Forty Thieves,Two Packs',
'Desc':'easier version of Forty Thieves where the foundation is seeded with aces',
'File':'Lucas',
'Wikipedia':'https://en.wikipedia.org/wiki/Josephine_(solitaire)'
},
{
'Name':'Limited',
'Type':'All,Two Packs,Forty Thieves',
'Desc':'easier version of Forty Thieves with more tableaux piles',
'File':'Limited',
'Wikipedia':'https://en.wikipedia.org/wiki/Forty_Thieves_(card_game)'
},
{ 'Name': 'Single Rail',
'Type': 'All,Forty Thieves,Small Screen',
'Desc': 'A single pack variation of Forty Thieves',
'File': 'SingleRail',
},
{
'Name':'Freecell',
'Type':'All,Freecell,Classic,Small Screen',
'Desc':'can move multiple tableau cards',
'File':'Freecell',
'Wikipedia':'https://en.wikipedia.org/wiki/Freecell'
},
{
'Name':'Forecell',
'Type':'All,Freecell,Small Screen',
'Desc':'can move multiple tableau cards, cells are filled at start',
'File':'Forecell',
'Wikipedia':'https://en.wikipedia.org/wiki/Freecell'
},
{
'Name':'Freecell Original',
'Type':'All,Freecell,Small Screen',
'Desc':'invented by Paul Alfille',
'File':'Freecell0',
'Wikipedia':'https://en.wikipedia.org/wiki/Freecell'
},
{
'Name':'Freecell Easy',
'Type':'All,Easy,Freecell,Small Screen',
'Desc':'Kings and Aces are moved to top and bottom of tableaux stacks',
'File':'FreecellEasy',
'Wikipedia':'https://en.wikipedia.org/wiki/Freecell'
},
{
'Name':'Blind Freecell',
'Type':'All,Freecell',
'Desc':'Freecell made harder; tableau cards are face down and cells are filled',
'File':'BlindFreecell',
'Wikipedia':'https://en.wikipedia.org/wiki/Freecell'
},
{
'Name':'Sea Towers',
'Type':'All,Freecell',
'Desc':'aka Seahaven Towers or Seahaven, by Art Cabral',
'File':'SeaTowers',
'Wikipedia':'https://en.wikipedia.org/wiki/Seahaven_Towers_(solitaire)'
},
{
'Name':'Big Freecell',
'Type':'All,Freecell,Two Packs,Easy',
'Desc':'a very easy straight-forward two-deck version of FreeCell',
'File':'BigFreecell',
'Wikipedia':'https://en.wikipedia.org/wiki/Freecell'
},
{
'Name':'Double Freecell',
'Type':'All,Freecell,Two Packs',
'Desc':'Thomas Warfield\'s two-deck variation on Freecell',
'File':'DoubleFreecell',
'Wikipedia':'https://en.wikipedia.org/wiki/Freecell'
},
{
'Name':'Eight Off',
'Type':'All,Freecell',
'Desc':'predates Freecell',
'File':'EightOff',
'Wikipedia':'https://en.wikipedia.org/wiki/Eight_Off'
},
{
'Name':'Baker\'s Game',
'Type':'All,Freecell',
'Desc':'predates Freecell, tableau are built by suit',
'File':'Baker\'sGame',
'Wikipedia':'https://en.wikipedia.org/wiki/Baker%27s_Game'
},
{
'Name':'Penguin',
'Type':'All,Freecell',
'Desc':'a David Parlett original',
'File':'Penguin',
'Wikipedia':'http://www.parlettgames.uk/patience/penguin.html'
},
{
'Name':'Tuxedo',
'Type':'All,Freecell',
'Desc':'an easier version of Penguin',
'File':'Tuxedo',
'Wikipedia':'https://politaire.com/help/tuxedo'
},
{
'Name':'Scorpion',
'Type':'All,Scorpion,Classic,Small Screen',
'Desc':'related to Spider, the method of game play is like Yukon',
'File':'Scorpion',
'Wikipedia':'https://en.wikipedia.org/wiki/Scorpion_(solitaire)'
},
{
'Name':'Three Blind Mice',
'Type':'All,Scorpion',
'Desc':'a variation of Scorpion with a two-card reserve',
'File':'ThreeBlindMice',
'Wikipedia':'https://en.wikipedia.org/wiki/Scorpion_(solitaire)'
},
{
'Name':'Double Scorpion',
'Type':'All,Hard,Scorpion,Two Packs',
'Desc':'a two deck version of Scorpion, all cards are already dealt at the beginning',
'File':'DoubleScorpion',
'Wikipedia':'https://en.wikipedia.org/wiki/Scorpion_(solitaire)'
},
{
'Name':'Triple Scorpion',
'Type':'All,Scorpion,Three Packs',
'Desc':'a three deck version of Scorpion, all cards are already dealt at the beginning',
'File':'TripleScorpion',
'Wikipedia':'https://en.wikipedia.org/wiki/Scorpion_(solitaire)'
},
{
'Name':'Wasp',
'Type':'All,Easy,Scorpion,Small Screen',
'Desc':'easy version of Scorpion, allows any card to be placed on empty column',
'File':'Wasp',
'Wikipedia':'https://en.wikipedia.org/wiki/Scorpion_(solitaire)'
},
{
'Name':'Spider One Suit',
'Type':'All,Spider,Easy,Classic,One Suit',
'Desc':'easy version of Spider with only spades',
'File':'Spider1',
'Wikipedia':'https://en.wikipedia.org/wiki/Spider_(solitaire)'
},
{
'Name':'Spider Two Suits',
'Type':'All,Spider,Two Suits',
'Desc':'easier version of Spider with only spades and hearts',
'File':'Spider2',
'Wikipedia':'https://en.wikipedia.org/wiki/Spider_(solitaire)'
},
{
'Name':'Spider',
'Type':'All,Spider,Two Packs',
'Desc':'made famous by Microsoft, though it dates back at least to 1949',
'File':'Spider4',
'Wikipedia':'https://en.wikipedia.org/wiki/Spider_(solitaire)'
},
{
'Name':'Spiderette One Suit',
'Type':'All,Spider,Easy,Small Screen,One Suit',
'Desc':'',
'File':'Spiderette1',
'Wikipedia':'https://en.wikipedia.org/wiki/Spider_(solitaire)'
},
{
'Name':'Spiderette Two Suits',
'Type':'All,Spider,Small Screen,Two Suits',
'Desc':'',
'File':'Spiderette2',
'Wikipedia':'https://en.wikipedia.org/wiki/Spider_(solitaire)'
},
{
'Name':'Spiderette',
'Type':'All,Spider,Hard,Small Screen',
'Desc':'',
'File':'Spiderette4',
'Wikipedia':'https://en.wikipedia.org/wiki/Spider_(solitaire)'
},
{
'Name':'Simple Simon',
'Type':'All,Easy,Simple,Spider',
'Desc':'like a one-deck Spider where all cards start face up in a triangular tableau',
'File':'SimpleSimon',
'Wikipedia':'https://en.wikipedia.org/wiki/Simple_Simon_(solitaire)'
},
{
'Name':'Mrs Mop',
'Type':'All,Simple,Spider',
'Desc':'Invented by Charles Jewell, it is a relative of Spider in which all of the cards are dealt face up at the beginning of the game.',
'File':'MrsMop',
'Wikipedia':'https://en.wikipedia.org/wiki/Mrs._Mop'
},
{
'Name':'Mrs Mop Relaxed',
'Type':'All,Simple,Spider',
'Desc':'Invented by Charles Jewell, it is a relative of Spider in which all of the cards are dealt face up at the beginning of the game.',
'File':'MrsMopRelaxed',
'Wikipedia':'https://en.wikipedia.org/wiki/Mrs._Mop'
},
{
'Name':'Fortress',
'Type':'All,Hard,Simple,Castle',
'Desc':'one of the oldest open solitaires and at one time one of the most popular',
'File':'Fortress',
'Wikipedia':'https://en.wikipedia.org/wiki/Fortress_(card_game)'
},
{
'Name':'Cruel',
'Type':'All,Tableau Redeal',
'Desc':'originally for Microsoft Windows, based on Perseverance',
'File':'Cruel',
'Wikipedia':'https://en.wikipedia.org/wiki/Cruel_(solitaire)'
},
{
'Name':'Unusual',
'Type':'All,Tableau Redeal,Two Packs',
'Desc':'a two-pack version of Cruel',
'File':'Unusual',
'Wikipedia':'https://en.wikipedia.org/wiki/Cruel_(solitaire)'
},
{
'Name':'Ripple Fan',
'Type':'All,Tableau Redeal',
'Desc':'an easier version of Cruel',
'File':'RippleFan',
'Wikipedia':'https://en.wikipedia.org/wiki/Cruel_(solitaire)'
},
{
'Name':'Perseverance',
'Type':'All,Tableau Redeal',
'Desc':'like Cruel, but a sequence of cards can be moved',
'File':'Perseverance',
'Wikipedia':'https://en.wikipedia.org/wiki/Perseverance_(solitaire)'
},
{
'Name':'Indefatigable',
'Type':'All,Tableau Redeal',
'Desc':'like Royal Family, but the foundations build up from Ace, and there is an extra redeal',
'File':'Indefatigable',
'Wikipedia':'https://en.wikipedia.org/wiki/Perseverance_(solitaire)'
},
{
'Name':'Beleaguered Castle',
'Type':'All,Castle',
'Desc':'aka Laying Siege, Sham Battle',
'File':'BeleagueredCastle',
'Wikipedia':'https://en.wikipedia.org/wiki/Beleaguered_Castle'
},
{
'Name':'Stronghold',
'Type':'All,Castle',
'Desc':'easier Beleaguered Castle with a free cell',
'File':'Stronghold',
'Wikipedia':'https://en.wikipedia.org/wiki/Beleaguered_Castle'
},
{
'Name':'Somerset',
'Type':'All,Klondike,Hard',
'Desc':'Klondike variant without stock or waste',
'File':'Somerset',
'Wikipedia':'https://politaire.com/help/somerset'
},
{
'Name':'Somerset Relaxed',
'Type':'All,Klondike',
'Desc':'allows sequences of cards to be moved',
'File':'SomersetRelaxed',
'Wikipedia':'https://politaire.com/help/somerset'
},
{
'Name':'Usk',
'Type':'All,Klondike,Tableau Redeal',
'Desc':'Klondike variant with one tableau reshuffle and no stock or waste',
'File':'Usk',
'Wikipedia':'https://politaire.com/help/usk'
},
{
'Name':'Breeze',
'Type':'All,Fan,Easy,Simple',
'Desc':'an easier version of Fan that allows sequences of cards to be moved',
'File':'Breeze',
'Wikipedia':''
},
{
'Name':'Fan',
'Type':'All,Fan',
'Desc':'the original fan-type game',
'File':'Fan',
'Wikipedia':'https://en.wikipedia.org/wiki/La_Belle_Lucie'
},
{
'Name':'La Belle Lucie',
'Type':'All,Fan,Tableau Redeal,Hard',
'Desc':'a classic game first published by Lady Adelaide Cadogan in 1870',
'File':'LaBelleLucie',
'Wikipedia':'https://en.wikipedia.org/wiki/La_Belle_Lucie'
},
{
'Name':'Trefoil',
'Type':'All,Fan,Tableau Redeal',
'Desc':'Fan with two tableau shuffles',
'File':'Trefoil',
'Wikipedia':'https://en.wikipedia.org/wiki/La_Belle_Lucie'
},
{
'Name':'Trefoil Relaxed',
'Type':'All,Fan,Tableau Redeal,Easy',
'Desc':'Fan with two tableau shuffles, sequences of cards can be moved together',
'File':'TrefoilRelaxed',
'Wikipedia':'https://en.wikipedia.org/wiki/La_Belle_Lucie'
},
{
'Name':'Bisley',
'Type':'All,Bisley',
'Desc':'a one-deck game where you choose on which foundation a card can be placed',
'File':'Bisley',
'Wikipedia':'https://en.wikipedia.org/wiki/Bisley_(solitaire)'
},
{
'Name':'Aces and Kings',
'Type':'All,Bisley,Two Packs',
'Desc':'build up on one foundation, down on the other, but don\'t build on the tableau',
'File':'AcesAndKings',
'Wikipedia':'https://en.wikipedia.org/wiki/Aces_and_Kings'
},
{
'Name':'Acey and Kingsley',
'Type':'All,Bisley,Two Packs',
'Desc':'an easier version of Aces and Kings',
'File':'AceyAndKingsley',
'Wikipedia':'https://en.wikipedia.org/wiki/Aces_and_Kings'
},
{
'Name':'Martha',
'Type':'All,Easy,Bisley',
'Desc':'easy game with no stock and half the cards start face down',
'File':'Martha',
'Wikipedia':'https://en.wikipedia.org/wiki/Martha_(solitaire)'
},
{
'Name':'Stewart',
'Type':'All,Bisley',
'Desc':'a harder version of Martha',
'File':'Stewart',
'Wikipedia':'https://en.wikipedia.org/wiki/Martha_(solitaire)'
},
{
'Name':'Baker\'s Dozen',
'Type':'All,Bisley,Simple',
'Desc':'so called because of the 13 columns, the number in a baker\'s dozen',
'File':'Baker\'sDozen',
'Wikipedia':'https://en.wikipedia.org/wiki/Baker%27s_Dozen_(solitaire)'
},
{
'Name':'Spanish',
'Type':'All,Easy,Simple',
'Desc':'any card can fill empty tableau spaces',
'File':'Spanish',
'Wikipedia':'https://en.wikipedia.org/wiki/Baker%27s_Dozen_(solitaire)'
},
{
'Name':'Portuguese',
'Type':'All,Simple',
'Desc':'halfway between Baker\'s Dozen and Spanish Patience',
'File':'Portuguese',
'Wikipedia':'https://en.wikipedia.org/wiki/Baker%27s_Dozen_(solitaire)'
},
{
'Name':'Castles in Spain',
'Type':'All,Bisley,Simple',
'Desc':'like Spanish Patience, but the cards are built down by alternate color',
'File':'CastlesInSpain',
'Wikipedia':'https://en.wikipedia.org/wiki/Baker%27s_Dozen_(solitaire)'
},
{
'Name':'Frog',
'Type':'All,Frog,Two Packs',
'Desc':'aka Toad',
'File':'Frog',
'Wikipedia':'https://en.wikipedia.org/wiki/Frog_(game)'
},
{
'Name':'Fly',
'Type':'All,Frog,Two Packs',
'Desc':'an easier version of Frog',
'File':'Fly',
'Wikipedia':'https://en.wikipedia.org/wiki/Frog_(game)'
},
{
'Name':'Gnat',
'Type':'All,Frog',
'Desc':'a one deck version of Fly',
'File':'Gnat',
'Wikipedia':'https://en.wikipedia.org/wiki/Frog_(game)'
},
{
'Name':'HouseFly',
'Type':'All,Frog',
'Desc':'an easier version of Gnat',
'File':'HouseFly',
'Wikipedia':'https://en.wikipedia.org/wiki/Frog_(game)'
},
{
'Name':'Grandfather\'s Clock',
'Type':'All,Clock,Easy',
'Desc':'arrange cards in the foundations like a clock',
'File':'GClock',
'Wikipedia':'https://en.wikipedia.org/wiki/Grandfather%27s_Clock'
},
{
'Name':'Osmosis',
'Type':'All,Other',
'Desc':'also known as Treasure Trove',
'File':'Osmosis',
'Wikipedia':'https://en.wikipedia.org/wiki/Osmosis_(solitaire)'
},
{
'Name':'Peek',
'Type':'All,Other',
'Desc':'Osmosis with a visible reserve',
'File':'Peek',
'Wikipedia':'https://en.wikipedia.org/wiki/Osmosis_(solitaire)'
},
{
'Name':'Busy Aces',
'Type':'All,Simple,Two Packs',
'Desc':'simple game dating from 1939',
'File':'BusyAces',
'Wikipedia':''
},
{
'Name':'Courtyard',
'Type':'All,Simple,Two Packs',
'Desc':'like Busy Aces, but empty tableau spaces are automatically filled',
'File':'Courtyard',
'Wikipedia':''
},
{
'Name':'Fortune\'s Favor',
'Type':'All,Easy,Simple',
'Desc':'like Busy Aces, but empty tableau spaces are automatically filled',
'File':'FortunesFavor',
'Wikipedia':'https://en.wikipedia.org/wiki/Fortune%27s_Favor'
},
{
'Name':'Stages',
'Type':'All,Simple,Two Packs',
'Desc':'like Busy Aces, but sequences of tableau cards can be moved',
'File':'Stages',
'Wikipedia':''
},
{
'Name':'Oddstream',
'Type':'All,Originals,Small Screen',
'Desc':'tidy the tableau as you go, or you won\'t win',
'File':'Oddstream',
'Wikipedia':''
},
{
'Name':'Oddstream K',
'Type':'All,Originals,Small Screen',
'Desc':'harder version of Oddstream',
'File':'OddstreamK',
'Wikipedia':''
},
{
'Name':'Oddstream S',
'Type':'All,Originals,Small Screen',
'Desc':'like Oddstream K, but build tableau down in suit',
'File':'OddstreamS',
'Wikipedia':''
},
{
'Name':'Flipflop One Suit',
'Type':'All,Other,Small Screen,One Suit',
'Desc':'easiest version of Flipflop by Zach Gage',
'File':'Flipflop1',
'Wikipedia':''
},
{
'Name':'Flipflop Two Suits',
'Type':'All,Other,Small Screen,Two Suits',
'Desc':'',
'File':'Flipflop2',
'Wikipedia':''
},
{
'Name':'Flipflop Four Suits',
'Type':'All,Other,Small Screen',
'Desc':'',
'File':'Flipflop4',
'Wikipedia':''
},
{
'Name':'Quick Fail',
'Type':'Debug',
'Desc':'',
'File':'QuickFail',
'Wikipedia':''
},
{
'Name':'Quick Win',
'Type':'Debug',
'Desc':'',
'File':'QuickWin',
'Wikipedia':''
}
];
// polyfills for Array.prototypefor.Each and Array.prototype.includes
/**
* @param {string} str
*/
function search(str) {
str = str.toLowerCase();
const hits = new Set();
if ( str.length ) {
Variants.forEach( v => {
if ( -1 != v.Name.toLowerCase().indexOf(str) ) {
hits.add(v);
}
});
if ( 0 === hits.size ) {
Variants.forEach( v => {
if ( -1 != v.Desc.toLowerCase().indexOf(str) ) {
hits.add(v);
}
});
}
if ( 0 === hits.size ) {
Variants.forEach( v => {
if ( -1 != v.Type.toLowerCase().indexOf(str) ) {
hits.add(v);
}
});
}
}
const res = document.getElementById('searchResults');
while ( res.firstChild ) {
res.removeChild(res.firstChild);
}
if ( hits.size ) {
const ul = peach(res, 'ul');
hits.forEach( v => {
peach(ul, 'li', null, null,
peach(res, 'a', {href:v.File + '.html'}, v.Name)
)
});
}
}
/**
* @param {InputEvent} e
*/
function searchEvent(e) {
search(e.target.value);
}
/**
*
* @param {Element} p
* @param {String} eleName
* @param {Object=} attribs
* @param {String=} text
* @param {...Element[]=} ch
* @returns {Element}
* or use https://github.com/KoryNunn/crel
*/
function peach(p, eleName, attribs, text, ...ch) {
const ele = document.createElement(eleName);
if ( attribs ) for ( let a in attribs ) {
ele.setAttribute(a, attribs[a]);
}
if ( text ) ele.innerHTML = text;
if ( ch ) ch.forEach( c => ele.appendChild(c) );
if ( p ) p.appendChild(ele);
return ele;
}
const types = [];
Variants.forEach( function(v) {
v.Type.split(',').forEach( function(t) {
if ( !types.includes(t) )
types.push(t);
});
});
types.sort();
const ulOuter = peach(document.getElementById('content'), 'ul', {class:'collapsible'});
for ( let i=0; i<types.length; i++ ) {
const liOuter = peach(ulOuter, 'li', null, null,
peach(null, 'div', {class:'collapsible-header', id:`ch${i}`}, null,
peach(null, 'h6', null, types[i])
));
const cb = peach(liOuter, 'div', {class:'collapsible-body', id:`cb${i}`});
const ulInner = peach(cb, 'ul');
const ty = Variants.filter( function(v) {
return v.Type.split(',').includes(types[i]);
});
ty.sort(function(a, b) { return a.Name.localeCompare(b.Name); });
ty.forEach( function(t) {
const listItem = peach(ulInner, 'li');
const a = peach(listItem, 'a', {href:t.File + '.html'}, null,
peach(null, 'strong', null, t.Name)
);
if ( window.innerWidth > 640 ) {
peach(listItem, 'span', {class:'right'}, t.Desc);
}
});
}
// could use M.AutoInit(document.body)
// (which uses document.body if no context is given)
// instead just init the bits we are using
M.Collapsible.init(document.querySelectorAll('.collapsible'));
M.Modal.init(document.querySelectorAll('.modal'));
M.Tooltip.init(document.querySelectorAll('.tooltipped'));
document.getElementById('searchText').oninput = searchEvent;
document.getElementById('modalLoadSavedDiv').style.display = window.location.protocol === 'file:' ? '' : 'none';
const LOCALSTORAGE_SETTINGS = 'Oddstream Solitaire Settings';
const LOCALSTORAGE_GAMES = 'Oddstream Solitaire Games';
const DROPBOX_GAMES = '/gameState.json';
const settings = JSON.parse(localStorage.getItem(LOCALSTORAGE_SETTINGS)) || {};
const collapsibleFn = M.Collapsible.getInstance(ulOuter);
collapsibleFn.options.onOpenEnd = function() {
const h6 = document.querySelector('body>div#content>ul.collapsible>li.active>div>h6');
if ( h6 ) {
settings.activeType = h6.innerHTML;
} else {
delete settings.activeType;
}
}
const modalSearchFn = M.Modal.getInstance(document.getElementById('modalSearch'));
modalSearchFn.options.onOpenStart = function() {
const ele = /** @type {HTMLInputElement} */(document.getElementById("searchText"));
ele.value = '';
ele.focus();
}
const modalCloudFn = M.Modal.getInstance(document.getElementById('modalCloud'));
modalCloudFn.options.onOpenStart = function() {
const HIDE_CLASS = 'hide';
if ( settings.dropboxAccessToken && settings.dropboxAccessToken.length ) {
document.getElementById('dropboxAccessToken').value = settings.dropboxAccessToken;
document.getElementById('modalCloudAuto').checked = !!settings.autoCloudSync; // might be undefined
document.getElementById('modalLoadSaved').checked = !!settings.loadSaved; // might be undefined
document.getElementById('modalCloudConnected').classList.remove(HIDE_CLASS);
document.getElementById('modalCloudNotConnected').classList.add(HIDE_CLASS);
} else {
document.getElementById('modalCloudConnected').classList.add(HIDE_CLASS);
document.getElementById('modalCloudNotConnected').classList.remove(HIDE_CLASS);
const btn = document.getElementById('btnAuthenticate');
try {
const dbx = new Dropbox.Dropbox({fetch: window.fetch.bind(window), clientId: 'gpmr1d1u1j4h2d4'});
// window.location.origin = 'http://localhost'
// window.location.pathname = '/solitaire/index.html'
const redirect = window.location.origin + window.location.pathname;
// console.log(redirect);
btn.href = dbx.getAuthenticationUrl(redirect);
} catch(err) {
M.toast({html:'cannot connect to Dropbox'});
console.error(err);
}
}
};
modalCloudFn.options.onCloseEnd = function() {
getAccessTokenFromModal();