18/09/26 11:07:08.91 Rj8Wp2L9.net
b=0
w=1
bwb=function(x){
n=length(x)
if(n<3) return(F)
else x[n-2]==b & x[n-1]==w & x[n]==b
}
f = function(){
x=NULL
while(!bwb(x)){
x=c(x,sample(c(b,w),1,prob=c(0.2,0.8)))
}
c(W=sum(x==w),B=sum(x==b))
}
re=replicate(1e4,f())
mean(re[1,])
mean(re[2,])