The purpose of this lab is to create a program that determines how to win the “Let's Make a Deal” game show.

thumb Marilyn vos Savant described the following problem (loosely based on a game show hosted by Monty Hall) in a popular magazine:

“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.

Your task is to simulate this game show. In each iteration, randomly pick a door number between 1 and 3 for placing the car. Randomly have the player pick a door, but do not open it. The game show host then opens one of the remaining doors which reveals a goat (if both remaining conceal goats, the host chooses one at random). Now increment a counter for strategy 1 if the player wins by switching to the third door, and increment a counter for strategy 2 if the player wins by sticking with the original choice. Run 1000 iterations and print both counters.

This may seem quite complex at first, but you have the tools to make it work. First write some code to pick the door where the car will be. Next, write code to randomly pick the door the contestant chooses. Then write code to eliminate one of the doors that has a goat. Finally, increment the two choice variables. Then put the whole thing in a loop.

- Inputs
- Outputs

In this case there are no *Inputs*, other than running the program itself. The *Output* is the counts of how many times each strategy was successful.

If you get stuck:

- First work the problem out on a piece of paper. Don't ask for help too quickly and don't use a solution you find on the internet. We want you to build the ability to write programs on your own.
- Second ask the person sitting next to you. They'll feel good helping you and if they don't know you will learn together!
- As a last resort if you need help from a TA (and you are working in the lab), please use the help request queue:

http://aml.cs.byu.edu/~kseppi/cs142help.html

The TA's love to help, but you will gain much more in learning how to solve your problems on your own!

Some of you may notice that this program is getting long. Read ahead to find out how to use functions, then put each of the steps we talked about into a **function**. Your main code should then be very small.

When you have your program working, you will need to show it to a TA.

Put yourself in the help request queue to pass off: http://taohelpqueue.appspot.com/requesthelp/YPK364KMSA5U5QF55UCL8LQ3JHCS5C

The TA will evaluate your code based on the following criteria:

- Did you print out the number of wins for each strategy? (5 points)
- Are your values correct (changing should win)? (10 points)
- Did you format your code as shown in the book and in class, with separate lines and indenting? (5 points)
- Did you include test cases to make sure each piece of your code was correct? (10 points)

**Extra credit**: Did you use functions for each step of your algorithm? (3 point)