This week’s Riddler asks:

A basketball player is in the gym practicing free throws. He makes his first shot, then misses his second. This player tends to get inside his own head a little bit, so this isn’t good news. Specifically, the probability he hits any subsequent shot is equal to the overall percentage of shots that he’s made thus far. (His neuroses are very exacting.) His coach, who knows his psychological tendency and saw the first two shots, leaves the gym and doesn’t see the next 96 shots. The coach returns, and sees the player make shot No. 99. What is the probability, from the coach’s point of view, that he makes shot No. 100?

### Solution

We will solve by brute force: simulation!

```
# r
library(pbapply)
shootFreethrows <- function(){
shots <- c(1, 0)
for(i in 3:100){
p <- mean(shots)
shot <- sample(x = c(1, 0), size = 1, prob = c(p, 1 - p))
shots <- c(shots, shot)
}
if(shots[99] == 1){
return(shots[100])
}
}
shootFreethrowsRepeatedly <- function(){
results <- unlist(pbreplicate(10000000, shootFreethrows()))
return(mean(results))
}
shootFreethrowsRepeatedly()
```

After many, many (10,000,000) simulated games, we find that he makes his 100th freethrow **2/3rds** of the time that he makes his 99th.