Question: Code in C please! :) You are a contestant on a game show and have won a shot at the grand prize! Before you are

Code in C please! :)

You are a contestant on a game show and have won a shot at the grand prize! Before you are three doors. Behind one door is a Lamborghini. Behind the other two doors are the consolation prizes: a can of tomatoes. The location of the prizes have been randomly selected. Naturally, you want the car! The game show host asks you to select a door, and you randomly pick one. However, before revealing the contents behind your door, the game show host reveals one of the other doors that contains a consolation prize. At this point, the game show host asks if you would like to stick with your original choice or switch your choice to the remaining door. What choice should you make to optimize your chances of winning the grand prize, or does it matter?

Write a simulation program to help you make your choice. Your program should make 1000 simulated runs through the game show scenario where the player sticks with the original choice, and 1000 runs where the player switches doors. This could be the same program where you comment/uncomment some code that determines if the player stays or switches doors (or do them both in the same program). For all 1000 runs the program should count up how many times the player won the car. The steps your program should make to simulate the game are:

  1. Randomly select a door to have the car (this could be a random number that is 0, 1, or 2).
  2. Randomly select a door for the player to pick (another random number that is 0, 1, or 2)
  3. Compute a door that isn't the player's pick that doesn't have the car and reveal it
  4. Stick with the original choice or switch to the remaining door, depending upon what is being tested
  5. Determine if the final door selection has the car, and if so, increment the number of times won

Be sure that your program simulates the process of selecting the door, revealing one, then switching. Do not make assumptions about the actual solution.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!