1.07k likes | 1.4k Views
Games, Hats, and Codes. Mira Bernstein Wellesley College SUMS 2005. A game with hats (N=3). Each player is randomly assigned a red or blue hat. A game with hats (N=3). Each player can see the color of his teammates’ hats but not his own. A game with hats (N=3). BLUE. PASS. RED.
E N D
Games, Hats, and Codes Mira Bernstein Wellesley College SUMS 2005
A game with hats (N=3) Each player is randomly assigned a red or blue hat.
A game with hats (N=3) Each player can see the color of his teammates’ hats but not his own.
A game with hats (N=3) BLUE PASS RED Players simultaneously guess the colors of their own hats. Passing is allowed.
A game with hats (N=3) BLUE PASS RED At least one correct guess No incorrect guesses WIN!
Some observations • A player gets NO information about his own hat from looking at his teammates’ hats • NO strategy can guarantee victory • Easy strategy: one player guesses, everyone else passes. • Can the players do better than 50%?
A better strategy for N=3 Instructions for all players: If you see two hats of the same color, guess the other color. If you see two different colors, pass.
Possible hat configurations Guesses #1 #2 #3
Possible hat configurations Guesses #1 #2 #3
Possible hat configurations Guesses #1 #2 #3
Possible hat configurations Guesses #1 #2 #3
Possible hat configurations Guesses #1 #2 #3
Possible hat configurations Guesses #1 #2 #3
Possible hat configurations Guesses #1 #2 #3 X √ √ √ √ √ √ X
Possible hat configurations Probability of winning: 75% X √ √ √ • How is this possible? • Can we do better? • What about N >3? √ √ √ X
Possible hat configurations Guesses #1 #2 #3
Guesses #1 #2 #3 6 correct guesses 6 incorrect guesses # correct = # incorrect
Why? The same instructions that lead to a correct guess in one situation… BLUE Player #3 … will lead to an incorrect guess in another. BLUE Player #3
In general… If the game is played once with each possible configuration of hats, then # correct guesses = # incorrect guesses True for any number of people N True for any deterministic strategy S
Why does the N=3 strategy work? #1 #2 #3 It takes only one correct guess to win! Strategy: Spread out the good guesses. Concentrate the bad guesses.
In general… • When played over all hat combinations with N players, any strategy produces k correct guesses and k incorrect guesses. (The value of k depends on the strategy.) • Best possible guess arrangement: • 1 correct guess per winning combination • N incorrect guesses per losing combination • A strategy which achieves this is called a perfect strategy.
Do perfect strategies actually exist? #1 #2 #3 N = 3: Yes! Other N?
Some terminology H: set of all possible hat configurations (sequences of 0s and 1s) Distance in H: number of places in which two elements of H differ. 1 0 0 1 0 1 1 0 1 1 0 1 1 0 1 0 0 1 Distance: 2
Some terminology Ball of radius r around h H: the set of all configurations whose distance from h is at most r. h: 1 0 0 1 B1(h): 0 0 0 1 1 1 0 1 1 0 1 1 1 0 0 0 | B1(h)| = N+1 center 1 0 0 1
Some terminology • S: a (deterministic) strategy • L: set of all hat configurations where a team playing according to S loses • W: set of all hat configurations where a team playing according to S wins L W = H
An important fact Suppose h and h’ are elements of H that differ only in the i th entry. If, according to strategy S, Player i guesses correctly in h, then he guesses incorrectly in h’, and vice versa. 4th player’s guess h: 0 1 0 0 1 0√ h’: 0 1 0 1 10X
Corollaries Theorem 1: Every element h W is within distance 1 of some element of h’ L. Proof:Suppose Player j guesses correctly in h. Let h’ be the hat configuration that differs from h only in the j th entry. Then Player j must guess incorrectly in h’, so h’ is in L.
Corollaries Theorem 2: In a perfect strategy S, every element h W is within distance 1 of exactly one element of L. Proof: Suppose h differs from h1 L in the ith entry and from h2 L in the jth entry. Since S is a perfect strategy, all players guess incorrectly in h1 and h2. But then Players i and j must both guess correctly in h, which cannot happen in a perfect strategy.
Corollaries In other words…. Theorem 1:Every element h H is contained in a ball of radius 1 around some element of L. Theorem 2: In a perfect strategy S, the balls of radius 1 around elements of L do not overlap.
Codes A perfect code of length N is a subset L in H such that the balls of radius 1 around points of L • include all of H • do not overlap A perfect strategy yields a perfect code!
A perfect code H = points of L
A perfect code H = points of L
Perfect code perfect strategy Instructions for Player i: • If the hat configuration might be in L: Guess so that if it’s in L, you’ll be wrong. • If you can tell that the hat configuration is not in L: Pass
Perfect code perfect strategy Results (for hat configuration h): • If h is in L: Every player guesses wrong. • If the hat configuration h is not in L: There is a unique element h’ of L which differs from h in one place -- say the i th place.The i th player can’t tell if the configuration is h or h’, so he guesses away from h’, correctly. All others pass.
Example: N=3 L = {000,111} 011 111 001 101 010 110 000 100
Example: N=3 L = {000,111} 011 111 001 101 010 110 000 100
Example: N=3 L = {000,111} Instructions for Player i: • If the hat configuration might be in L, guess so that if it’s in L you’ll be wrong. Translation: If you see two 0’s or two 1’s, guess the opposite number.
Example: N=3 L = {000,111} Instructions for Player i: • If you can tell that the hat configuration is not in L, pass. Translation: If you see two different numbers, pass.
How good are perfect strategies? Theorem: If S is a perfect strategy for N players then the probability of winning is N/N+1. Proof: In every ball, N out of the N+1 points correspond to winning configurations. Example: If N=3, the probability of winning with a perfect strategy is ¾. There can be no better strategy than the one we found.
Do perfect codes exist for N>3? Theorem: A perfect code of length N can exist only if N=2m-1 for some integer m. Proof:A perfect code splits H into disjoint balls of radius 1. Each of the balls has N+1 points and H has 2N points, so 2N is divisible by N+1. Thus N+1 is a power of 2, so N=2m-1. Example: We know a perfect code of length 3 = 22-1. But what about 7, 15, 31,…?
Error-correcting codes I love you! 11010… I love you too! 11010…
Error-correcting codes I love you! 11010… You what? 10010…
Error-correcting codes I love you! 1001100
Error-correcting codes I love you! 1001100 1000100
Error-correcting codes I love you! 1001100 1000100
Error-correcting codes I love you! 1001100 I love you too! 1001100
A different game: Nim Rules Take any number of stones from any one pile B A
A different game: Nim Rules Whoever takes the last stone wins the game B A