Question: In a TV game, called Win a Car, there are three doors on the stage. Behind these doors, there are two sheep and one car.
In a TV game, called Win a Car, there are three doors on the stage. Behind these doors, there are two sheep and one car. The player is asked to choose one door, then the president will open one of the other two doors behind which is a sheep. Then the president asks the player to make a second choice between the two closed doors. Finally, the closed two doors are also opened, if the car is behind the door that the player chose, she wins the car.
Use basic HTML5/CSS/JavaScript to implement this game.
Opening Page: Title of the game. Text showing hints along the game. There are three score boxes, at the beginning, all show 0. The total score shows total number of games played, the stay score shows the number of games that the player won by staying on her first choice, the switch score shows the number of games that the player won by switching her chosen door to the unchosen door after one door is opened by the president.
1. The player choose one door by clicking on it, the chosen door is highlighted. The hint changes into: I will open one unchosen door now
2. After 5 seconds, one unchosen door with a sheep behind it is opened. The hint changes into: Haha, here is a sheep!
3. After another 5 seconds, the hint changes into: Please make a second choice
4. The player click on one of the unopened door to make a second choice. Highlight the door the player clicked. She may click the first-chosen one, i.e. she stays on her first choice, the hint changes into: you stay your choice; if she clicks the unchosen one, i.e. she switches her first choice, the hint changes: you switched your choice.
5. After another 5 seconds, the hint changes into: Behold, all doors will be opened now!
6. After another 5 seconds, all doors are opened. If the player wins the game, the hint changes into: You win the car, congratulations! Otherwise, the hint changes into: You lost the game. In either case, the scores are updated accordingly.
7. After another 5 seconds, the hint changes into: play again.
8. After another 5 second, the game restarted with all doors closed but keep the previous scores.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
