Sunday, August 15, 2010

1-4-24 Simulation

So, I've written some simple simulation code for the 1-4-24 game. If you're not familiar with it, see this old post: 1-4-24 Dice Game.

Edit: I found a bug in my code, so I've updated the simulation results.Edit #2: I found another bug in my code, and so I've updated the results again. And, added ran a couple other strategies just to see results.

I ran an initial simulation with a simple default strategy as follows:

1) Always keep 1 and 4 if you don't already have them.2) Always keep 6 if you already have both a 1 and a 4.3) If you didn't keep anything in the current roll (1/4/6 as per Rules #1 and #2) , then keep a single die (the highest valued one).

Score

Frequency

PDF

CDF

Not Qualified

4324214

(4.32%)

(100.00%)

4

0

(0.00%)

(95.68%)

5

11

(0.00%)

(95.68%)

6

143

(0.00%)

(95.68%)

7

1094

(0.00%)

(95.68%)

8

5670

(0.01%)

(95.67%)

9

21906

(0.02%)

(95.67%)

10

75295

(0.08%)

(95.65%)

11

222711

(0.22%)

(95.57%)

12

562945

(0.56%)

(95.35%)

13

1239852

(1.24%)

(94.79%)

14

2489387

(2.49%)

(93.55%)

15

4420645

(4.42%)

(91.06%)

16

6855657

(6.86%)

(86.64%)

17

9436721

(9.44%)

(79.78%)

18

11863564

(11.86%)

(70.34%)

19

14150677

(14.15%)

(58.48%)

20

13048294

(13.05%)

(44.33%)

21

11259056

(11.26%)

(31.28%)

22

8955723

(8.96%)

(20.02%)

23

6549697

(6.55%)

(11.07%)

24

4516738

(4.52%)

(4.52%)

Here are results for a different strategy. Based on these results, it seems superior in most cases -- one case where it would not be superior is if you need only to score 15 to win (the following strategy hits 15+ 85% of the time while the previously described default strategy gets you there 91% of the time).

Evaluate the dice in the following sorted order: (1+4), 6, 5, 3, 2

1) Always keep 1 and 4 if you don't already have them.2) Always keep 6 if you already have both a 1 and a 4.3) If you have 2 or fewer dice left to consider, then keep a 5.4) If you have only one die left to consider, then keep a 4. (Basically, expected value of a single roll is 3.5. You are 50% to do worse than a 4, and only 33% to do better. So, keeping the 4 is best.)5) If you didn't keep anything in the current roll (as per above rules) , then keep a single die (the highest valued one).

Score

Frequency

PDF

CDF

Not Qualified

12031334

(12.03%)

(100.00%)

4

0

(0.00%)

(87.97%)

5

14

(0.00%)

(87.97%)

6

106

(0.00%)

(87.97%)

7

746

(0.00%)

(87.97%)

8

3596

(0.00%)

(87.97%)

9

14262

(0.01%)

(87.96%)

10

49197

(0.05%)

(87.95%)

11

147225

(0.15%)

(87.90%)

12

372987

(0.37%)

(87.75%)

13

821681

(0.82%)

(87.38%)

14

1633170

(1.63%)

(86.56%)

15

2888930

(2.89%)

(84.93%)

16

4484273

(4.48%)

(82.04%)

17

6258644

(6.26%)

(77.55%)

18

9710872

(9.71%)

(71.29%)

19

11806824

(11.81%)

(61.58%)

20

11650430

(11.65%)

(49.78%)

21

11174701

(11.17%)

(38.13%)

22

12093475

(12.09%)

(26.95%)

23

10505528

(10.51%)

(14.86%)

24

4352005

(4.35%)

(4.35%)

Here's the 'go for broke' strategy, where you are going for 24 only. This means that you are going to keep all 6's (up to 4) and keep 1 and 4 as they present themselves. This strategy is forced if someone before you had gotten 24, and so you need specifically 24 to tie.

I suggest another strategy. On the first roll, if you get both a 1 and a 4, don't keep the 1 (unless you get a 24 on the first roll). I suspect this will only slightly increase the chance of not qualifying while significantly increasing the expected score.