Boxes and dice game

255 Views Asked by At

You have $9$ boxes numbered $1$ through $9$ and then you have two $6$-sided dice.

Each turn you roll the two dice and deduct the sum of the dice from the boxes by removing the number itself or any combination of boxes that sum up to the sum of the dice.

For example, let's say you first roll a $4$ and $5$.

You then have the option to remove some combination of boxes that sum up to $9$ (yes, you can remove $9$ itself too).

After these boxes are removed you roll both dice again and continue until you roll a sum that's impossible to remove with the remaining boxes.

For example, if you're left with boxes $1$, $3$, $4$ and you roll a $10$.

The game is over and your final score is $\sum_{i = 1}^9 i = 45$ minus the sum of the remaining boxes.

So if you were left with $1$, $3$, $4$ you end up with $37$.

Question. What is the optimal strategy?

2

There are 2 best solutions below

2
On BEST ANSWER

A bit less information than those $1766$ lines is actually required to specify the optimal strategy. We just have to know, for each possible sum of the boxes, the order of preference of the configurations with that sum. That allows us to find the optimal move given a configuration and a sum to remove. Here’s that information; each line contains the configuration (with the boxes ordered from $1$ to $9$) and the expected score starting from that configuration (as a rational and a floating point number):

0 :
  _________ : 45/1 : 45.0
1 :
  ☐________ : 44/1 : 44.0
2 :
  _☐_______ : 775/18 : 43.05555555555556
3 :
  ☐☐_______ : 380/9 : 42.22222222222222
  __☐______ : 253/6 : 42.166666666666664
4 :
  ☐_☐______ : 83/2 : 41.5
  ___☐_____ : 124/3 : 41.33333333333333
5 :
  ☐__☐_____ : 368/9 : 40.888888888888886
  _☐☐______ : 26429/648 : 40.785493827160494
  ____☐____ : 365/9 : 40.55555555555556
6 :
  ☐☐☐______ : 3319/81 : 40.9753086419753
  ☐___☐____ : 727/18 : 40.388888888888886
  _☐_☐_____ : 2897/72 : 40.236111111111114
  _____☐___ : 239/6 : 39.83333333333333
7 :
  ☐☐_☐_____ : 6671/162 : 41.17901234567901
  ☐____☐___ : 40/1 : 40.0
  _☐__☐____ : 12895/324 : 39.79938271604938
  __☐☐_____ : 8575/216 : 39.699074074074076
  ______☐__ : 235/6 : 39.166666666666664
8 :
  ☐☐__☐____ : 4427/108 : 40.99074074074074
  ☐_☐☐_____ : 26207/648 : 40.4429012345679
  ☐_____☐__ : 707/18 : 39.27777777777777
  _☐___☐___ : 6323/162 : 39.03086419753086
  __☐_☐____ : 6299/162 : 38.882716049382715
  _______☐_ : 343/9 : 38.111111111111114
9 :
  ☐☐___☐___ : 6557/162 : 40.4753086419753
  _☐☐☐_____ : 52309/1296 : 40.36188271604938
  ☐_☐_☐____ : 26051/648 : 40.20216049382716
  _☐____☐__ : 2755/72 : 38.263888888888886
  ☐______☐_ : 343/9 : 38.111111111111114
  __☐__☐___ : 2741/72 : 38.06944444444444
  ___☐☐____ : 1367/36 : 37.97222222222222
  ________☐ : 37/1 : 37.0
10 :
  ☐☐☐☐_____ : 324301/7776 : 41.705375514403286
  ☐_☐__☐___ : 713/18 : 39.611111111111114
  ☐☐____☐__ : 3200/81 : 39.50617283950617
  _☐☐_☐____ : 57101/1458 : 39.1639231824417
  ☐__☐☐____ : 25153/648 : 38.816358024691354
  __☐___☐__ : 1006/27 : 37.25925925925925
  ___☐_☐___ : 8017/216 : 37.11574074074074
  _☐_____☐_ : 24001/648 : 37.03858024691358
  ☐_______☐ : 221/6 : 36.83333333333333
11 :
  ☐☐☐_☐____ : 485269/11664 : 41.60399519890261
  _☐_☐☐____ : 75887/1944 : 39.03652263374485
  ☐__☐_☐___ : 6281/162 : 38.77160493827161
  _☐☐__☐___ : 451801/11664 : 38.7346536351166
  ☐_☐___☐__ : 12491/324 : 38.55246913580247
  ☐☐_____☐_ : 4097/108 : 37.93518518518518
  ___☐__☐__ : 2611/72 : 36.263888888888886
  ____☐☐___ : 11719/324 : 36.169753086419746
  __☐____☐_ : 23311/648 : 35.97376543209876
  _☐______☐ : 11567/324 : 35.70061728395062
12 :
  ☐☐_☐☐____ : 321289/7776 : 41.318029835390945
  ☐☐☐__☐___ : 481399/11664 : 41.27220507544581
  __☐☐☐____ : 24805/648 : 38.279320987654316
  ☐__☐__☐__ : 301/8 : 37.625
  _☐☐___☐__ : 451/12 : 37.58333333333333
  ☐___☐☐___ : 23981/648 : 37.007716049382715
  _☐_☐_☐___ : 2993/81 : 36.95061728395062
  ☐_☐____☐_ : 23881/648 : 36.85339506172839
  ☐☐______☐ : 2927/81 : 36.1358024691358
  ____☐_☐__ : 635/18 : 35.27777777777777
  ___☐___☐_ : 419/12 : 34.916666666666664
  __☐_____☐ : 1867/54 : 34.574074074074076
