## Riddler Express

I have three dogs: Fatch, Fetch and Fitch. Yesterday, I found a brown \(12\)-inch stick for them to play with. I marked the top and bottom of the stick and then threw it for Fatch. Fatch, a Dalmatian, bit it in a random spot — leaving a mark — and returned it to me. In her honor, I painted the stick black from the top to the bite and white from the bottom to the bite.

I subsequently threw the stick for Fetch and then for Fitch, each of whom retrieved the stick by biting a random spot. What is the probability that Fetch and Fitch both bit the same color (i.e., both black or both white)?

## Solution

The three bite marks can be permuted in \(3! = 6\) ways all of which are *equally* likely because of symmetry. Out of the \(6\) permutations, there are \(4\) permutations where the bite marks of Fitch and Fetch lie on one side of the bite mark of Fatch. Therefore, the probability that Fetch and Fitch both bit the same color is \(\textbf{2/3}\).

From the simulation below, we see that the probability that Fetch and Fitch both bit the same color is indeed \(\textbf{0.667}\).

```
from random import random
def prob(runs = 1000000):
= 0
succ_cnt for _ in range(runs):
= random(), random(), random()
fa, fe, fi if (fe < fa and fi < fa) or (fe > fa and fi > fa):
+= 1
succ_cnt return succ_cnt/runs
print(prob())
```

## Riddler Classic

Italy defeated England in a heartbreaking (for England) European Championship that came down to a penalty shootout. In a shootout, teams alternate taking shots over the course of five rounds. If, at any point, a team is guaranteed to have outscored its opponent after five rounds, the shootout ends prematurely, even if each side has not yet taken five shots. If teams are tied after five rounds, they continue one round at a time until one team scores and another misses.

If each player has a \(70\) percent chance of making any given penalty shot, then how many total shots will be taken on average?

## Computational Solution

From the simulation below, we see that the total shots taken on average is \(\textbf{10.47}\).

```
def avg_total_shots(p, runs = 1000000):
from random import random
= lambda p: 1 if random() < p else 0
shot def game_over(t1, t2, g1, g2):
return 1 if max(5-t1, 0) + g1 < g2 or max(5-t2, t1-t2) + g2 < g1 else 0
= 0
sum_ts for _ in range(runs):
= 0, 0, 0, 0
t1, t2, g1, g2 while True:
= t1 + 1, g1 + shot(p)
t1, g1 if game_over(t1, t2, g1, g2):
break
= t2 + 1, g2 + shot(p)
t2, g2 if game_over(t1, t2, g1, g2):
break
+= t1+t2
sum_ts return sum_ts/runs
print(avg_total_shots(0.7))
```