I came across this puzzle online in an online Princeton thingy (course?):
Alice writes down two integers between 0 and 100 on two cards. Bob gets to select one of the two cards and see its value. After looking at the value, Bob commits to one of the two cards. If he chooses a card with the largest value, he wins; otherwise he loses.
Devise a strategy for Bob so that he guarantees to win strictly more than half the time.
I thought about it, and the problem is that we can't presume Alice is choosing random numbers (otherwise the strategy of Bob simply choosing the other card if known value is less than 50 would be sufficient).
Any ideas on how to approach this?
Bob should start by looking at one of Alice's cards at random: call the one he chooses $A_1$ and the other $A_2$.
Bob can choose an integer $B$ in $[1,100]$ uniformly at random so that $P[B=b] = \frac{1}{100}$ and then accepts the card $A_1$ if $A_1 \ge B$ but swaps to $A_2$ if $A_1 \lt B$.
This will give a conditional probability of $\frac12$ of selecting the larger of Alice's cards when both Alice's cards are less than $B$ or both are greater than or equal to $B$, and a conditional probability of $1$ of selecting the larger of Alice's cards when one of Alice's cards is less than $B$ and the other greater than or equal to $B$.
So if the mean absolute difference between Alice's cards is $d$ then the probability of Bob choosing the larger of the two using this strategy is $\frac12+\frac{d}{200} \gt \frac12$.
Alice would be wise to ensure her two numbers only differ by $1$, in which case the probability of Bob choosing the larger of the two is $0.505$.