13 :
  ☐☐_☐_☐___ : 59309/1458 : 40.678326474622764
  ☐☐☐___☐__ : 236173/5832 : 40.496056241426615
  ☐_☐☐☐____ : 232921/5832 : 39.93844307270233
  _☐__☐☐___ : 216299/5832 : 37.088305898491086
  __☐☐_☐___ : 144047/3888 : 37.049125514403286
  ☐___☐_☐__ : 23797/648 : 36.72376543209876
  _☐_☐__☐__ : 5279/144 : 36.65972222222222
  ☐__☐___☐_ : 11597/324 : 35.79320987654321
  _☐☐____☐_ : 416999/11664 : 35.75094307270233
  ☐_☐_____☐ : 7543/216 : 34.92129629629629
  _____☐☐__ : 7409/216 : 34.300925925925924
  ____☐__☐_ : 10973/324 : 33.86728395061728
  ___☐____☐ : 3613/108 : 33.4537037037037
14 :
  _☐☐☐☐____ : 155975/3888 : 40.11702674897119
  ☐☐_☐__☐__ : 77837/1944 : 40.03960905349794
  ☐_☐☐_☐___ : 923027/23328 : 39.567343964334704
  ☐☐__☐☐___ : 903227/23328 : 38.71857853223594
  ☐☐☐____☐_ : 222403/5832 : 38.1349451303155
  __☐_☐☐___ : 105199/2916 : 36.07647462277092
  ☐___☐__☐_ : 7591/216 : 35.14351851851852
  _☐_☐___☐_ : 136385/3888 : 35.078446502057616
  ☐____☐☐__ : 2825/81 : 34.876543209876544
  _☐__☐_☐__ : 33815/972 : 34.789094650205755
  __☐☐__☐__ : 7505/216 : 34.74537037037037
  ☐__☐____☐ : 22105/648 : 34.11265432098765
  _☐☐_____☐ : 99347/2916 : 34.069615912208505
  _____☐_☐_ : 21523/648 : 33.214506172839506
  ____☐___☐ : 2651/81 : 32.72839506172839
15 :
  ☐☐☐☐☐____ : 17258603/419904 : 41.10130648910227
  _☐☐☐_☐___ : 1838041/46656 : 39.39559756515774
  ☐_☐_☐☐___ : 916055/23328 : 39.2684756515775
  ☐☐_☐___☐_ : 75665/1944 : 38.922325102880656
  ☐☐__☐_☐__ : 148717/3888 : 38.25025720164609
  ☐_☐☐__☐__ : 95683/2592 : 36.91473765432099
  ☐☐☐_____☐ : 417347/11664 : 35.78077846364883
  _☐___☐☐__ : 45539/1296 : 35.13811728395062
  __☐_☐_☐__ : 11363/324 : 35.07098765432099
  ___☐☐☐___ : 2521/72 : 35.013888888888886
  ☐____☐_☐_ : 11327/324 : 34.95987654320987
  _☐__☐__☐_ : 67033/1944 : 34.48199588477366
  __☐☐___☐_ : 551/16 : 34.4375
  ☐___☐___☐ : 2735/81 : 33.76543209876543
  _☐_☐____☐ : 7195/216 : 33.31018518518518
  ______☐☐_ : 261/8 : 32.625
  _____☐__☐ : 3463/108 : 32.06481481481481
16 :
  ☐☐☐☐_☐___ : 2846677/69984 : 40.676111682670324
  ☐_☐_☐_☐__ : 8321/216 : 38.523148148148145
  _☐☐_☐☐___ : 1322747/34992 : 37.80141175125743
  ☐☐__☐__☐_ : 72949/1944 : 37.52520576131687
  _☐☐☐__☐__ : 217363/5832 : 37.2707475994513
  ☐__☐☐☐___ : 214537/5832 : 36.786179698216735
  ☐☐_☐____☐ : 212533/5832 : 36.442558299039774
  ☐☐___☐☐__ : 5239/144 : 36.38194444444444
  ☐_☐☐___☐_ : 421199/11664 : 36.11102537722908
  __☐__☐☐__ : 16517/486 : 33.98559670781893
  ___☐☐_☐__ : 7331/216 : 33.93981481481481
  ☐____☐__☐ : 3623/108 : 33.54629629629629
  ☐_____☐☐_ : 21433/648 : 33.07561728395062
  _☐__☐___☐ : 24074/729 : 33.02331961591221
  __☐☐____☐ : 63329/1944 : 32.57664609053498
  _☐___☐_☐_ : 23714/729 : 32.52949245541838
  __☐_☐__☐_ : 186973/5832 : 32.059842249657066
  ______☐_☐ : 1699/54 : 31.462962962962962
17 :
  ☐☐☐_☐☐___ : 11258261/279936 : 40.217267518289894
  ☐☐☐☐__☐__ : 11212481/279936 : 40.05373013831733
  _☐_☐☐☐___ : 877631/23328 : 37.62135631001372
  _☐☐☐___☐_ : 1747297/46656 : 37.45063871742113
  ☐__☐☐_☐__ : 48421/1296 : 37.36188271604938
  ☐_☐__☐☐__ : 106775/2916 : 36.61694101508916
  ☐☐__☐___☐ : 17779/486 : 36.58230452674897
  ☐☐___☐_☐_ : 69955/1944 : 35.98508230452675
  _☐☐_☐_☐__ : 1277/36 : 35.47222222222222
  ☐_☐☐____☐ : 204613/5832 : 35.08453360768175
  ☐_☐_☐__☐_ : 135761/3888 : 34.91795267489712
  _☐____☐☐_ : 128749/3888 : 33.11445473251028
  ☐_____☐_☐ : 21323/648 : 32.90586419753086
  ___☐_☐☐__ : 14161/432 : 32.780092592592595
  __☐__☐_☐_ : 379973/11664 : 32.57656035665295
  _☐___☐__☐ : 23558/729 : 32.31550068587106
  ___☐☐__☐_ : 62431/1944 : 32.114711934156375
  __☐_☐___☐ : 23183/729 : 31.801097393689986
  _______☐☐ : 9841/324 : 30.373456790123456
