Four Quarters
Time limit1sMemory limit128 MB
For each round count from 1 to 20, compute the probability that A wins, B wins, or the game ties after that many rounds of this four-coin game.
- Level
Easy3 of 10
- Topics
- Probability, Dynamic programming, Simulation
- Solved
- No attempts yet
Problem
Four Quarters is a game of chance played with four 25-cent coins (quarters). Two players, A and B, each flip two coins every round. Based on the results of their own two coins, each player gains or loses points according to the tables below.
A two-coin result is distinguished only by its number of heads; Heads/Tails and Tails/Heads are treated as the same. So each player’s result is one of HH (2 heads), HT (1 head), or TT (0 heads).
Player A’s payoff (rows: A’s result, columns: B’s result)
Player B’s payoff (rows: A’s result, columns: B’s result)
As you can see, the odds are stacked in Player A’s favor. At the start of the game both players have 0 points, and points accumulate as the game progresses. When the game ends, the player with more points wins.
Write a program that determines the probability that Player A wins, Player B wins, or the game ties after a given number of rounds. Assume the coins are fair, i.e. heads and tails are equally likely.
Input
There is no input for this problem.
Output
Output a table listing the probability that Player A wins, Player B wins, or the game ties after each round, for rounds 1 through 20. Express each probability as a percentage with 4 digits after the decimal point.
Print the header line Round A wins B wins Tie first, then one line per round from 1 to 20, each containing the round number followed by the three probabilities. Match the exact spacing and formatting shown in the example output.