Thursday, April 9, 2009

The 1-to-100 Game

Let's analyze a two-person game. Fred picks two distinct integers between 1 and 100 inclusive. Fred writes the numbers down on two cards (one red card and one blue card), and places them face down on the table. Ginger picks a card, and looks at the number. Now she must decide whether to keep her card ("stand"), or swap with the other card (which is still face down). She wins $1 if she picks the greater number, and wins $0 otherwise.

Can she do better than an expected value of $0.50? What is Fred's best strategy? What is Ginger's?

[It turns out that the kids have actually been playing this game in math class at school, but apparently haven't analyzed it.]

They said, Ginger should look (at which card? not specified) and if the card is less than 50 then swap, otherwise stand. I said, what if Fred always writes down 2 on the red card, and 1 on the blue card. If Ginger always looks at the red card she will be fooled.

[There's another variant of the game, where Fred gets to choose which number Ginger gets to look at, which is even worse for Ginger.]

But then Ginger, if she knows Fred will do that, will always swap if she sees a two.

But then Fred will sometimes feed Ginger a 2 and a 3.

So how to fix this? We made a rule that Ginger must write down her algorithm, and then Fred can exploit any loopholes in her algorithm.

I gave them a hint. Ginger should flip a coin to determine which card to look at. (The kids said "no fair, you didn't say we could flip a coin!". I said "I'm telling you now. Coin flipping is sometimes the best way to make decisions that can handle certain adversaries.")

How to get started on analyzing the game? What if we play the 1-2 game. Fred picks two distinct numbers in the range 1 to 2. Ginger picks one number. The kids immediately saw that if Ginger sees 1 then swap, otherwise she stands, and she always wins. Fred's has no choice.

What if we play the 1-2-3 game. Fred picks two distinct numbers in the range 1 to 3. The kids argued that Fred should never pick the pair 1 and 3, because if Ginger ever sees a 1 she swaps, and if she ever sees a 3 she stands, so 1 and 3 is a loser for Fred. So Fred should always pick a 2. It took a little bit of thinking for the kids to convince themselves that Fred should sometimes pick 1 and sometimes 3 for the other number. They concluded that a coin flip is good, and that Ginger can get $0.75 expected value.

At this point the 5-minutes ran out, and one kid wanted to proceed to analyze the 1-2-3-4 game, so the other went to read about vampires or something.... The 1-2-3-4 game was a tough nut to crack for a 12-year old. The only reasonable choices for Fred are 1-2, 2-3, or 3-4. But what odds should Fred use to choose? We guessed that 2-3 should be chosen 1/2 the time, and the others 1/4 of the time each. That gave Ginger a $0.75 expected value. Then we tried choosing each pair 1/3 of the time, and that gave Ginger a $2/3 expected value. We argued that any deviation from equal odds gave Ginger more money.

No comments:

Post a Comment

About Me

I work in the Google cloud now. Previously I worked in the Oracle cloud and before that I was research faculty at MIT, and Chief Architect at Tokutek. Before that I worked at Akamai, was a Yale CS professor, and worked at Thinking Machines.