18 :
  ☐☐_☐☐☐___ : 51415/1296 : 39.67206790123457
  ☐☐☐_☐_☐__ : 8286115/209952 : 39.46671143880506
  ☐☐☐☐___☐_ : 32613661/839808 : 38.83466339925316
  __☐☐☐☐___ : 27046/729 : 37.10013717421125
  _☐☐__☐☐__ : 213419/5832 : 36.59447873799725
  ☐_☐__☐_☐_ : 208873/5832 : 35.81498628257887
  ☐__☐_☐☐__ : 7649/216 : 35.41203703703704
  ☐☐___☐__☐ : 409715/11664 : 35.12645747599451
  _☐_☐☐_☐__ : 5573/162 : 34.401234567901234
  ☐☐____☐☐_ : 264317/7776 : 33.991383744855966
  ☐_☐_☐___☐ : 49543/1458 : 33.980109739369
  ☐__☐☐__☐_ : 131915/3888 : 33.92875514403292
  _☐☐☐____☐ : 197539/5832 : 33.87157064471879
  _☐☐_☐__☐_ : 779503/23328 : 33.41490912208505
  __☐___☐☐_ : 20629/648 : 31.834876543209873
  ____☐☐☐__ : 10213/324 : 31.521604938271604
  ___☐_☐_☐_ : 40571/1296 : 31.304783950617285
  ☐______☐☐ : 19781/648 : 30.526234567901234
  _☐____☐_☐ : 19765/648 : 30.501543209876544
  __☐__☐__☐ : 4847/162 : 29.919753086419753
  ___☐☐___☐ : 4765/162 : 29.41358024691358
19 :
  ☐☐_☐☐_☐__ : 1818077/46656 : 38.96769975994513
  ☐_☐☐☐☐___ : 10877147/279936 : 38.85583490512117
  ☐☐☐__☐☐__ : 4072235/104976 : 38.792057232129245
  ☐☐☐_☐__☐_ : 5337805/139968 : 38.135895347508
  ☐☐☐☐____☐ : 862915/23328 : 36.99052640603566
  _☐_☐☐__☐_ : 92159/2592 : 35.55516975308642
  ☐__☐_☐_☐_ : 206887/5832 : 35.47445130315501
  _☐_☐_☐☐__ : 1634255/46656 : 35.027756344307264
  __☐☐☐_☐__ : 204037/5832 : 34.98576817558299
  ☐_☐___☐☐_ : 789913/23328 : 33.86115397805212
  _☐☐_☐___☐ : 589661/17496 : 33.70261774119798
  _☐☐__☐_☐_ : 4678609/139968 : 33.42627600594422
  ☐☐____☐_☐ : 386755/11664 : 33.15800754458162
  ☐___☐☐☐__ : 766309/23328 : 32.84932270233196
  ☐_☐__☐__☐ : 126359/3888 : 32.49974279835391
  ☐__☐☐___☐ : 22603/729 : 31.00548696844993
  ___☐__☐☐_ : 13177/432 : 30.502314814814813
  _☐_____☐☐ : 176621/5832 : 30.284807956104252
  __☐___☐_☐ : 58837/1944 : 30.265946502057613
  ____☐☐_☐_ : 174841/5832 : 29.979595336076816
  ___☐_☐__☐ : 28861/972 : 29.69238683127572
20 :
  _☐☐☐☐☐___ : 1352279/34992 : 38.6453760859625
  ☐☐_☐_☐☐__ : 5353375/139968 : 38.24713505944216
  ☐_☐☐☐_☐__ : 2642309/69984 : 37.755901348879746
  ☐☐_☐☐__☐_ : 3507749/93312 : 37.5916173696845
  ☐☐☐__☐_☐_ : 5250775/139968 : 37.51411036808413
  ☐☐☐_☐___☐ : 639185/17496 : 36.533207590306354
  _☐__☐☐☐__ : 130159/3888 : 33.47710905349794
  _☐☐___☐☐_ : 778441/23328 : 33.369384430727024
  ☐___☐☐_☐_ : 384851/11664 : 32.99477023319616
  __☐☐☐__☐_ : 31765/972 : 32.68004115226337
  ☐_☐___☐_☐ : 94921/2916 : 32.55178326474623
  __☐☐_☐☐__ : 759139/23328 : 32.541966735253766
  ☐__☐__☐☐_ : 7009/216 : 32.449074074074076
  ☐__☐_☐__☐ : 94415/2916 : 32.378257887517144
  _☐☐__☐__☐ : 1104325/34992 : 31.559356424325557
  _☐_☐☐___☐ : 183575/5832 : 31.477194787379972
  ☐☐_____☐☐ : 178061/5832 : 30.531721536351164
  _☐_☐_☐_☐_ : 13073/432 : 30.261574074074073
  ____☐_☐☐_ : 56603/1944 : 29.116769547325102
  __☐____☐☐ : 168419/5832 : 28.878429355281206
  ___☐__☐_☐ : 6235/216 : 28.86574074074074
  ____☐☐__☐ : 41941/1458 : 28.76611796982167
