Le Monde puzzle [#1120]
[This article was first published on R – Xi'an's Og, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
A board game as Le weekly Monde current mathematical puzzle:
11 players in a circle and 365 tokens first owned by a single player. Players with at least two tokens can either remove one token and give another one left or move two right and one left. How quickly does the game stall, how many tokens are left, and where are they?
The run of a R simulation like
od=function(i)(i-1)%%11+1 muv<-function(bob){ if (max(bob)>1){ i=sample(rep((1:11)[bob>1],2),1) dud=c(0,-2,1) if((runif(1)<.5)&(bob[i]>2))dud=c(2,-3,1) bob[c(od(i+10),i,od(i+1))]=bob[c(od(i+10),i,od(i+1))]+dud } bob}
always provides a solution
> bob [1] 1 0 1 1 0 1 1 0 1 0 0
with six ones at these locations. However the time it takes to reach this frozen configuration varies, depending on the sequence of random choices.
To leave a comment for the author, please follow the link and comment on their blog: R – Xi'an's Og.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.