During the holy month of Ramadan, Rami and Yassine have a special tradition. Every night, after breaking their fast at iftar, they head to their favorite coffee place to engage in friendly games while waiting for suhoor. One evening, they decide to play a modified version of Rock-Paper-Scissors as a card game.
There are only three types of cards: Rock, Paper, and Scissors.
- Rami starts with $$$R_1$$$ Rock cards, $$$P_1$$$ Paper cards, and $$$S_1$$$ Scissors cards.
- Yassine starts with $$$R_2$$$ Rock cards, $$$P_2$$$ Paper cards, and $$$S_2$$$ Scissors cards.
- The total number of cards for Rami is $$$n_1 = R_1 + P_1 + S_1$$$, and for Yassine, it is $$$n_2 = R_2 + P_2 + S_2$$$.
- Both players know the composition of each other's deck before the game starts.
- Before playing, each player privately shuffles their deck, so that it is impossible for the opponent to gain any insight into the order of their cards.
The game proceeds in turns as follows:
- Card Selection:
- Each player privately inspects his deck, and chooses a single card.
- The selection is made simultaneously, and neither player knows the opponent's choice beforehand.
- Card Reveal & Outcome:
- Both players reveal their chosen card at the same time.
- The result follows standard Rock-Paper-Scissors rules:
- Rock beats Scissors
- Scissors beats Paper
- Paper beats Rock
- If both players select the same type, it is a draw.
- Card Handling:
- If a player wins a round, their opponent's card is discarded permanently. The winning player keeps their card and returns it to their deck.
- If the round is a draw, both players take back their respective cards.
- Winning Condition:
- A player loses immediately if their deck no longer contains at least one of the three card types (Rock, Paper, or Scissors).
- The game continues until one player loses.
Now both players play optimally, and fairly:
- Both players play optimally, meaning they make decisions to maximize their probability of winning the game.
- Both players play fairly, meaning they do not cheat, communicate, or exploit unintended mechanics.
Given the initial deck compositions $$$R_1, P_1, S_1$$$ for Rami and $$$R_2, P_2, S_2$$$ for Yassine, compute the probability of each player winning the game.
Note
The first test case corresponds to a traditional rock paper scissor game. It can be proven that the optimal strategy for each player, is to choose any card, with the same probability.