21 :
  ☐☐☐☐☐☐___ : 307606283/7558272 : 40.697964164295755
  _☐☐☐☐_☐__ : 291073/7776 : 37.43222736625514
  ☐_☐☐_☐☐__ : 3452407/93312 : 36.99853180727023
  ☐☐_☐_☐_☐_ : 857599/23328 : 36.76264574759945
  ☐☐☐___☐☐_ : 3398557/93312 : 36.4214356138546
  ☐_☐☐☐__☐_ : 422065/11664 : 36.185270919067214
  ☐☐__☐☐☐__ : 30290297/839808 : 36.06812152301478
  ☐☐☐__☐__☐ : 5026417/139968 : 35.911186842706904
  ☐☐_☐☐___☐ : 416051/11664 : 35.66966735253772
  __☐_☐☐☐__ : 197723/5832 : 33.903120713305896
  __☐☐_☐_☐_ : 1551245/46656 : 33.248563957475994
  _☐_☐__☐☐_ : 514745/15552 : 33.09831532921811
  ☐__☐__☐_☐ : 41705/1296 : 32.17978395061728
  _☐__☐☐_☐_ : 738605/23328 : 31.66173696844993
  ☐___☐_☐☐_ : 61189/1944 : 31.47582304526749
  ☐___☐☐__☐ : 366311/11664 : 31.40526406035665
  _☐_☐_☐__☐ : 722257/23328 : 30.960948216735254
  _☐☐___☐_☐ : 357617/11664 : 30.659893689986284
  __☐☐☐___☐ : 178729/5832 : 30.646262002743484
  ☐_☐____☐☐ : 349237/11664 : 29.941443758573385
  _____☐☐☐_ : 12167/432 : 28.16435185185185
  ____☐_☐_☐ : 3013/108 : 27.898148148148145
  ___☐___☐☐ : 17767/648 : 27.41820987654321
22 :
  ☐☐☐☐☐_☐__ : 101124553/2519424 : 40.13796526507646
  _☐☐☐_☐☐__ : 10230343/279936 : 36.545292495427525
  ☐_☐_☐☐☐__ : 7657267/209952 : 36.471512536198745
  ☐☐_☐__☐☐_ : 3374489/93312 : 36.1635052297668
  _☐☐☐☐__☐_ : 30249247/839808 : 36.01924130277396
  ☐_☐☐_☐_☐_ : 10075847/279936 : 35.99339491883859
  ☐☐__☐☐_☐_ : 3289657/93312 : 35.25438314471879
  ☐☐_☐_☐__☐ : 4927129/139968 : 35.20182470278921
  ☐☐☐___☐_☐ : 2441059/69984 : 34.880244055784175
  ☐_☐☐☐___☐ : 297125/8748 : 33.96490626428898
  ___☐☐☐☐__ : 15419/486 : 31.72633744855967
  ☐___☐_☐_☐ : 182855/5832 : 31.353737997256516
  _☐__☐☐__☐ : 268969/8748 : 30.746342021033378
  _☐__☐_☐☐_ : 88837/2916 : 30.46536351165981
  __☐☐__☐☐_ : 115927/3888 : 29.816615226337447
  __☐☐_☐__☐ : 173251/5832 : 29.70696159122085
  __☐_☐☐_☐_ : 2062109/69984 : 29.4654349565615
  _☐☐____☐☐ : 514675/17496 : 29.41672382258802
  ☐____☐☐☐_ : 683461/23328 : 29.297882373113854
  _☐_☐__☐_☐ : 112505/3888 : 28.936471193415635
  ☐__☐___☐☐ : 335791/11664 : 28.78866598079561
  _____☐☐_☐ : 52375/1944 : 26.94187242798354
  ____☐__☐☐ : 38459/1458 : 26.377914951989027
23 :
  ☐☐☐☐_☐☐__ : 33150479/839808 : 39.47387855319311
  ☐☐☐☐☐__☐_ : 16370999/419904 : 38.98748047172687
  _☐☐☐_☐_☐_ : 7364503/209952 : 35.077079522938575
  _☐☐_☐☐☐__ : 3681647/104976 : 35.071321063862214
  ☐__☐☐☐☐__ : 3246457/93312 : 34.791420181755825
  ☐☐_☐__☐_☐ : 1610641/46656 : 34.521626371742116
  ☐_☐_☐☐_☐_ : 9646691/279936 : 34.46034450731595
  ☐☐__☐_☐☐_ : 399455/11664 : 34.24682784636488
  _☐☐☐☐___☐ : 224225/6561 : 34.17543057460753
  ☐☐__☐☐__☐ : 4761961/139968 : 34.02178355052583
  ☐_☐☐_☐__☐ : 2368367/69984 : 33.84154949702789
  ☐_☐☐__☐☐_ : 512881/15552 : 32.978459362139915
  ☐☐☐____☐☐ : 4425205/139968 : 31.61583361911294
  ___☐☐☐_☐_ : 78427/2592 : 30.25733024691358
  _☐___☐☐☐_ : 1379417/46656 : 29.565693587105624
  ☐____☐☐_☐ : 341671/11664 : 29.29278120713306
  __☐_☐_☐☐_ : 678727/23328 : 29.09495027434842
  _☐_☐___☐☐ : 678391/23328 : 29.080546982167352
  __☐_☐☐__☐ : 62704/2187 : 28.671239140374944
  __☐☐__☐_☐ : 330073/11664 : 28.298439643347052
  ☐___☐__☐☐ : 82213/2916 : 28.1937585733882
  _☐__☐_☐_☐ : 40073/1458 : 27.484910836762687
  _____☐_☐☐ : 75253/2916 : 25.80692729766804
24 :
  ☐☐☐_☐☐☐__ : 146016805/3779136 : 38.637615846585035
  ☐☐☐☐_☐_☐_ : 145405387/3779136 : 38.47582807287168
  ☐☐☐☐☐___☐ : 281424775/7558272 : 37.2340099694745
  _☐☐☐__☐☐_ : 28979225/839808 : 34.50696468716659
  _☐_☐☐☐☐__ : 14437105/419904 : 34.381918247980494
  ☐_☐_☐_☐☐_ : 7138717/209952 : 34.001662284712694
  ☐__☐☐☐_☐_ : 390169/11664 : 33.450703017832645
  _☐☐☐_☐__☐ : 4673573/139968 : 33.390296353452214
  ☐_☐_☐☐__☐ : 2334161/69984 : 33.35278063557384
  ☐☐__☐_☐_☐ : 32045/972 : 32.96810699588477
  _☐☐_☐☐_☐_ : 861947/26244 : 32.84358329522938
  ☐☐_☐___☐☐ : 765995/23328 : 32.83586248285322
  ☐_☐☐__☐_☐ : 739907/23328 : 31.717549725651576
  ☐☐___☐☐☐_ : 13240829/419904 : 31.532990874104556
  __☐__☐☐☐_ : 173119/5832 : 29.68432784636488
  ___☐☐_☐☐_ : 27979/972 : 28.78497942386831
  __☐_☐_☐_☐ : 20852/729 : 28.603566529492454
  _☐__☐__☐☐ : 18535/648 : 28.603395061728392
  ☐____☐_☐☐ : 41111/1458 : 28.19684499314129
  _☐___☐☐_☐ : 328151/11664 : 28.13365912208505
  __☐☐___☐☐ : 323731/11664 : 27.754715363511657
  ___☐☐☐__☐ : 78755/2916 : 27.007887517146777
  ______☐☐☐ : 16399/648 : 25.307098765432098
