Review Assessment

This classic game show would hide a sports car behind one of three (3) doors - 1, 2, or 3. Behind the other two doors were goats (sometimes called zonks). If you select the door with the car you get to keep it! (The host knows where the car is.)


But there's a trick! (because of course there is)


After the contestant locks in their choice, the host, Monty Hall, would reveal (open) one of the other doors with a goat. Then the contestant was asked if they wanted to stick with their original choice or switch their selection to the other door. After which the prize (or goat) was revealed.

You are going to code this game - Solo or in pairs.

Requirements

  • The game starts with three closed doors (1, 2, and 3). These could be images, buttons, text... you name it. One of them is the car and the others are not!

  • The user is asked to select a door. The selection could be done by clicking a button under the door, clicking the door itself, entering a number... that's up to you.

  • You could use the JavaScript confirm( ) function to confirm their selection (if they click cancel - nothing should happen, if they click ok - their selection is made).

  • Reveal one of the other doors that contains a goat.

  • Now we will ask the user if they want to stick or switch.

    • Maybe show two buttons, one that says "Stick" and one that says "Switch", or some way of asking them after the goat is revealed.

  • Once the user decides to stick or switch, the results are revealed! They either go home with a goat or an awesome car.

Want to take it to the next level? (optional upgrades)

  • Add the ability to play again and keep a tally of wins & losses.

    • Even better - keep a running tally of the number of times they win based on if they stick or if they switch.


Note: There are some images inside the images folder you can use - or you can use your own. Or none.

Have fun and don't forget to learn while you work.