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.

 Score Frequency PDF CDF Not Qualified 14806947 (14.81%) (100.00%) 4 1 (0.00%) (85.19%) 5 9 (0.00%) (85.19%) 6 117 (0.00%) (85.19%) 7 728 (0.00%) (85.19%) 8 3590 (0.00%) (85.19%) 9 14230 (0.01%) (85.19%) 10 49667 (0.05%) (85.17%) 11 146853 (0.15%) (85.12%) 12 374034 (0.37%) (84.98%) 13 821225 (0.82%) (84.60%) 14 1625200 (1.63%) (83.78%) 15 2859193 (2.86%) (82.16%) 16 4400751 (4.40%) (79.30%) 17 6108761 (6.11%) (74.90%) 18 9339354 (9.34%) (68.79%) 19 11297706 (11.30%) (59.45%) 20 11116484 (11.12%) (48.15%) 21 10652890 (10.65%) (37.04%) 22 11547947 (11.55%) (26.38%) 23 10035266 (10.04%) (14.83%) 24 4799047 (4.80%) (4.80%)

Unknown said...

We play this game almost everyday at a local bar.
Could you explain the frequency of the "not qualified"?

Elliott Starno said...

1-4-24 is now available on the iPhone/iPod!

Check it out: http://itunes.apple.com/us/app/midnight-1424/id438054437?mt=8

www.midnight1424.com

Unknown said...

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.

Ramrod said...

What are the chance of rolling 1/4/24 on the first roll. I play after work all the time and we contribute to a separate pot just for anyone who rolls 1/4/24 on the first roll which seems to happens about every 2-3 weeks but we play almost every day!

Ramrod said...

We also play 1/4/4 and play both versions with a 1 dice limit after each roll just to mix it up a bit.