This is a well-known game, frequently shown on TV.
... Suppose you’re on a game show, and you’re given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what’s behind the doors, opens another door, say No. 3, which has a goat. He then says to you, “Do you want to pick door No. 2?” Is it to your advantage to switch your choice?
Ms. vos Savant proved that it is to your advantage to switch. But many of her readers, including some mathematics professors, disagreed, arguing that the probability would not change because another door was opened.
B. Your project:
This is E6.22 in our textbook. It sounds like a lot but you might not have realized how much you have learnt. Give a try, don't worry if you could not make it work because it will be discussed in the next class.
Use Math.random() to get a random number, but you need to research and figure out how to generate a random number between 1-3.
If looping 1000 times is too much to test, first try 10 times or even 5 times.