In a dice game, we roll three dice at once, and we can reroll any number (0, 1, 2, or 3) of the dice twice. We win if the same number appears on all three dice after the final roll. What is the best strategy, and what is the percentage chance of winning if we follow it?

---

Translate the above text into English, please retain the original text's line breaks and format, and output the translation result directly.
Solution. The first roll can have three possible outcomes.

I. The same number appears on all three dice. The probability of this is $\frac{6}{6^{3}}=\frac{1}{36}$.

II. Two rolls result in the same number, while the third is different. The number of such cases is $6 \cdot 5 \cdot 3=90$, and the probability is $\frac{6 \cdot 5 \cdot 3}{6^{3}}=\frac{5}{12}$. In this case, we roll the one die that differs from the other two again.

Then, with a probability of $\frac{1}{6}$, we roll the number on the other two dice, and with a probability of $\frac{5}{6}$, we roll a different number.

A third roll is needed in the latter case, with the outcomes having probabilities of $\frac{1}{6}$ and $\frac{5}{6}$, respectively.

Let's visualize the possibilities with a directed graph. The "+" sign indicates a win, and the "-", a loss.

![](https://cdn.mathpix.com/cropped/2024_05_02_9eea8daaa7c439d56b17g-1.jpg?height=540&width=1198&top_left_y=581&top_left_x=453)

III. Different numbers appear on all three dice, for which there are $6 \cdot 5 \cdot 4=120$ possibilities. Therefore, the probability of this is $\frac{120}{6^{3}}=\frac{5}{9}$.

In this case, we have two options to win: 1) Roll all three dice again. 2) Roll two dice again.

Cases 1) and 2) are essentially the same, as in case 2), by singling out one die, the number on it can be considered the same as the number on the die left unchanged in case 1). So let's consider case 1). In this case, the probabilities are the same as those determined for the first roll. Thus, the graph can be easily extended. If we roll all three dice again after the second roll and get three different numbers again, the probability of rolling the same numbers is $\frac{1}{6}$, and the probability of not doing so is $\frac{35}{36}$.

The probability of winning is therefore:

$$
\begin{aligned}
p & =\frac{1}{36}+\frac{5}{12} \cdot \frac{1}{6}+\frac{5}{12} \cdot \frac{5}{6} \cdot \frac{1}{6}+\frac{5}{9} \cdot \frac{1}{36}+\frac{5}{9} \cdot \frac{5}{12} \cdot \frac{1}{6}+\frac{5}{9} \cdot \frac{5}{9} \cdot \frac{1}{36}=\frac{2539}{11664} \approx \\
& \approx 0.2177=21.77 \%
\end{aligned}
$$