部品ができたのでシミュレーションして勝率を出してみる。

sim <- function(x=1:100){
count=0
while(length(x)>0){
count=count+1
x=f(x)
}
count %% 2 == 1 # is winner 1st player?
}
re=replicate(1e3,mean(replicate(1e3,sim(1:100))))
hist(re,breaks = 'scott')
summary(re)
BEST::plotPost(re)
HDInterval::hdi(re)
sum(re)
prop.test(c(500171,1e6-500171),c(1e6,1e6))