The Monty Hall game is a statistical problem: there is a TV show (like the Monty Hall show) that allows

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
The Monty Hall game is a statistical problem: there is a TV show (like the Monty Hall show) that allows
contestants to choose between three doors, A, B, and C. Behind one of these doors is a new car (the
winning door), and behind the other two are goats (the losing doors). After the contestant makes a choice,
the game show host shows a goat behind one of the doors NOT chosen. The contestant is then given a
choice to either switch to the other, non-opened door, or stick with their original guess.
The interesting part of this “game" is the statistics involved –a person has a 1/3 chance of originally picking
a winning door. The other door – that which is not revealed to have a goat but also was not originally
chosen – actually has a 2/3 chance of being a winning door. Therefore, it is in the contestant's best interest
to switch doors.
You will create a program that simulates the Monty Hall game, where the computer plays the role of the
host. The program must have no outputs, but
1)
Ask the user to choose a door (1, 2, or 3) Use the ʼrandi’ command to generate a random number
between 1 and 3.
2) Ask the user if they are auditing the game. (This means that the computer shows the user the
randomly-generated number. It's a way for you or anyone else to check that the program works).
If the user indicates that they are auditing, show the door value.
3) Otherwise, “Show" another door that has a goat,
4) Ask if the user would like to switch doors, then
5) Reveal if the user has won the game.
The program must be configured to give the proper statistical results. To do so, first, the computer must
generate a random integer between 1 and 3, inclusive. This represents the winning door number. Then
the computer must determine if the user chose the winning door on the first guess and, if so, to randomly
choose another door to show. If the chosen door does NOT represent the winning door, the computer
must “show" the other losing door. Then the computer asks if the user wishes to switch, and then reveal
if the user has won the game.
Submission:
Matlab Code
Label your program lastname_firstinitial_ME3500_Activity8.m. Use the input command to accept guesses
and the fprintf command to display feedback such as “The car is behind door #3", and “You have won a
goat!" If you want to include a variable you can do so by putting the entire phrase in brackets [] and
separating variables with commas:
Command Window
>> x = 3;
>> fprintf(['The number is
The number is 3
兵 >>
',num2str(x),'\n']);
Statistical Results:
a. Run your program 30 times and play. Record your winning rate if you change the door.
b. Run your program 30 times and play. Record your winning rate if you don't change the door.
In a separate document file submit a and b. You can do this part manually or automatically using MATLAB
code.
Transcribed Image Text:The Monty Hall game is a statistical problem: there is a TV show (like the Monty Hall show) that allows contestants to choose between three doors, A, B, and C. Behind one of these doors is a new car (the winning door), and behind the other two are goats (the losing doors). After the contestant makes a choice, the game show host shows a goat behind one of the doors NOT chosen. The contestant is then given a choice to either switch to the other, non-opened door, or stick with their original guess. The interesting part of this “game" is the statistics involved –a person has a 1/3 chance of originally picking a winning door. The other door – that which is not revealed to have a goat but also was not originally chosen – actually has a 2/3 chance of being a winning door. Therefore, it is in the contestant's best interest to switch doors. You will create a program that simulates the Monty Hall game, where the computer plays the role of the host. The program must have no outputs, but 1) Ask the user to choose a door (1, 2, or 3) Use the ʼrandi’ command to generate a random number between 1 and 3. 2) Ask the user if they are auditing the game. (This means that the computer shows the user the randomly-generated number. It's a way for you or anyone else to check that the program works). If the user indicates that they are auditing, show the door value. 3) Otherwise, “Show" another door that has a goat, 4) Ask if the user would like to switch doors, then 5) Reveal if the user has won the game. The program must be configured to give the proper statistical results. To do so, first, the computer must generate a random integer between 1 and 3, inclusive. This represents the winning door number. Then the computer must determine if the user chose the winning door on the first guess and, if so, to randomly choose another door to show. If the chosen door does NOT represent the winning door, the computer must “show" the other losing door. Then the computer asks if the user wishes to switch, and then reveal if the user has won the game. Submission: Matlab Code Label your program lastname_firstinitial_ME3500_Activity8.m. Use the input command to accept guesses and the fprintf command to display feedback such as “The car is behind door #3", and “You have won a goat!" If you want to include a variable you can do so by putting the entire phrase in brackets [] and separating variables with commas: Command Window >> x = 3; >> fprintf(['The number is The number is 3 兵 >> ',num2str(x),'\n']); Statistical Results: a. Run your program 30 times and play. Record your winning rate if you change the door. b. Run your program 30 times and play. Record your winning rate if you don't change the door. In a separate document file submit a and b. You can do this part manually or automatically using MATLAB code.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY