-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.html
More file actions
1327 lines (1255 loc) · 58.1 KB
/
index.html
File metadata and controls
1327 lines (1255 loc) · 58.1 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-110953195-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-110953195-1');
</script>
<title>Cribbage Classic | Play online in your browser for free!</title>
<meta charset="utf-8">
<meta name="description" content="Play cribbage online with this website. This is the best free cribbage game online. Cribbage Classic has a number of settings that can help you to learn the best move for your situation and offer assistance if it notices that you are making a sub-optimal play. Or just play in fast mode where all counting is done for you and you get to simply focus on discarding and pegging. By tweaking the settings you can take this app anywhere from a lazy-thoughtless-time-waster game to a skill-sharpening-master-tutorial helping you to crush your next opponent. Statistics are also kept so you can see your average pegging score, your average hand score, and your average crib score! Also shows you a summary of all of the sub-optimal plays you made at the end of the game and tracks your error rate over time so you can see yourself improving. Cribbage Classic also has a Discard Analyzer bonus feature that can help you decide on the optimal discard to play given a particular cribbage hand. Analyzer shows you the minimum, maximum, and average score for each permutation along with an in-depth statistical analysis of all possible flip card results. The site is built with HTML CSS and Javascript">
<meta name="author" content="Cribbage Classic">
<link rel="stylesheet" href="menus.css">
<link rel="stylesheet" href="cards.css">
<link rel="stylesheet" href="scoreboard.css">
<link rel="stylesheet" href="game.css">
<script>
//
// Initialize
//
var game = null;
window.onload = function () {
if (redirectToAppStore()) {
return;
}
UpdateBackgroundImageFromSettings();
setTimeout(function () {
ShowMainMenu();
ShowTitle();
}, 500);
game = new Game();
};
</script>
<script type="text/javascript" src="menus.js"></script>
<script type="text/javascript" src="settings.js"></script>
<script type="text/javascript" src="game.js"></script>
<script type="text/javascript" src="scoreboard.js"></script>
<script type="text/javascript" src="computerPlayer.js"></script>
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.0/cookieconsent.min.css" />
<script src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.0/cookieconsent.min.js"></script>
<script>
window.addEventListener("load", function(){
window.cookieconsent.initialise({
"palette": {
"popup": {
"background": "#252e39"
},
"button": {
"background": "#14a7d0"
}
},
"theme": "edgeless",
"position": "bottom-right",
"content": {
"message": "This site uses cookies to analyze traffic and for ad personalization and ad measurement purposes.",
"dismiss": "OK",
"link": "Learn more",
"href": "https://policies.google.com/technologies/cookies"
}
})});
</script>
</head>
<body onresize="game.OnResizeWindow()">
<div id="cribbage_title">
<center>
<div class="t1">CRIBBAGE</div>
<div class="t2">CLASSIC</div>
</center>
</div>
<div id="below_cards_messages_region">
<div id="select_low_card_message">Click on a card. Lowest card gets the first crib.</div>
<div id="low_card_you_text" class="low_card_text">You</div>
<div id="low_card_computer_text" class="low_card_text">Opponent</div>
<div id="pegging_prompt">Drop a
<br>card here</div>
<div id="manual_prompt">Click on cards to start counting your points</div>
<button id="hint_button" onclick="game.OnHintButtonClick()">Hint</button>
<div id="crib_region">
<div id="crib_region_top_left_side" class="crib_region_border"></div>
<div id="crib_region_top_left_top" class="crib_region_border"></div>
<div id="crib_region_top_right_top" class="crib_region_border"></div>
<div id="crib_region_top_right_side" class="crib_region_border"></div>
<div id="crib_region_bottom_right_side" class="crib_region_border"></div>
<div id="crib_region_bottom_right_bottom" class="crib_region_border"></div>
<div id="crib_region_bottom_left_bottom" class="crib_region_border"></div>
<div id="crib_region_bottom_left_side" class="crib_region_border"></div>
<div id="crib_region_center_text">Opponent's Crib</div>
<div id="crib_region_prompt">Drop 2 cards here</div>
</div>
<div id="confirm_crib_region">
<div id="confirm_crib_region_shadow"></div>
<button id="confirm_crib_button" onclick="game.cribCardsConfirmed()">Confirm Crib Cards</button>
</div>
</div>
<div id="scoreboard">
<div id="scoreboard_pegs">
<div id="skunk_line_vertical"></div>
<div id="skunk_line_horizontal"></div>
<div id="scoreboard_leftColumn">
</div>
<div id="scoreboard_topRow">
</div>
<div id="scoreboard_rightColumn">
</div>
<div id="scoreboard_pegs_score_view">
<table>
<tr>
<td id="scoreboard_pegs_crib_indicator_group" rowspan="2">
<div id="scoreboard_pegs_score_crib_indicator">CRIB</div>
<div id="scoreboard_pegs_score_crib_arrow">
<div class="arrow-right-shadow"></div>
<div class="arrow-right"></div>
</div>
</td>
<td>
<div id="scoreboard_pegs_score_you_text">YOU</div>
</td>
<td>
<div>
<img src="images/PegBlue.png" ondragstart="return false;" />
</div>
</td>
<td>
<div id="scoreboard_pegs_score_you_points_container">
<div id="scoreboard_pegs_score_you_points">0</div>
</div>
</td>
</tr>
<tr>
<td>
<div id="scoreboard_pegs_score_opp_text">OPP</div>
</td>
<td>
<div style="overflow: visible; height:0px;">
<img src="images/PegRed.png" style="transform: translate(0px,-25px);" ondragstart="return false;" />
</div>
</td>
<td>
<div id="scoreboard_pegs_score_opp_points_container">
<div id="scoreboard_pegs_score_opp_points">0</div>
</div>
</td>
</tr>
</table>
</div>
<img id="scoreboard_pegs_redpeg_1" class="scoreboard_pegs_peg" src="images/PegRed.png" ondragstart="return false;" />
<img id="scoreboard_pegs_redpeg_2" class="scoreboard_pegs_peg" src="images/PegRed.png" ondragstart="return false;" />
<img id="scoreboard_pegs_bluepeg_1" class="scoreboard_pegs_peg" src="images/PegBlue.png" ondragstart="return false;" />
<img id="scoreboard_pegs_bluepeg_2" class="scoreboard_pegs_peg" src="images/PegBlue.png" ondragstart="return false;" />
</div>
<div id="scoreboard_compact">
<div id="scoreboard_compact_crib_indicator">
<div id="scoreboard_compact_crib_indicator_group">
<div id="scoreboard_compact_score_crib_indicator">CRIB</div>
<div id="scoreboard_compact_score_crib_arrow">
<div class="arrow-down-shadow"></div>
<div class="arrow-down"></div>
</div>
</div>
</div>
<div id="scoreboard_compact_you_text">YOU</div>
<div id="scoreboard_compact_you_left_nib_shadow"></div>
<div id="scoreboard_compact_you_back_bar_shadow"></div>
<div id="scoreboard_compact_you_right_nib_shadow"></div>
<div id="scoreboard_compact_you_left_nib"></div>
<div id="scoreboard_compact_you_back_bar"></div>
<div id="scoreboard_compact_you_right_nib"></div>
<div id="scoreboard_compact_you_fill_bar"></div>
<img id="scoreboard_compact_you_peg" src="images/PegBlue.png" ondragstart="return false;" />
<div id="scoreboard_compact_you_score_container">
<div id="scoreboard_compact_you_score">0</div>
</div>
<div id="scoreboard_compact_opp_text">STND</div>
<div id="scoreboard_compact_opp_left_nib_shadow"></div>
<div id="scoreboard_compact_opp_back_bar_shadow"></div>
<div id="scoreboard_compact_opp_right_nib_shadow"></div>
<div id="scoreboard_compact_opp_left_nib"></div>
<div id="scoreboard_compact_opp_back_bar"></div>
<div id="scoreboard_compact_opp_right_nib"></div>
<div id="scoreboard_compact_opp_fill_bar"></div>
<img id="scoreboard_compact_opp_peg" src="images/PegRed.png" ondragstart="return false;" />
<div id="scoreboard_compact_opp_score_container">
<div id="scoreboard_compact_opp_score">0</div>
</div>
</div>
</div>
<div id="cards_region">
<div id="crib_indicator_card_overlap">
<table style="width: 114px; margin-top: 5px;">
<tr>
<td id="crib_indicator_card_overlap_text">Your</td>
</tr>
<tr>
<td>Crib</td>
</tr>
</table>
</div>
<div id="PeggingCountIndicator">
<div id="PeggingCountCardShadow"></div>
<div id="PeggingCountCard">
<table style="width: 114px; margin-top: 5px;">
<tr>
<td>
<div>Pegging Count:</div>
</td>
</tr>
<tr>
<td>
<div id="PeggingCountIndicatorScore">14</div>
</td>
</tr>
</table>
</div>
</div>
</div>
<button id="get_more_games_button" onclick="PlayMoreGamesButtonPressed()">
Play More<br>Card Classics
</button>
<div id="adView" align="center">
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-2857597813964310"
data-ad-slot="1564710492"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
<div id="low_card_result_message">
<div id="low_card_result_text">You drew the lower card!
<br>You get the first crib.</div>
<center>
<button id="low_card_selected_accept_button" onclick="game.lowCardAcceptClick()">OK</button>
</center>
</div>
<div id="no_hint_view">
<div id="no_hint_view_shadow"></div>
<div id="no_hint_view_card">
<table style="width: 200px;">
<tr>
<td>
<div>No optimal play detected.</div>
</td>
</tr>
<tr>
<td>
<div>Go with your gut!</div>
</td>
</tr>
<tr>
<td>
<button id="no_hint_view_button" onclick="game.OnNoHintAcceptedClick()">OK</button>
</td>
</tr>
</table>
</div>
</div>
<div id="computer_says_go">
<div id="computer_says_go_shadow"></div>
<div id="computer_says_go_card">
<table style="width: 114px;">
<tr>
<td>
<div>Computer says</div>
</td>
</tr>
<tr>
<td>
<div id="computer_says_go_text">'GO'</div>
</td>
</tr>
</table>
</div>
</div>
<div id="player_says_go">
<div id="player_says_go_shadow"></div>
<div id="player_says_go_card">
<table style="width: 114px;">
<tr>
<td>
<div>You must say</div>
</td>
</tr>
<tr>
<td>
<button id="player_says_go_button" onclick="game.OnUserSaysGoClick()">GO</button>
</td>
</tr>
</table>
</div>
</div>
<div id="allcounted">
<table style="width: 114px;">
<tr>
<td>
<div>All points are already counted.</div>
</td>
</tr>
<tr>
<td>
<button id="allcountedOKButton" onclick="game.OnAllCountedOKClick()">OK</button>
</td>
</tr>
</table>
</div>
<div id="HandScoreView">
<div id="HandScoreTitle">Opponent hand:</div>
<div id="HandScoreBubble">
<div id="HandScoreBubbleGlare"></div>
<div id="HandScoreBubbleBottomGlare"></div>
<div id="HandScoreBubblePoints">1</div>
<div id="HandScoreBubblePointsLabel">points</div>
</div>
<div id="HandScorePointsDescription">Run of 3 for 3</div>
<button id="HandScoreAcceptButton" onclick="game.OnAcceptHandScoreClick()">OK</button>
</div>
<div id="RecountHandsView">
<button id="RecountHandsButton" onclick="game.OnRecountButtonClick()">
<img id="RecountHandsButtonImage" src="images/RefreshButton.png" ondragstart="return false;" />
</button>
<div id="RecountHandsText">Reshow
<br>count</div>
</div>
<div id="ManualCount">
<div id="HandScoreBubble">
<div id="HandScoreBubbleGlare"></div>
<div id="HandScoreBubbleBottomGlare"></div>
<div id="ManualScoreBubblePoints">0</div>
<div id="HandScoreBubblePointsLabel">points</div>
</div>
<button id="ManualCountAcceptButton" onclick="game.OnManualCountAcceptClick()">Click here when<br>finished counting</button>
<div id="ManualPointsDesc"></div>
<button id="ManualPointConfirmButton" onclick="game.OnManualPointConfirmClick()">Click here to add:<br>15 for 2</button>
</div>
<div id="SuboptimalWarning">
<div id="SuboptimalWarningTitle">That is not the
<br>optimal discard</div>
<div id="SuboptimalWarningTextRegion">
<div id="SuboptimalWarningText">Your discards will result in an average round score of 0.0
<br>
<br>A better play exists that would result in an average score of 0.0</div>
</div>
<button class="SuboptimalWarningButton" onclick="game.SuboptimalWarningTryAgainClick()">OK, let me try again</button>
<button class="SuboptimalWarningButton" onclick="game.SuboptimalWarningShowAllScoresClick()" id="SuboptimalWarningShowAllScoresButton">Show scores for all plays</button>
<button class="SuboptimalWarningButton" onclick="game.SuboptimalWarningHintClick()">Give me a hint</button>
<button class="SuboptimalWarningButton" onclick="game.SuboptimalWarningPlayAnywaysClick()" id="SuboptimalWarningPlayAnywaysButton">Play these cards anyways</button>
</div>
<div id="GameOverView">
<div id="GameOverResultText">You win!</div>
<div id="GameOverSkunkText">Skunk!</div>
<button id="game_over_close_button" class="close_button" onclick="GameOverClosedClick()">X</button>
<table id="GameOverResultsTable">
<tr>
<td></td>
<td style="width:100px">You</td>
<td style="width:100px">Opponent</td>
</tr>
<tr>
<td>Total score:</td>
<td colspan="2" style="position: absolute; width:200px; height:25px;">
<div class="GameOverViewTableResultBackgroundFill"></div>
<div id="GameOverTotalFill" class="GameoverViewTableResultComputerFill"></div>
<div id="GameOverTotalScoreYou" class="GameOverViewTableResultYouScore" style="font-weight:bold; font-size:16pt;">107</div>
<div id="GameOverTotalScoreOpp" class="GameOverViewTableResultOppScore" style="font-weight:bold; font-size:16pt;">128</div>
</td>
</tr>
<tr>
<td>Pegging:</td>
<td colspan="2" style="position: absolute; width:200px; height:25px;">
<div class="GameOverViewTableResultBackgroundFill"></div>
<div id="GameOverPeggingFill" class="GameoverViewTableResultComputerFill"></div>
<div id="GameOverPeggingYou" class="GameOverViewTableResultYouScore">107</div>
<div id="GameOverPeggingOpp" class="GameOverViewTableResultOppScore">128</div>
</td>
</tr>
<tr>
<td>Hands:</td>
<td colspan="2" style="position: absolute; width:200px; height:25px;">
<div class="GameOverViewTableResultBackgroundFill"></div>
<div id="GameOverHandsFill" class="GameoverViewTableResultComputerFill"></div>
<div id="GameOverHandsYou" class="GameOverViewTableResultYouScore">107</div>
<div id="GameOverHandsOpp" class="GameOverViewTableResultOppScore">128</div>
</td>
</tr>
<tr>
<td>Cribs:</td>
<td colspan="2" style="position: absolute; width:200px; height:25px;">
<div class="GameOverViewTableResultBackgroundFill"></div>
<div id="GameOverCribsFill" class="GameoverViewTableResultComputerFill"></div>
<div id="GameOverCribsYou" class="GameOverViewTableResultYouScore">107</div>
<div id="GameOverCribsOpp" class="GameOverViewTableResultOppScore">128</div>
</td>
</tr>
</table>
<button id="GameOverSuboptimalButton" onclick="ShowSuboptimalHistoryButtonClick()">You made 6 suboptimal plays this game for a cummultaive error of 10.1 points.</button>
<div id="GameOverSuboptimalPlaysView"></div>
</div>
<div id="GameOverSuboptimalHeaderTemplate" class="GameOverSuboptimalHeader">Sub-Optimal Discard Plays</div>
<div id="GameOverSuboptimalDiscardTemplate" class="GameOverSuboptimalDiscard" onclick="ShowAllPlaysForSuboptimalPlayView(this)">
<div class="suboptimalSituation">Hand dealt - Opp. crib</div>
<div class="tinycard" id="subTiny1" style="left:0px; margin-top:18px;"></div>
<div class="tinycard" id="subTiny2" style="left:22px; margin-top:18px;"></div>
<div class="tinycard" id="subTiny3" style="left:44px; margin-top:18px;"></div>
<div class="tinycard" id="subTiny4" style="left:66px; margin-top:18px;"></div>
<div class="tinycard" id="subTiny5" style="left:88px; margin-top:18px;"></div>
<div class="tinycard" id="subTiny6" style="left:110px; margin-top:18px;"></div>
<div class="suboptimalYouPlayed">You played</div>
<div class="tinycard" id="subTiny7" style="left:145px; margin-top:18px;"></div>
<div class="tinycard" id="subTiny8" style="left:167px; margin-top:18px;"></div>
<div class="suboptimalPlayedLine1">avg</div>
<div class="suboptimalPlayedLine2">1.9</div>
<div class="suboptimalPlayedLine3">points</div>
<div class="suboptimalOptimalPlay">Optimal play</div>
<div class="tinycard" id="subTiny9" style="left:240px; margin-top:18px;"></div>
<div class="tinycard" id="subTiny10" style="left:262px; margin-top:18px;"></div>
<div class="suboptimalOptimalLine1">avg</div>
<div class="suboptimalOptimalLine2">1.9</div>
<div class="suboptimalOptimalLine3">points</div>
<div class="suboptimalDivider"></div>
</div>
<div id="BubbleScorePlayerTemplate" class="BubbleScorePlayer">
<div class="BubbleScoreGlare"></div>
<div class="BubbleScoreBottomGlare"></div>
<table style="width: 100px; margin-top: 5px;">
<tr>
<td class="BubbleScoreDescription">Run of 4 for</td>
</tr>
<tr>
<td class="BubbleScorePoints">29</td>
</tr>
<tr>
<td class="BubbleScorePointsLabel">points</td>
</tr>
</table>
</div>
<button id="menu_button" onclick="MenuButtonPressed()">
<img src="images/MenuButton.png" ondragstart="return false;" />
</button>
<div id="menu_main" class="menu_view">
<button id="menu_main_close_button" class="close_button" onclick="menu_main_close_click()">X</button>
<button id="start_game_button" class="menu_button" onclick="ShowStartAGameMenu()">Start A Game</button>
<button id="settings_button" class="menu_button" onclick="ShowSettingsMenu()">Settings</button>
<button id="statistics_button" class="menu_button" onclick="ShowStatisticsMenu()">Statistics</button>
<button id="discard_analyzer_button" class="menu_button" onclick="ShowDiscardAnalyzer()">Discard Analyzer</button>
<button id="tutorial_button" class="menu_button" onclick="ShowTutorialMenu()">Tutorial</button>
</div>
<div id="menu_start_a_game" class="menu_view">
<div id="menu_start_a_game_title" class="menu_card_title">Choose a difficulty level:</div>
<button id="menu_start_a_game_close_button" class="close_button" onclick="menu_card_close_click()">X</button>
<button id="easy_game_button" class="menu_button" onclick="menu_start_game_click('Easy')">Easy</button>
<button id="standard_game_button" class="menu_button" onclick="menu_start_game_click('Standard')">Standard</button>
<button id="pro_game_button" class="menu_button" onclick="menu_start_game_click('Pro')">Pro</button>
<div style="text-align:center;font-size:12pt; pointer-events: none;">Cards are dealt randomly for all difficulty levels.</div>
<a id="menu_start_a_game_difficulties_link" onclick="ShowDifficultiesExplainedMenu()" href="#">Click here to learn how difficulties work</a>
</div>
<div id="menu_difficulties_explained" class="menu_view">
<div id="menu_difficulties_explained_title" class="menu_card_title">Computer Difficulty Levels Explained</div>
<button id="menu_difficulties_explained_close_button" class="close_button" onclick="menu_card_close_click()">X</button>
<div id="menu_difficulties_explained_body">
For all three difficulty levels the cards are dealt completely at random to both you and to the computer. The difference
between the easy, standard and pro levels is the strategy used to choose the computer's discards and pegging plays. If
you are finding that your computer opponent is beating you, you will likely benefit from understanding how the computer
chooses its next move.
<br>
<br>
<center>
<div style="font-size:16pt">
<u>Easy Computer Strategy</u>
</div>
</center>
<table style="width:100%; text-align:left; font-size:12pt;">
<tr>
<td valign="top" width="80pt">Discarding:</td>
<td>Chooses a random pair of cards.</td>
</tr>
<tr>
<td valign="top" width="80pt">Pegging:</td>
<td>Chooses a random valid card.</td>
</tr>
</table>
<br>
<center>
<div style="font-size:16pt">
<u>Standard Computer Strategy</u>
</div>
</center>
<table style="width:100%; text-align:left; font-size:12pt;">
<tr>
<td valign="top" width="80pt">Discarding:</td>
<td>Chooses the pair of cards that will result in the best hand score ignoring the possible flip card. If the discards are
a pair or sum to 15, it adjusts the analyzed hand value by 2 (plus or minus depending on the crib owner.) Notice that
this strategy does not account for flushes or possible runs that could result from the flip card.</td>
</tr>
<tr>
<td valign="top" width="80pt">Pegging:</td>
<td>Chooses the next card that will result in the highest score for itself. If all plays are of equal value then it chooses
at random.</td>
</tr>
</table>
<br>
<center>
<div style="font-size:16pt">
<u>Pro Computer Strategy</u>
</div>
</center>
<table style="width:100%; text-align:left; font-size:12pt;">
<tr>
<td valign="top" width="80pt">Discarding:</td>
<td>Evaluates the score for each pair of discards for all possible flip cards still left in the deck. Then takes the play
that averages the highest outcome. For the cards in the crib, evaluates their value as well with each possible flip
card and adds or subtracts depending on who will count the crib. Note that the potential from the two additional crib
cards are not included in the crib analysis.</td>
</tr>
<tr>
<td valign="top" width="80pt">Pegging:</td>
<td>Chooses the next card that will result in the highest score for itself. It also prefers not to leave the pegging count
at 5 or 21. If all plays are of equal value then it chooses at random.</td>
</tr>
</table>
</div>
</div>
<div id="menu_settings" class="menu_view">
<div id="menu_settings_title" class="menu_card_title">Settings</div>
<button id="menu_settings_close_button" class="close_button" onclick="menu_card_close_click()">X</button>
<table style="margin-left:5%; width:95%; margin-top:55pt; margin-bottom: 10px; text-align:left; font-size:16pt;">
<tr>
<td>Manually count scores:</td>
<td>
<label class="switch">
<input id="setting_manually_count_scores_checkbox" type="checkbox" onclick="SettingManuallyCountScoresClicked(this)">
<span class="slider round"></span>
</label>
</td>
</tr>
<tr>
<td>Muggins:</td>
<td>
<label class="switch">
<input id="setting_muggins_checkbox" type="checkbox" onclick="SettingMugginsClicked(this)">
<span class="slider round"></span>
</label>
</td>
</tr>
<tr>
<td>Hint button on all levels:</td>
<td>
<label class="switch">
<input id="setting_hints_checkbox" type="checkbox" onclick="SettingHintsClicked(this)">
<span class="slider round"></span>
</label>
</td>
</tr>
<tr>
<td>Warn of suboptimal plays:</td>
<td>
<label class="switch">
<input id="setting_warn_suboptimal_checkbox" type="checkbox" onclick="SettingWarnSuboptimalClicked(this)">
<span class="slider round"></span>
</label>
</td>
</tr>
<tr>
<td>Fast counting:</td>
<td>
<label class="switch">
<input id="setting_fast_count_checkbox" type="checkbox" onclick="SettingFastCountClicked(this)">
<span class="slider round"></span>
</label>
</td>
</tr>
</table>
<div style="margin-left:5%; width:95%; text-align:left; font-size:16pt;">Board Background:</div>
<div class="image-selector">
<input id="wood_light" type="radio" name="settings_boardbackground_selector" value="wood_light" onclick="BoardSelectorClick(this)"
/>
<label class="board-selector-item background_wood_light" for="wood_light"></label>
<input id="wood" type="radio" name="settings_boardbackground_selector" value="wood" onclick="BoardSelectorClick(this)" />
<label class="board-selector-item background_wood" for="wood"></label>
<input id="wood_dark" type="radio" name="settings_boardbackground_selector" value="wood_dark" onclick="BoardSelectorClick(this)"
/>
<label class="board-selector-item background_wood_dark" for="wood_dark"></label>
<input id="wood_gray" type="radio" name="settings_boardbackground_selector" value="wood_gray" onclick="BoardSelectorClick(this)"
/>
<label class="board-selector-item background_wood_gray" for="wood_gray"></label>
<input id="green" type="radio" name="settings_boardbackground_selector" value="green" onclick="BoardSelectorClick(this)"
/>
<label class="board-selector-item background_green" for="green"></label>
<input id="red" type="radio" name="settings_boardbackground_selector" value="red" onclick="BoardSelectorClick(this)" />
<label class="board-selector-item background_red" for="red"></label>
<input id="blue" type="radio" name="settings_boardbackground_selector" value="blue" onclick="BoardSelectorClick(this)" />
<label class="board-selector-item background_blue" for="blue"></label>
</div>
<div style="margin-left:5%; width:95%; text-align:left; font-size:16pt;">Card Color:</div>
<div class="image-selector">
<input id="card_blue" type="radio" name="settings_card_color_selector" value="blue" onclick="CardSelectorClick(this)" />
<label class="card-selector-item card_back_blue" for="card_blue"></label>
<input id="card_red" type="radio" name="settings_card_color_selector" value="red" onclick="CardSelectorClick(this)" />
<label class="card-selector-item card_back_red" for="card_red"></label>
<input id="card_green" type="radio" name="settings_card_color_selector" value="green" onclick="CardSelectorClick(this)" />
<label class="card-selector-item card_back_green" for="card_green"></label>
</div>
</div>
<div id="menu_statistics" class="menu_view">
<div id="menu_statistics_title" class="menu_card_title">Statistics</div>
<button id="menu_statistics_close_button" class="close_button" onclick="menu_card_close_click()">X</button>
<table id="menu_statistics_table">
<tr>
<td></td>
<td class="menu_statistics_table_stat">Easy</td>
<td class="menu_statistics_table_stat">Standard</td>
<td class="menu_statistics_table_stat">Pro</td>
<td class="menu_statistics_table_stat_total">Total</td>
</tr>
<tr>
<td class="menu_statistics_table_category">Games Played</td>
<td class="menu_statistics_table_stat" id="menu_stat_games_played_Easy"></td>
<td class="menu_statistics_table_stat" id="menu_stat_games_played_Standard"></td>
<td class="menu_statistics_table_stat" id="menu_stat_games_played_Pro"></td>
<td class="menu_statistics_table_stat_total" id="menu_stat_games_played_Total">0</td>
</tr>
<tr>
<td class="menu_statistics_table_category">Wins</td>
<td class="menu_statistics_table_stat" id="menu_stat_wins_Easy"></td>
<td class="menu_statistics_table_stat" id="menu_stat_wins_Standard"></td>
<td class="menu_statistics_table_stat" id="menu_stat_wins_Pro"></td>
<td class="menu_statistics_table_stat_total" id="menu_stat_wins_Total">0</td>
</tr>
<tr>
<td class="menu_statistics_table_category">Losses</td>
<td class="menu_statistics_table_stat" id="menu_stat_losses_Easy"></td>
<td class="menu_statistics_table_stat" id="menu_stat_losses_Standard"></td>
<td class="menu_statistics_table_stat" id="menu_stat_losses_Pro"></td>
<td class="menu_statistics_table_stat_total" id="menu_stat_losses_Total">0</td>
</tr>
<tr>
<td class="menu_statistics_table_category">Skunk Wins</td>
<td class="menu_statistics_table_stat" id="menu_stat_skunks_Easy"></td>
<td class="menu_statistics_table_stat" id="menu_stat_skunks_Standard"></td>
<td class="menu_statistics_table_stat" id="menu_stat_skunks_Pro"></td>
<td class="menu_statistics_table_stat_total" id="menu_stat_skunks_Total">0</td>
</tr>
<tr>
<td class="menu_statistics_table_category">Win Percentage</td>
<td class="menu_statistics_table_stat" id="menu_stat_win_percent_Easy"></td>
<td class="menu_statistics_table_stat" id="menu_stat_win_percent_Standard"></td>
<td class="menu_statistics_table_stat" id="menu_stat_win_percent_Pro"></td>
<td class="menu_statistics_table_stat_total" id="menu_stat_win_percent_Total"></td>
</tr>
<tr>
<td class="menu_statistics_table_category">Avg Pegging Score</td>
<td class="menu_statistics_table_stat" id="menu_stat_pegging_Easy"></td>
<td class="menu_statistics_table_stat" id="menu_stat_pegging_Standard"></td>
<td class="menu_statistics_table_stat" id="menu_stat_pegging_Pro"></td>
<td class="menu_statistics_table_stat_total" id="menu_stat_pegging_Total">0</td>
</tr>
<tr>
<td class="menu_statistics_table_category">Avg Hand Score</td>
<td class="menu_statistics_table_stat" id="menu_stat_hands_Easy"></td>
<td class="menu_statistics_table_stat" id="menu_stat_hands_Standard"></td>
<td class="menu_statistics_table_stat" id="menu_stat_hands_Pro"></td>
<td class="menu_statistics_table_stat_total" id="menu_stat_hands_Total">0</td>
</tr>
<tr>
<td class="menu_statistics_table_category">Avg Crib Score</td>
<td class="menu_statistics_table_stat" id="menu_stat_cribs_Easy"></td>
<td class="menu_statistics_table_stat" id="menu_stat_cribs_Standard"></td>
<td class="menu_statistics_table_stat" id="menu_stat_cribs_Pro"></td>
<td class="menu_statistics_table_stat_total" id="menu_stat_cribs_Total">0</td>
</tr>
</table>
<table id="menu_statistics_buttons_table">
<tr>
<td>
<center>
<button id="menu_statistics_reset_button" onclick="ResetStatisticsButtonClick()">Reset
<br>Statistics</button>
</center>
</td>
<td>
<center>
<button id="menu_statistics_suboptimal_history_button" onclick="ShowSuboptimalHistoryButtonClick()">Suboptimal
<br>Play History
</button>
</center>
</td>
</tr>
</table>
</div>
<div id="menu_tutorial" class="menu_view">
<div id="menu_tutorial_title" class="menu_card_title">Tutorial</div>
<button id="menu_tutorial_close_button" class="close_button" onclick="menu_card_close_click()">X</button>
<div id="mtContainer">
<div id="mtPager">
<div class="mtp" id="mt0">
<center>
<div>Page 1 of 7</div>
<div style="margin-top:30px">Cribbage is a simple two person card game.</div>
<img src='images/Card_Club_Jack.jpg' style="width:57px; border-radius:3.5px; margin-top:10px;"/>
<img src='images/Card_Heart_Jack.jpg' style="width:57px; border-radius:3.5px;"/>
<img src='images/Card_Spade_Jack.jpg' style="width:57px; border-radius:3.5px;"/>
<img src='images/Card_Diamond_Jack.jpg' style="width:57px; border-radius:3.5px;"/>
<div style="margin-left:30px; margin-right:30px; margin-top:20px; text-align:left;">The game involves scoring points by playing and grouping cards into pairs, runs, and combinations of cards that sum to fifteen.<br><br>To use this tutorial, click on the arrows on the side of this panel.</div>
</center>
</div>
<div class="mtp" id="mt1">
<center>
<div>Page 2 of 7</div>
<div style="margin-top:10px; margin-left:40px; margin-right:40px; margin-bottom:20px; text-align:left;">The winner of a game is the first person to score 121 points.<br><br>We keep track of the score using pegs. Your peg is blue and the computer is red.</div>
<div style="background: url('images/woodboard.jpg'); width: 200px; height: 50px; position:absolute; left: 100px; ">
<img style="position:absolute; left: 10px; top: 13px;" src="images/scoreboard_pegholes_horizontal.png"/>
<img style="position:absolute; left: 100px; top: 13px;" src="images/scoreboard_pegholes_horizontal.png"/>
<img style="position:absolute; left: 0px; top: -10px;" src="images/PegBlue.png"/>
<img style="position:absolute; left: 48px; top: -10px;" src="images/PegBlue.png"/>
<img style="position:absolute; left: 0px; top: 5px;" src="images/PegRed.png"/>
<img style="position:absolute; left: 90px; top: 5px;" src="images/PegRed.png"/>
</div>
<div style="margin-top:90px; margin-left:40px; margin-right:40px; margin-bottom:20px; text-align:left;">Each time you score points, your back peg will move ahead of your front peg. There are 120 peg holes for each player so the first to get to the end of the path wins.</div>
</center>
</div>
<div class="mtp" id="mt2">
<center>
<div>Page 3 of 7</div>
<div style="margin-top:30px; margin-left:40px; margin-right:40px; margin-bottom:20px; text-align:left;">
Cribbage is played in rounds and each round consists of four stages:
<ol>
<li>Discarding into the crib</li>
<li>Pegging</li>
<li>Counting points in hand</li>
<li>Counting points in the crib</li>
</ol>
</div>
</center>
</div>
<div class="mtp" id="mt3">
<center>
<div>Page 4 of 7</div>
<div>Discarding</div>
<div style="font-size:11pt; margin-top:3px; margin-left:40px; margin-right:40px; margin-bottom:3px; text-align:left;">
At the beginning of the round, each player is dealt six cards and must choose two cards to discard into the crib.
</div>
<div style="background: url('images/woodboard.jpg'); width: 280px; height: 150px; position:absolute; left: 60px; ">
<img style="position:absolute; left: 10px; top: 3px; width:45px; border-radius:3px;" src="images/card_back_blue.jpg"/>
<img style="position:absolute; left: 50px; top: 80px; width:45px; border-radius:3px;" src="images/Card_Spade_2.jpg"/>
<img style="position:absolute; left: 80px; top: 80px; width:45px; border-radius:3px;" src="images/Card_Diamond_3.jpg"/>
<img style="position:absolute; left: 120px; top: 80px; width:45px; border-radius:3px;" src="images/Card_Heart_Jack.jpg"/>
<img style="position:absolute; left: 150px; top: 80px; width:45px; border-radius:3px;" src="images/Card_Club_Queen.jpg"/>
<img style="position:absolute; left: 180px; top: 80px; width:45px; border-radius:3px;" src="images/Card_Heart_King.jpg"/>
<img style="position:absolute; left: 210px; top: 80px; width:45px; border-radius:3px;" src="images/Card_Club_King.jpg"/>
<div id="mtcr">
<div id="crib_region_top_left_side" class="mtcrb"></div>
<div id="crib_region_top_left_top" class="mtcrb"></div>
<div id="crib_region_top_right_top" class="mtcrb"></div>
<div id="crib_region_top_right_side" class="mtcrb"></div>
<div id="crib_region_bottom_right_side" class="mtcrb"></div>
<div id="crib_region_bottom_right_bottom" class="mtcrb"></div>
<div id="crib_region_bottom_left_bottom" class="mtcrb"></div>
<div id="crib_region_bottom_left_side" class="mtcrb"></div>
</div>
</div>
<div style="font-size:11pt; margin-top:160px; margin-left:40px; margin-right:40px; margin-bottom:3px; text-align:left;">
To discard, click on two cards or drag them to the center of the board. Then click on the button that appears to confirm your discards. The crib cards are then put aside to be counted later<br><br>Strategy: Keep in your hand cards that are pairs, runs, and groups that sum to 15. All face cards are worth 10 and aces are worth 1.
</div>
</center>
</div>
<div class="mtp" id="mt4">
<center>
<div>Page 5 of 7</div>
<div>Pegging</div>
<div style="font-size:10pt; margin-top:3px; margin-left:20px; margin-right:20px; margin-bottom:10px; text-align:left;">
Starting with whomever is not the dealer, each player lays one card face up in the center of the board. The cumulative sum of the cards is tracked and play continues until neither player can play without putting the sum over 31. At that point the cumulative sum is reset to zero and the same process is continued until both players have played all four of their cards.
</div>
<div style="font-size:10pt">During pegging points are awarded for:</div>
<table style="font-size:10pt; text-align:center;">
<tr>
<td>Cumulative sum of 15</td>
<td style="width:100px">2 points</td>
</tr>
<tr>
<td>Cumulative sum of 31</td>
<td>2 points</td>
</tr>
<tr>
<td>Last card below 31</td>
<td>1 point</td>
</tr>
<tr>
<td>Run of N Cards</td>
<td>N points</td>
</tr>
<tr>
<td>Pair</td>
<td>2 points</td>
</tr>
<tr>
<td>3 of a kind</td>
<td>6 points</td>
</tr>
<tr>
<td>4 of a kind</td>
<td>12 points</td>
</tr>
</table>
<div style="font-size:10pt; margin-top:3px; margin-left:20px; margin-right:20px; margin-bottom:3px; text-align:left;">
To get credit for a run the most recent played cards do not need to be played in order. For example, if the last cards played were 2, 4, 3 then the person who played the 3 would get 3 points for a run.
</div>
</center>
</div>
<div class="mtp" id="mt5">
<center>
<div>Page 6 of 7</div>
<div>Counting Hands</div>
<div style="font-size:10pt; margin-top:3px; margin-left:20px; margin-right:20px; margin-bottom:10px; text-align:left;">
Starting with whoever is not the dealer, each player counts the points that can be made using the cards in their hand and the one shared card that was flipped over on the top of the deck.
</div>
<div style="font-size:10pt">When counting, points are awarded for:</div>
<table style="font-size:10pt; text-align:center;">
<tr>
<td>Set of cards sum to 15</td>
<td style="width:100px">2 points</td>
</tr>
<tr>
<td>Run of N Cards</td>
<td>N points</td>
</tr>
<tr>
<td>Pair</td>
<td>2 points</td>
</tr>
<tr>
<td>3 of a kind</td>
<td>6 points</td>
</tr>
<tr>
<td>4 of a kind</td>
<td>12 points</td>
</tr>
<tr>
<td>Flush (not including top card)</td>
<td>4 points</td>
</tr>
<tr>
<td>Flush (including top card)</td>
<td>5 points</td>
</tr>
<tr>
<td>Jack of top suit (Nobs)</td>
<td>1 point</td>
</tr>
</table>
<div style="font-size:10pt; margin-top:3px; margin-left:20px; margin-right:20px; margin-bottom:3px; text-align:left;">
By default, the game will count your hand for you. However, you can change the settings to count manually. Counting is done by clicking on each subset of cards that form points and then clicking on the submit button that appears. Once all points have been counted tap the 'Finished Counting' button to move on. If 'Muggins' is enabled, the computer player will get credit for any points that you miss.
</div>
</center>
</div>
<div class="mtp" id="mt6">
<center>
<div>Page 7 of 7</div>
<div>Counting the Crib</div>
<div style="font-size:10pt; margin-top:3px; margin-left:20px; margin-right:20px; margin-bottom:10px; text-align:left;">
After both players have counted the points in their hand, the dealer is given the crib cards (which were discarded at the start of the round.) The points in the crib are counted using the same rules as for counting cards in hand.*
</div>
<div style="font-size:10pt">When counting, points are awarded for:</div>
<table style="font-size:10pt; text-align:center;">
<tr>
<td>Set of cards sum to 15</td>
<td style="width:100px">2 points</td>
</tr>
<tr>
<td>Run of N Cards</td>
<td>N points</td>
</tr>
<tr>
<td>Pair</td>
<td>2 points</td>
</tr>
<tr>
<td>3 of a kind</td>
<td>6 points</td>
</tr>
<tr>
<td>4 of a kind</td>
<td>12 points</td>
</tr>
<tr>
<td>Flush (including top card)</td>
<td>5 points</td>
</tr>
<tr>
<td>Jack of top suit (Nobs)</td>
<td>1 point</td>
</tr>
</table>
<div style="font-size:10pt; margin-top:23px; margin-left:20px; margin-right:20px; margin-bottom:3px; text-align:left;">
*The only difference between hand scoring and crib scoring is that in order to get a flush in the crib, the top card on the deck must also match the suit of the flush.
</div>
</center>
</div>
</div>
</div>
<button id="mtIncButton" onclick="IncrementTutorial()">
<svg class="mtBSVG"><polygon points="0,0 20,20 0,40" style="fill:white;" /></sgv>
</button>
<button id="mtDecButton" onclick="DecrementTutorial()">
<svg class="mtBSVG"><polygon points="20,0 20,40 0,20" style="fill:white;" /></sgv>
</button>
</div>
<div id="menu_suboptimal_history" class="menu_view">
<div id="menu_suboptimal_title" class="menu_card_title">Suboptimal Play History</div>
<button id="menu_suboptimal_close_button" class="close_button" onclick="menu_card_close_click()">X</button>
<div id="msoDesc">When you are playing cribbage you will sometimes play suboptimal crib discards or suboptimal pegging cards. This graph shows your cummulative suboptimal error count in average points for each game over time.</div>
<div id="msoNoHistory">After you finish your first game your history will appear here.</div>
<svg id="msoHistory"></svg>
</div>
<div id="menu_discard_analyzer" class="menu_view">
<div id="discard_analyzer_title" class="menu_card_title">Discard Analyzer</div>
<button id="da_close_button" class="close_button" onclick="menu_card_close_click()">X</button>
<div id="daPrompt">Select 6 cards to analyze the optimal discard:</div>
<label class="daSwitch">
<input id="da_crib_checkbox" type="checkbox" onclick="daCribSwitched(this)">
<span class="slider round"></span>
</label>
<div id="daCribIndicatorText">Your Crib</div>
<div style="width:100%; height:1px; background:white;"></div>
<table>
<tr>
<td class="daCardCell" id="daCardCell_AD" onclick="daCardCellClick(this, 'AD')">
<div class="daTinyCard" style="background:url(images/Card_Diamond_Ace.jpg);"></div>
</td>
<td class="daCardCell" id="daCardCell_2D" onclick="daCardCellClick(this, '2D')">
<div class="daTinyCard" style="background:url(images/Card_Diamond_2.jpg);"></div>
</td>
<td class="daCardCell" id="daCardCell_3D" onclick="daCardCellClick(this, '3D')">
<div class="daTinyCard" style="background:url(images/Card_Diamond_3.jpg);"></div>
</td>
<td class="daCardCell" id="daCardCell_4D" onclick="daCardCellClick(this, '4D')">
<div class="daTinyCard" style="background:url(images/Card_Diamond_4.jpg);"></div>
</td>
<td class="daCardCell" id="daCardCell_5D" onclick="daCardCellClick(this, '5D')">
<div class="daTinyCard" style="background:url(images/Card_Diamond_5.jpg);"></div>
</td>