25 :
  ☐☐_☐☐☐☐__ : 190785863/5038848 : 37.86299229506427
  ☐☐☐_☐☐_☐_ : 93792769/2519424 : 37.22786200337855
  ☐☐☐☐__☐☐_ : 15595409/419904 : 37.140415428288364
  ☐☐☐☐_☐__☐ : 91912093/2519424 : 36.48139138152212
  __☐☐☐☐☐__ : 7156549/209952 : 34.08659598384392
  _☐_☐☐☐_☐_ : 3447893/104976 : 32.84458352385307
  ☐_☐_☐_☐_☐ : 763237/23328 : 32.71763545953361
  ☐__☐☐_☐☐_ : 378355/11664 : 32.437842935528124
  ☐_☐__☐☐☐_ : 8983187/279936 : 32.09014560470965
  _☐☐_☐☐__☐ : 4997959/157464 : 31.74032794797541
  ☐☐__☐__☐☐ : 1106399/34992 : 31.61862711476909
  ☐☐___☐☐_☐ : 1450549/46656 : 31.090299211248286
  _☐☐☐__☐_☐ : 1429925/46656 : 30.648255315500684
  _☐☐_☐_☐☐_ : 25663955/839808 : 30.559312366636185
  ☐_☐☐___☐☐ : 1062659/34992 : 30.36862711476909
  ☐__☐☐☐__☐ : 4156673/139968 : 29.697309385002285
  ___☐_☐☐☐_ : 1305511/46656 : 27.981631515775035
  _☐___☐_☐☐ : 1849813/69984 : 26.431941586648378
  __☐__☐☐_☐ : 308179/11664 : 26.421382030178325
  ☐_____☐☐☐ : 75967/2916 : 26.051783264746227
  ___☐☐_☐_☐ : 75355/2916 : 25.84190672153635
  __☐_☐__☐☐ : 889223/34992 : 25.41217992684042
26 :
  ☐_☐☐☐☐☐__ : 46767787/1259712 : 37.125777161763956
  ☐☐_☐☐☐_☐_ : 1933385/52488 : 36.83480033531474
  ☐☐☐_☐_☐☐_ : 10145089/279936 : 36.240744312985825
  ☐☐☐_☐☐__☐ : 22557995/629856 : 35.81452744754357
  ☐☐☐☐__☐_☐ : 44582497/1259712 : 35.39102350378499
  __☐☐☐☐_☐_ : 27113521/839808 : 32.28538070606615
  _☐_☐☐_☐☐_ : 4509361/139968 : 32.21708533379058
  _☐☐__☐☐☐_ : 26751511/839808 : 31.854317891708583
  ☐__☐_☐☐☐_ : 2967443/93312 : 31.80130101165981
  _☐☐☐___☐☐ : 3297365/104976 : 31.41065576893766
  _☐_☐☐☐__☐ : 6508573/209952 : 31.00029054260021
  ☐__☐☐_☐_☐ : 119893/3888 : 30.83667695473251
  ☐_☐__☐☐_☐ : 2117401/69984 : 30.255501257430268
  ☐☐___☐_☐☐ : 1387399/46656 : 29.736775548696844
  _☐☐_☐_☐_☐ : 6175075/209952 : 29.411841754305748
  ☐_☐_☐__☐☐ : 2023909/69984 : 28.91959590763603
  ____☐☐☐☐_ : 152473/5832 : 26.14420438957476
  ___☐_☐☐_☐ : 304543/11664 : 26.109653635116597
  _☐____☐☐☐ : 101155/3888 : 26.017232510288064
  __☐__☐_☐☐ : 108895/4374 : 24.895976223136714
  ___☐☐__☐☐ : 69503/2916 : 23.835048010973935
27 :
  _☐☐☐☐☐☐__ : 278119379/7558272 : 36.79668831711798
  ☐☐_☐☐_☐☐_ : 6671525/186624 : 35.748483581961594
  ☐_☐☐☐☐_☐_ : 2471651/69984 : 35.31737254229538
  ☐☐☐__☐☐☐_ : 132934007/3779136 : 35.175766894866975
  ☐☐☐_☐_☐_☐ : 261296113/7558272 : 34.57087982544158
  ☐☐_☐☐☐__☐ : 28795375/839808 : 34.28804560089925
  ☐☐☐☐___☐☐ : 126590867/3779136 : 33.497303881098745
  __☐☐☐☐__☐ : 1064455/34992 : 30.41995313214449
  ☐__☐_☐☐_☐ : 354067/11664 : 30.355538408779147
  _☐☐__☐☐_☐ : 4217995/139968 : 30.135423811156834
  _☐_☐_☐☐☐_ : 1388843/46656 : 29.76772548010974
  __☐☐☐_☐☐_ : 24955469/839808 : 29.71568382296906
  ☐_☐__☐_☐☐ : 4091471/139968 : 29.23147433699131
  ☐___☐☐☐☐_ : 2659349/93312 : 28.499539180384087
  _☐☐_☐__☐☐ : 11846671/419904 : 28.212808165675963
  ☐☐____☐☐☐ : 105379/3888 : 27.103652263374485
  _☐_☐☐_☐_☐ : 5663987/209952 : 26.977532959914647
  ☐__☐☐__☐☐ : 38705/1458 : 26.546639231824415
  __☐___☐☐☐ : 299125/11664 : 25.64514746227709
  ____☐☐☐_☐ : 144655/5832 : 24.80366941015089
  ___☐_☐_☐☐ : 571133/23328 : 24.482724622770917
