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?
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):
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.