## Riddler Classic

Robin of Foxley has entered the FiveThirtyEight archery tournament. Her aim is excellent (relatively speaking), as she is guaranteed to hit the circular target, which has no subdivisions — it’s just one big circle. However, her arrows are equally likely to hit each location within the target.

Her true love, Marian, has issued a challenge. Robin must fire as many arrows as she can, such that each arrow is closer to the center of the target than the previous arrow. For example, if Robin fires three arrows, each closer to the center than the previous, but the fourth arrow is farther than the third, then she is done with the challenge and her score is four.

On average, what score can Robin expect to achieve in this archery challenge?

Extra credit: Marian now uses a target with \(10\) concentric circles, whose radii are \(1, 2, 3,\) etc., all the way up to \(10\) — the radius of the entire target. This time, Robin must fire as many arrows as she can, such that each arrow falls within a smaller concentric circle than the previous arrow. On average, what score can Robin expect to achieve in this version of the archery challenge?

## Computational Solution

```
from random import random
= 1000000
runs
def avg_score_challenge1():
= 0
total_cnt for _ in range(runs):
= random()
prev_pos = 1
cnt while(True):
=random()
cur_pos+= 1
cnt if cur_pos < prev_pos:
= cur_pos
prev_pos else:
break
+= cnt
total_cnt return total_cnt/runs
def avg_score_challenge2():
= 10
n = [(i,i**2/n**2, (i+1)**2/n**2) for i in range(n)]
interval_to_circle def number_to_circle(p):
for i,s,e in interval_to_circle:
if s < p and p < e:
return i
= 0
total_cnt for _ in range(runs):
= number_to_circle(random())
prev_pos = 1
cnt while(True):
= number_to_circle(random())
cur_pos += 1
cnt if cur_pos < prev_pos:
= cur_pos
prev_pos else:
break
+= cnt
total_cnt return total_cnt/runs
print(avg_score_challenge1(), exp(1))
print(avg_score_challenge2())
```