28 :
  ☐☐☐☐☐☐☐__ : 298291879/7558272 : 39.46561846411455
  _☐☐☐☐☐_☐_ : 11164139/314928 : 35.44981392572271
  ☐☐_☐_☐☐☐_ : 87461903/2519424 : 34.71503923118935
  ☐_☐☐☐_☐☐_ : 10722817/314928 : 34.048471396636685
  ☐☐☐__☐☐_☐ : 128197001/3779136 : 33.92230419863164
  ☐☐_☐☐_☐_☐ : 14205875/419904 : 33.83124476070721
  ☐_☐☐☐☐__☐ : 84375899/2519424 : 33.49015449563075
  ☐☐☐_☐__☐☐ : 82511305/2519424 : 32.750067078824365
  __☐☐_☐☐☐_ : 8229809/279936 : 29.398894747370825
  _☐__☐☐☐☐_ : 12274393/419904 : 29.231426707056848
  _☐_☐☐__☐☐ : 759229/26244 : 28.929622008840113
  ☐__☐_☐_☐☐ : 126271/4374 : 28.86854138088706
  ☐___☐☐☐_☐ : 2009167/69984 : 28.708947759487884
  _☐_☐_☐☐_☐ : 3949921/139968 : 28.220171753543667
  __☐☐☐_☐_☐ : 108715/3888 : 27.96167695473251
  ☐_☐___☐☐☐ : 1886203/69984 : 26.951917581161407
  _☐☐__☐_☐☐ : 33592843/1259712 : 26.66708184092872
  ___☐__☐☐☐ : 276689/11664 : 23.72162208504801
  ____☐☐_☐☐ : 101041/4374 : 23.10036579789666
29 :
  ☐☐☐☐☐☐_☐_ : 1738184573/45349632 : 38.328526524757685
  _☐☐☐☐_☐☐_ : 511864295/15116544 : 33.86119836650494
  ☐_☐☐_☐☐☐_ : 14058547/419904 : 33.480383611492144
  _☐☐☐☐☐__☐ : 125852959/3779136 : 33.30204549399651
  ☐☐_☐_☐☐_☐ : 167247781/5038848 : 33.19167019922014
  ☐_☐☐☐_☐_☐ : 81893879/2519424 : 32.505000746202306
  ☐☐_☐☐__☐☐ : 27022477/839808 : 32.176970212238984
  ☐☐__☐☐☐☐_ : 242378081/7558272 : 32.06792253573303
  ☐☐☐__☐_☐☐ : 40341367/1259712 : 32.02427777142712
  __☐_☐☐☐☐_ : 24015263/839808 : 28.596135068968145
  ☐___☐☐_☐☐ : 3803995/139968 : 27.177604881115684
  _☐☐___☐☐☐ : 11172059/419904 : 26.606221898338667
  ☐__☐__☐☐☐ : 619667/23328 : 26.563228737997257
  _☐__☐☐☐_☐ : 5575385/209952 : 26.55552221460143
  __☐☐_☐☐_☐ : 3595633/139968 : 25.688964620484683
  __☐☐☐__☐☐ : 10638575/419904 : 25.335731500533456
  _☐_☐_☐_☐☐ : 10530397/419904 : 25.078105948026213
  ____☐_☐☐☐ : 16237/729 : 22.272976680384087
30 :
  ☐☐☐☐☐_☐☐_ : 1701086855/45349632 : 37.510488618738954
  ☐☐☐☐☐☐__☐ : 4983844715/136048896 : 36.63274647226832
  _☐☐☐_☐☐☐_ : 504682613/15116544 : 33.38611080680875
  ☐_☐_☐☐☐☐_ : 246914953/7558272 : 32.66817508022997
  ☐☐_☐_☐_☐☐ : 26540371/839808 : 31.602903282655085
  _☐☐☐☐_☐_☐ : 238092145/7558272 : 31.50087017244153
  ☐_☐☐_☐☐_☐ : 8774407/279936 : 31.344332275948787
  ☐☐__☐☐☐_☐ : 235054637/7558272 : 31.09899154198208
  ☐☐☐___☐☐☐ : 4282855/139968 : 30.59881544352995
  ☐_☐☐☐__☐☐ : 25494227/839808 : 30.357209028730374
  ___☐☐☐☐☐_ : 5901947/209952 : 28.110934880353604
  __☐_☐☐☐_☐ : 1903199/69984 : 27.19477309099223
  __☐☐_☐_☐☐ : 924491/34992 : 26.420067443987197
  _☐_☐__☐☐☐ : 11057135/419904 : 26.33253076893766
  _☐__☐☐_☐☐ : 5505019/209952 : 26.22036941777168
  ☐___☐_☐☐☐ : 99409/3888 : 25.56815843621399
  _____☐☐☐☐ : 249073/11664 : 21.353995198902606
