Presentation is loading. Please wait.

Presentation is loading. Please wait.

Beat The Game Show By Ben Witman. Beat The Game Show By Ben Witman.

Similar presentations


Presentation on theme: "Beat The Game Show By Ben Witman. Beat The Game Show By Ben Witman."— Presentation transcript:

1

2 Beat The Game Show By Ben Witman

3 Why Interviews many times ask questions like this to see how you approach problems This problem is heavily numerical and some aspects are CS-specific

4 Goal Find a strategy that you and your friends can use to ALWAYS WIN the game show. You and your friends can talk strategy as much as you want before the game starts. The game show will be described in the following slides

5 Overview This game show involves you and four friends (five total people) During the entire game show, no communication or hinting outside of what is explicitly defined is not allowed NO blinking, winking, reflections, writing, etc.

6 Stage 1 Your 4 friends are brought into a room and randomly arranged in a square in the middle of the room Each friend is given a hat with a number between 1 and 16. There can be two or more hats with the same number. Each friend can see all the hats BUT his/her own hat.

7 Stage 2 You are brought into another room where you can see your friends (and their hats) through T.V. screens. You have 2 tickets (one red, one blue). You must send each ticket to one of your friends (or both tickets to the same person). Nothing can be written on the tickets. The tickets can not be given in certain order. Everyone sees the host deliver what color ticket went to what person.

8 Stage 3 Once the tickets are delivered, each friend is taken into separate rooms and interviewed. To win the game, each friend must know the number on the hat they were given.

9 Simplify? Can you come up with a simpler version?
Less friends? Less tickets? How are the hat numbers affected? No certain way to simplify the problem

10 Working Backwards… The Goal: Each friend must know his/her hat number.
Each person knows everyone else’s hat numbers. What other information does a person need to know the number on his/her hat? Lets do an example to see.

11 Draw a Picture / Example
You 4 Friends with names: F1, F2, F3, F4 F1 has a hat with number 4 F2 has a hat with number 7 F3 has a hat with number 13 F4 has a hat with number 3 What can each person see? What can be calculated from what they see? 4 7 F1 F2 F3 F4 13 3

12 Draw a Picture / Example
27 You Let’s sum up the numbers that each person can see What do we have to “tell” the friends in order to have them determine their number. 4 7 23 20 F1 F2 F3 F4 14 24 13 3

13 So Far We have learned that we need to somehow “tell” the friends what the total sum is. Let’s analyze what we have at our disposal to communicate to our friends.

14 Tickets We have 2 tickets (one blue, one red) and we can send each to a friend, or both to the same friend. How many different combinations are there for two tickets and four friends?

15 Tickets Brute Force (Listing Combinations): Red: F1 | Blue: F1

16 Tickets Formula: Each card is independently selected so: (4 choices for red card) · (4 choices for blue card) 4 · 4 = 16 possible combinations Therefore we can effectively send 16 different signals to our friends.

17 Problem The sum can be anything between:
4 (all four friends have hats with a 1 on it) 64 (all four friends have hats with a 16 on it) 60 different possibilities We can’t simply send the sum to the friends.

18 Recap You can send 16 different signals to your friends.
They can see the sum of all the numbers but their own. You want to signal them the total sum (between 4 and 64), but you can’t because you only have 16 different signals.

19 Simplify At this point the problem is: Simplification:
16 different signals can be sent by you 4 friends · (1 to 16) = 4 to 64 are the possible sums Simplification: 2 different signals 4 friends · (1 to 2) = 4 to 8 are the possible sums

20 Simplified Example Sum between 4 and 8 Hats between 1 and 2
5 Sum between 4 and 8 Hats between 1 and 2 F1: 1 F2: 2 F3: 1 F4: 1 You have 2 different signals What should you use them for? You 1 2 4 3 F1 F2 F3 F4 4 4 1 1

21 Simplified Example 5 If one signal mean odd and the other is even each person can figure out what number is on their head. You 1 2 4 3 F1 F2 F3 F4 4 4 1 1

22 Simplified Example Restated you can say: 0 means the sum is
5 Restated you can say: 0 means the sum is 4 or 6 or 8 1 means the sum is: 5 or 7 You 1 2 4 3 F1 F2 F3 F4 4 4 1 1

23 Simplified Example 2 Sum between 4 and 16 Hats between 1 and 4
11 Sum between 4 and 16 Hats between 1 and 4 F1: 1 F2: 3 F3: 3 F4: 4 You have 4 different signals What should you use them for? You 1 3 10 8 F1 F2 F3 F4 8 7 3 4

24 Simplified Example 2 0 means the sum is 1 means the sum is:
11 0 means the sum is 4 or 8 or 12 or 16 1 means the sum is: 5 or 9 or 13 2 means the sum is 6 or 10 or 14 3 means the sum is: 7 or 11 or 15 You 1 3 10 8 F1 F2 F3 F4 8 7 3 4

25 Actual Problem Let 0 = 16, 32, 48, 64 Let 1 = 17, 33, 49
Let 13 = 29, 45, 61 Let 14 = 30, 46, 62 Let 15 = 31, 47, 63

26 Solution – Part 1 (Mod) You calculate the sum of the hats
To determine what number to be sent, a simple operation can be used: SUM % 16 % - the mod operator (C, C++, Java…) The remainder after division

27 Solution - Part 2 (Bases)
Assign each friend 2 numbers F1: Red = 0, Blue = 0 F2: Red = 4, Blue = 1 F3: Red = 8, Blue = 2 F4: Red = 12, Blue = 3 Based on what you send, you can send the SUM % 16. This is a classic example of a base In this case we are converting from base 4 to base 10

28 Solution - Part 3 (Subtract)
Based on what number you send AND what sum they see, each friend can determine the total sum and therefore his/her number For example: F1 sees sum of 26 and you signal 8 Recall: Let 8 = 24 or 40 or 56 Total can’t be 24, his/her number would have to be -2 Total can’t be 56, his/her number would have to be 30 Total therefore must be 40 40 – 26 = 14 (which must be his/her number)


Download ppt "Beat The Game Show By Ben Witman. Beat The Game Show By Ben Witman."

Similar presentations


Ads by Google