IBM Ponder This 07-15 Solved

Credited with solving this puzzle:

Ponder This Challenge:

Four people stand in line with hats on their heads. On the back of each hat is a unique number (i.e., no two people have the same number) between 1 and 6. Each person can see only the numbers of the people in front of him. One by one, starting from the back of the line, they need to guess the number on their own head, but they are not allowed to use any number that was previously guessed. Since they guess out loud, all the people in line hear each other’s guesses. Clearly, the last person in line (who is the first to guess) cannot guarantee being correct. Our challenge this month is to show that all the rest can.

Your challenge is to provide the strategy of the last person (the first to guess) in guessing a number between 1 and 6, as a function of the other three numbers he sees. Please provide your answer as a list of 216 digits: 1-6 for a guess, and 0 for the illegal cases (when not all the three numbers are different as they should be).

For example, here is a solution for the trivial case when the numbers are only in 1-4 range:

0000 0043 0402 0320
0043 0000 4001 3010
0402 4001 0000 2100
0320 3010 2100 0000

In this case, the last person actually knows his number as the one missing from the rest. For example, the first zero represents the illegal case when he sees “1, 1, 1”; the first nonzero number (4) corresponds to the case when he sees “1, 2, 3” in front of him; the next number (3) is used when he sees “1, 2, 4”, etc. As a side note just to better explain the game, the second guesser sees two hats in front of her, and hears the guess of the person behind her and can therefore deduce her number; etc.

As we said before – we are only looking for the strategy used by the last person in line.

 

Solved this one without writing any code, here was my approach that I described in my submission:

Attached is a cheat sheet that each individual on line could use to uniquely determine their own value by that which they see and what they hear.  It is essentially a 6x6x6 cube broken into six 2d tables representing the possible configuration of the 3 hats that the last person sees.  The values in each cell are the number he calls out.  The top left corner of each table represents the number of the 3rd person on line, the horizontal the 2nd and the vertical the 1st.
What I found entertaining was that to produce this cheat sheet I needed to essentially play a game of 3 dimensional Sudoku where each row, column, and depth must contain each number between 1 and 6 only once and of course also not match the row, column or depth number of the cell it is placed in.  This arrangement ensures that each configuration is uniquely defined by the numbers seen and heard.
Solution: 00000000634504056206502303260405423000456300000050061460103506301305140060245500614000000250061640102410520056032305061610025000000261003532010032604604103460201316002000000241300045320401530250140532010314200000000

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.