31 :
  ☐☐☐☐_☐☐☐_ : 277607891/7558272 : 36.7290157062355
  ☐☐☐☐☐_☐_☐ : 1628017321/45349632 : 35.899239954141194
  ☐_☐_☐☐☐_☐ : 14730337/472392 : 31.182443817846195
  ☐__☐☐☐☐☐_ : 406181/13122 : 30.9541990550221
  _☐☐☐_☐☐_☐ : 77767981/2519424 : 30.86736531842199
  _☐☐_☐☐☐☐_ : 232131799/7558272 : 30.712284368702264
  ☐☐_☐__☐☐☐ : 25690513/839808 : 30.590936261621703
  _☐☐☐☐__☐☐ : 12829997/419904 : 30.554595812376164
  ☐_☐☐_☐_☐☐ : 76506341/2519424 : 30.366600064141643
  ☐☐__☐☐_☐☐ : 18658171/629856 : 29.622915396535078
  ___☐☐☐☐_☐ : 1710973/69984 : 24.44805955647005
  _☐__☐_☐☐☐ : 5070697/209952 : 24.151696578265508
  __☐☐__☐☐☐ : 10056461/419904 : 23.94942891708581
  ☐____☐☐☐☐ : 100795/4374 : 23.044124371284866
  __☐_☐☐_☐☐ : 28126567/1259712 : 22.32777571381395
32 :
  ☐☐☐_☐☐☐☐_ : 2424348139/68024448 : 35.63936511473051
  ☐☐☐☐_☐☐_☐ : 1061086723/30233088 : 35.09686880149325
  ☐☐☐☐☐__☐☐ : 3108605065/90699264 : 34.27376284993889
  _☐_☐☐☐☐☐_ : 51639827/1679616 : 30.7450196949779
  _☐☐☐_☐_☐☐ : 74504303/2519424 : 29.571958908067877
  _☐☐_☐☐☐_☐ : 36887663/1259712 : 29.282616185286795
  ☐__☐☐☐☐_☐ : 300971/10368 : 29.0288387345679
  ☐_☐_☐☐_☐☐ : 72745579/2519424 : 28.873893000939894
  ☐☐__☐_☐☐☐ : 221767/7776 : 28.519418724279834
  ☐_☐☐__☐☐☐ : 630917/23328 : 27.04548182441701
  __☐_☐_☐☐☐ : 4899137/209952 : 23.334557422648984
  _☐___☐☐☐☐ : 9752471/419904 : 23.225477728242645
  ___☐☐☐_☐☐ : 2397571/104976 : 22.83922991921963
33 :
  ☐☐_☐☐☐☐☐_ : 117787529/3359232 : 35.063826791361834
  ☐☐☐_☐☐☐_☐ : 1160989811/34012224 : 34.134486795100486
  ☐☐☐☐_☐_☐☐ : 4577897219/136048896 : 33.64891118998864
  __☐☐☐☐☐☐_ : 1789832/59049 : 30.310962082338396
  _☐☐☐__☐☐☐ : 3409265/118098 : 28.86810106860404
  ☐_☐_☐_☐☐☐ : 107135273/3779136 : 28.349144619299224
  _☐_☐☐☐☐_☐ : 8796029/314928 : 27.930285652593607
  _☐☐_☐☐_☐☐ : 205148477/7558272 : 27.14224587313079
  ☐__☐☐☐_☐☐ : 5661673/209952 : 26.966511393080324
  ☐☐___☐☐☐☐ : 193309459/7558272 : 25.575880174727768
  __☐__☐☐☐☐ : 357101/15552 : 22.961741255144034
  ___☐☐_☐☐☐ : 246797/11664 : 21.158864883401918
34 :
  ☐_☐☐☐☐☐☐_ : 1022059487/30233088 : 33.80599054254729
  ☐☐_☐☐☐☐_☐ : 751580051/22674816 : 33.14602645507685
  ☐☐☐_☐☐_☐☐ : 979413167/30233088 : 32.39540621851132
  ☐☐☐☐__☐☐☐ : 485592325/15116544 : 32.12323696474538
  __☐☐☐☐☐_☐ : 211702699/7558272 : 28.00940466286474
  _☐_☐☐☐_☐☐ : 102751369/3779136 : 27.189116507053463
  ☐__☐☐_☐☐☐ : 3700895/139968 : 26.441007944673068
  ☐_☐__☐☐☐☐ : 65216213/2519424 : 25.88536625831936
  _☐☐_☐_☐☐☐ : 3417949/139968 : 24.41950302926383
  ___☐_☐☐☐☐ : 3124079/139968 : 22.319951703246456
35 :
  _☐☐☐☐☐☐☐_ : 18426506833/544195584 : 33.860081512532076
  ☐_☐☐☐☐☐_☐ : 1454725385/45349632 : 32.07799756787442
  ☐☐_☐☐☐_☐☐ : 478952699/15116544 : 31.684007865819062
  ☐☐☐_☐_☐☐☐ : 2841885785/90699264 : 31.333063353193253
  ☐__☐_☐☐☐☐ : 4868761/186624 : 26.088611325445815
  __☐☐☐☐_☐☐ : 21855245/839808 : 26.024097174592285
  _☐_☐☐_☐☐☐ : 195637247/7558272 : 25.88385903550441
  _☐☐__☐☐☐☐ : 16169573/629856 : 25.671856741858456
  ____☐☐☐☐☐ : 4259689/209952 : 20.288870789513794
36 :
  ☐☐☐☐☐☐☐☐_ : 40680046363/1088391168 : 37.37631061243599
  _☐☐☐☐☐☐_☐ : 4294411759/136048896 : 31.565208430651285
  ☐☐_☐☐_☐☐☐ : 116318701/3779136 : 30.779178362461685
  ☐_☐☐☐☐_☐☐ : 151954459/5038848 : 30.156587180244372
  ☐☐☐__☐☐☐☐ : 1025676997/34012224 : 30.156128484864734
  ☐___☐☐☐☐☐ : 19907155/839808 : 23.704412198978815
  _☐_☐_☐☐☐☐ : 89305741/3779136 : 23.63125883799895
  __☐☐☐_☐☐☐ : 57721303/2519424 : 22.910515657547123
37 :
  ☐☐☐☐☐☐☐_☐ : 19459995365/544195584 : 35.75919382138903
  _☐☐☐☐☐_☐☐ : 4113192631/136048896 : 30.23319374087387
  ☐☐_☐_☐☐☐☐ : 1352311151/45349632 : 29.819671987635974
  ☐_☐☐☐_☐☐☐ : 1307906951/45349632 : 28.840519609949645
  __☐☐_☐☐☐☐ : 43825877/1889568 : 23.19359610238954
  _☐__☐☐☐☐☐ : 10945141/472392 : 23.169615488831308
