# Riddler Coinball

Coinball is a contest where two players take turns trying to call a fair coin toss. The game lasts for 100 total tosses, 50 tosses for each player. On each toss, the player calling it announces either “heads” or “tails” and either “rush” or “pass.” If he says “rush,” he gets one point if he calls the toss correctly, and his opponent gets one point if the call is incorrect. Saying “pass” means the toss is worth two points to the caller if he calls the toss correctly and two points to his opponent if he does not. At the end, the player with the most points wins. (The margin of victory is irrelevant; in Coinball, league rankings are based only on wins, with a draw counting as half a win.)

- If you know your opponent always calls “rush” and you follow the optimal strategy given that knowledge, what are your chances of winning?
- What if you know your opponent always calls “pass”?
- If you and your opponent both play optimally, is it better to go first? Or to go second and therefore get the last call?

## Answer

More interesting to me than the questions asked would be the optimal policy for these games against the described strategies. After running the calculations for expected return the optimal policy is much more complex than the expected “go for 2 when behind”. Also the policy maps are very different depending on whether you go first or second.

### Reading the Policies

- You take your turn left to right.
- Purple is going for 2
- White is going for 1
- 10 on the y axis is a tie game

#### Against Run Going First/Second

#### Against Pass Going First/Second

#### Against Optimal Going First/Second

Check the code out here