**Xi'an's Og » R**, and kindly contributed to R-bloggers)

**I**n the last issue of Statistical Science, David Belhouse [author of De Moivre’s biography] and Nicolas Fillion published an accounting of a discussion between Pierre Rémond de Montmort, Nicolaus Bernoulli—”the” Bernoulli associated with the St. Petersburg paradox—, and Francis Waldegrave, about the card game of Le Her (or *Hère*, for *wretch*). Here is the abridged description from the paper:

“Le Her is a game (…) played with a standard deck of fifty-two playing cards. The simplest situation is when two players [Pierre and Paul] play the game, and the solution is not simply determined even in that situation (…) Pierre deals a card from the deck to Paul and then one to himself. Paul has the option of switching his card for Pierre’s card. Pierre can only refuse the switch if he holds a king (the highest valued card). After Paul makes his decision to hold or switch, Pierre now has the option to hold whatever card he now has or to switch it with a card drawn from the deck. However, if he draws a king, he must retain his original card. The player with the highest card wins the pot, with ties going to the dealer Pierre (…) What are the chances of each player (…) ?” (p.2)

As the paper focus on the various and conflicting resolutions by those 18th Century probabilists, reaching the solution [for Paul to win]

“where a is Paul’s probability of switching with seven, b is Paul’s probability of holding the seven, c is Pierre’s probability of switching with an eight, and d is Pierre’s probability of holding on to an eight”

[which sounds amazing for the time, circa 1713!], where I do not see how a+b or c+d are different from 1, I ran a small R code to check the probability that Paul wins if he switches when there are more larger than smaller values in the remaining cards and Pierre adopts the same strategy if Paul did not switch:

cards=rep(1:13,4) win=0 T=10^6 for (t in 1:T){ deal=sample(cards,2) #Alice has deal[1] switch=0 rest=cards[-deal[1]] if ((deal[2]<13)&(sum(rest<=deal[1])=deal[1]))){ switch=deal[2];deal[2]=deal[1];deal[1]=switch} #Bob's turn if (switch>0){ rest=cards[-deal] if (deal[2] =deal[2])){ draw=sample(rest,1) if (draw<13) deal[2]=draw}} win=win+(deal[2]>=deal[1]) } 1-win/T

Returning a winning probability of 0.5128 [at the first try] for Paul. However, this is not necessarily the optimal strategy for either Paul or Pierre!

Filed under: Books, Kids, R, Statistics

**leave a comment**for the author, please follow the link and comment on their blog:

**Xi'an's Og » R**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...