38 :
  ☐☐☐☐☐☐_☐☐ : 13948409447/408146688 : 34.17499114191023
  _☐☐☐☐_☐☐☐ : 54314371/1889568 : 28.744332567020606
  ☐_☐☐_☐☐☐☐ : 854470673/30233088 : 28.26276538473344
  ☐☐__☐☐☐☐☐ : 3651087695/136048896 : 26.836584510027922
  __☐_☐☐☐☐☐ : 14139535/629856 : 22.448837512066248
39 :
  ☐☐☐☐☐_☐☐☐ : 36214440599/1088391168 : 33.273368678236096
  _☐☐☐_☐☐☐☐ : 7672831961/272097792 : 28.198802734128762
  ☐_☐_☐☐☐☐☐ : 7496510921/272097792 : 27.550796593748174
  ___☐☐☐☐☐☐ : 82377397/3779136 : 21.7979445566394
40 :
  ☐☐☐☐_☐☐☐☐ : 2946388613/90699264 : 32.48525382741805
  ☐__☐☐☐☐☐☐ : 193363553/7558272 : 25.58303710160206
  _☐☐_☐☐☐☐☐ : 1144696163/45349632 : 25.241575565596648
41 :
  ☐☐☐_☐☐☐☐☐ : 17029944421/544195584 : 31.293793852248534
  _☐_☐☐☐☐☐☐ : 6841285991/272097792 : 25.142747174515844
42 :
  ☐☐_☐☐☐☐☐☐ : 1391602721/45349632 : 30.68608629503322
  __☐☐☐☐☐☐☐ : 1115746501/45349632 : 24.603209591645637
43 :
  ☐_☐☐☐☐☐☐☐ : 31738653583/1088391168 : 29.16107233883765
44 :
  _☐☐☐☐☐☐☐☐ : 23971611241/816293376 : 29.366416469610062
45 :
  ☐☐☐☐☐☐☐☐☐ : 82876205053/2448880128 : 33.84249155579738

Here’s the Java code I wrote to produce these results. (You’ll also need this class for exact rational calculations.)

You can see from this representation that by far the most important aspect is to keep as many boxes as possible: Within the configurations with a given sum, the differences between configurations with different numbers of boxes are significantly larger than the differences between configurations with the same number of boxes; and configurations with more boxes are without exception more favourable than those with fewer boxes (and equal sums).

The expected score is

$$ \frac{82876205053}{2448880128}\approx33.842\;, $$ in agreement with Mike Earnest’s result. If you choose uniformly randomly among all available options, the expected score is only about $24.581$, quite a bit lower; but if you choose uniformly randomly among all available options with the highest possible box count, the expected score is about $33.167$. So by following the one simple rule of keeping as many boxes as possible, you can achieve about $93\%$ of the possible gain over completely random play.

6
On

What you are asking for is a tall order; an optimal strategy is specified by saying, for every possible set of remaining boxes, and every possible roll, which boxes should you remove in that situation. This is simple enough to compute with the help of a computer, using dynamic programming/memoization.

I found that with optimal play, your expected score is $33.842$. Here is a text document summarizing the optimal strategy; it is 1766 lines long. Here is how you interpret the file. The entry

(0, 0, 1, 1, 1, 1, 0, 1, 1)  |  11  |  (6, 5)  

means that when the set of remaining boxes is $\{3, 4, 5, 6, 8, 9\}$, and you roll $11$, then the optimal strategy is to remove boxes numbered $6$ and $5$.

Here is my Python code which I used to create the linked text file containing the optimal strategy.

from functools import lru_cache
from itertools import product

best_moves_dict = dict()

def main():
    
    box_mask = (1,)*9
    
    print(box_game_expected_score(box_mask))
    
    print(len(best_moves_dict))
    
    with open('box_game_strategy.txt', 'w') as f:
        for mask in product([0,1], repeat = 9):
            for roll in range(2, 12 + 1):
                if (mask, roll) in best_moves_dict:
                    f.write(str(mask) + '  |  ')
                    f.write(f'{roll:2}' + '  |  ')
                    f.write(str(best_moves_dict[(mask, roll)]) + '\n')

def distinct_partitions(total, max = None):
    # Yields all tuples of distinct positive integers summing to total.
    # If "max" option is enabled, only yield such tuples whose max entry
    # is at most max.
    
    if total < 0:
        return
    
    if total == 0:
        yield ()
        return
    
    if max == None:
        max = total
    
    if total > max * (max + 1) //2 :
        return
    
    for x in range(max, 0, -1):
        for lamb in distinct_partitions(total - x, x - 1):
            yield (x,) + lamb



@lru_cache
def box_game_expected_score(box_mask):
    
    global best_moves_dict
    
    ans = 0
    
    for roll in range(2, 12 + 1):
        
        roll_prob = (roll - 1) /36 - 2 * max(roll - 7, 0)/36
        
        #Default option is game ends, score sum of removed boxes
        score_if_no_opts = sum([i+1 for i in range(9) if box_mask[i] == 0])
        options = [(score_if_no_opts, None)]
        for indices_to_take in distinct_partitions(roll, max = 9):
            
            if all([box_mask[i-1] for i in indices_to_take]):
                
                new_mask = list(box_mask)
                for i in indices_to_take:
                    new_mask[i-1] = 0
                new_mask = tuple(new_mask)
                
                new_score = box_game_expected_score(new_mask)
                
                options.append((new_score, indices_to_take))
                        
        ans += roll_prob * max(options)[0]
        
        if len(options) >= 3:
            best_moves_dict[(box_mask, roll)] = max(options)[1]
    
    return ans 


main()