# Midterm Project Progress

Concept

For my midterm project, I have decided to implement a puzzle for the user to solve, “Black and White Hat Puzzle”. The puzzle typically goes something like this:

There are 5 hats: 3 black and 2 white. Three characters can see each other’s hats but not their own. They must figure out the color of their own hat based on what they see on the others’ heads, using logic and deduction.

Design

I will implement this puzzle as the user to be one of the three characters wearing a hat, and can see the other two people’s hat. The user needs to correctly guess the hat color he/she is wearing. The user can make only 2 guesses.

If the user can’t make the right guess, the solution will be presented to the user.

A simple wireframe:

Challenging Part

• Drawing the each elements and characters on the canvas
• Assigning the hats randomly to the characters and displaying it
• Building the algorithm behind explaining how the user should solve the puzzle correctly.

Risk Prevention

• I will not draw everything on the canvas, but I will draw them on my ipad and insert them as images to the canvas.
• Assign each of the hats values (and an image of white or black hat) and randomly choose one of them and display it on the screen (on each characters’ head). But the hat of the user must be hidden until user makes the correct guess or two guesses.
• Depending on the other two characters’ hat, the guessing logic must be one of the following:
1. If a character sees that both of the other characters are wearing white hats: In this case, the character deduces that their own hat must be black. This is because if they were also wearing a white hat, it would mean that there are two white hats in total, which contradicts the given hat distribution.
2. If a character sees one white hat and one black hat on the other two characters: In this scenario, the character cannot deduce the color of their own hat based solely on this information. They don’t have enough information to determine their own hat color. Their guess would be uncertain.
3. If a character sees that both of the other characters are wearing black hats: In this situation, the character can deduce that their own hat must be white. This deduction is made based on the knowledge that there are only two white hats and three black hats in total. If they were also wearing a black hat, it would result in three black hats, which contradicts the given hat distribution.