Shut the Box

Bob plays a single-player game of chance using two standard 6-sided dice and twelve cards numbered 1 to 12. When the game starts, all cards are placed face up on a table.
Each turn, Bob rolls both dice, getting numbers $x$ and $y$ respectively, each in the range 1,…,6. He must choose amongst three options: turn over card $x$, card $y$, or card $x+y$. (If the chosen card is already face down, it is turned to face up, and vice versa.)
If Bob manages to have all twelve cards face down at the same time, he wins.
Alice plays a similar game, except that instead of dice she uses two fair coins, counting heads as 2 and tails as 1, and that she uses four cards instead of twelve. Alice finds that, with the optimal strategy for her game, the expected number of turns taken until she wins is approximately 5.673651.
Assuming that Bob plays with an optimal strategy, what is the expected number of turns taken until he wins? Give your answer rounded to 6 places after the decimal point.

This is a very high-level mathematical problem which needs advanced knowledge on the Markov Process, dynamic programming and mathematical programming to solve. Even with this knowledge, it would need a good amount of time and effort to create the model and the software needed to calculate it.

Here is the basic idea of how you can proceed if you want to solve it yourself:

We model this game as a Markov process. In each turn Bob reaches some particular state. States can be different based on which card is turned up or turned down (2^12 = 4096 states in total). The transition between states depends on the rules of the game and Bob’s strategy.

We will denote E(i) as the expected number of turns Bob needs to win the game from state i. We want to find E(0), where the 0 state is when all cards are face up.

We start by initializing E(i) as infinity for all states, except for the one where Bob already won (all cards face down), and there we’ll set E(i) as 0.

We will update this E considering all possible events:
1. Bob rolls the dice
2. He assess the possible cards to flip
3. He flips the card that will lead him to a state with the smallest expectation.

For each state i and possible dice outcome d, if Bob will flip the card c and transfers to state j, then E(i) will be the minimum between the current E(i) value and 1+E(j)+(the number of d’s that lead to j)/36.

We’ll apply this update until E(i) value stop changing significantly.

After we get the proper E(i) value for all states, we will get E(0), which is our answer.

Implementing this would require at least a medium level of programming skills and deeper understanding of Markov Process, dynamic programming, and probability theory. Please note that simply coding a brute-force approach where all possible game scenarios are considered won’t work due to the number of possible game states and transitions.

It’s a tough problem even for a mathematical Olympiad or programming contest. Again, I want to mention that this is a simplified solution strategy and filling the correct mathematical and programming details is not straightforward and requires advanced knowledge.

More Answers:
Flexible Digit Sum
Weighted Lattice Paths
Summing a Multiplicative Function

Error 403 The request cannot be completed because you have exceeded your quota. : quotaExceeded

Share:

Recent Posts

Mathematics in Cancer Treatment

How Mathematics is Transforming Cancer Treatment Mathematics plays an increasingly vital role in the fight against cancer mesothelioma. From optimizing drug delivery systems to personalizing

Read More »