Games, Hats, and Codes - PowerPoint PPT Presentation

games hats and codes n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Games, Hats, and Codes PowerPoint Presentation
Download Presentation
Games, Hats, and Codes

play fullscreen
1 / 104
Games, Hats, and Codes
284 Views
Download Presentation
kezia
Download Presentation

Games, Hats, and Codes

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Games, Hats, and Codes Mira Bernstein Wellesley College SUMS 2005

  2. A game with hats (N=3) Each player is randomly assigned a red or blue hat.

  3. A game with hats (N=3) Each player can see the color of his teammates’ hats but not his own.

  4. A game with hats (N=3) BLUE PASS RED Players simultaneously guess the colors of their own hats. Passing is allowed.

  5. A game with hats (N=3) BLUE PASS RED At least one correct guess No incorrect guesses WIN!

  6. 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%?

  7. 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.

  8. Possible hat configurations Guesses #1 #2 #3

  9. Possible hat configurations Guesses #1 #2 #3

  10. Possible hat configurations Guesses #1 #2 #3

  11. Possible hat configurations Guesses #1 #2 #3

  12. Possible hat configurations Guesses #1 #2 #3

  13. Possible hat configurations Guesses #1 #2 #3

  14. Possible hat configurations Guesses #1 #2 #3 X √ √ √ √ √ √ X

  15. Possible hat configurations Probability of winning: 75% X √ √ √ • How is this possible? • Can we do better? • What about N >3? √ √ √ X

  16. Possible hat configurations Guesses #1 #2 #3

  17. Guesses #1 #2 #3 6 correct guesses 6 incorrect guesses # correct = # incorrect

  18. 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

  19. 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

  20. 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.

  21. 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.

  22. Do perfect strategies actually exist? #1 #2 #3 N = 3: Yes! Other N?

  23. 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

  24. 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

  25. 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

  26. 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

  27. 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.

  28. 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. 

  29. 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.

  30. 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!

  31. A perfect code H

  32. A perfect code H = points of L

  33. A perfect code H = points of L

  34. 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

  35. 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.

  36. Example: N=3 L = {000,111} 011 111 001 101 010 110 000 100

  37. Example: N=3 L = {000,111} 011 111 001 101 010 110 000 100

  38. 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.

  39. 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.

  40. 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.

  41. 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,…?

  42. Error-correcting codes I love you! 11010… I love you too! 11010…

  43. Error-correcting codes I love you! 11010… You what? 10010…

  44. Error-correcting codes I love you! 1001100

  45. Error-correcting codes I love you! 1001100 1000100

  46. Error-correcting codes I love you! 1001100 1000100

  47. Error-correcting codes I love you! 1001100 I love you too! 1001100

  48. A different game: Nim Rules Take any number of stones from any one pile B A

  49. A different game: Nim Rules Whoever takes the last stone wins the game B A

  50. A different game: Nim B A