Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have to create a Monty Hall stimulator game in python 3. The stage is set up with three large doors labeled #1, #2, and

I have to create a Monty Hall stimulator game in python 3.

The stage is set up with three large doors labeled #1, #2, and #3. Behind two of the doors is a goat. Behind the other door is a new car. You dont know which door has the car, but Monty Hall wants you to pick a door. Suppose you pick door #1. Monty Hall then opens one of the other doors (say, door #3) and shows you that theres a goat behind it. He then says: "Ill give you a chance to change your mind. Do you want to change your mind and pick door number 2?" After you make a decision, they open the door you finally picked and you find out whether youve won a new car or a new goat. To clarify: the locations of the car and the goats are fixed before your game starts. Monty does not get a chance to switch things around in the middle of the game.

I need to create a stimulator of the game using Python 3. I have to incorporate a random number generator. The program will ask the user for the Random Number generator seed. The goal of a random number generator is to be random. Before my program begins simulating Lets Make a Deal, it's supposed to ask the user for an integer and set it as the seed. If the user gives an input that is not a number, the program should exit immediately by displaying "Seed is not a number!" IF the user gives a number for the input, the game will begin. The game will then ask the user how many games the user wants to run. If the user says 5, the game will repeat five times. Once the game runs the amount of time the user says (like 5), then the game will ask the user AGAIN how many times the user wants to play again. If the user says 'exit' anytime, the game immediately ends. When asked how many games the user wants to run, if the user does not input a number, the program will just say "Please enter a number" until the user finally enters a number.

The program will be easier because it will print the doors AND label which door has a goat or car. So it will display "G" "C" "G" so the car would be in door two. Monty (in this case, Monty is just a variable) would "pick" a door where the program randomly generates a number that is either 1, 2, or 3. IF the user picks a door that has the car in it, the program will say the user should stick with the door they picked in order to win. If the user picks a door that has a goat, the program will say that the user should change the door they picked in order to pick the door with the car. After each set of games, the program gives a summary of how many times the player should have switched and how many times they should have stayed. If the number of games is less than or equal to 10, the program will print out the results of each game. If the result is greater than 10, it will just print the summary.

EXAMPLE:

If the input was:

25

5

then the output SHOULD be:

Enter Random Seed:

Welcome to Monty Hall Analysis

Enter 'exit' to quit.

How many tests should we run?

Game 1

Doors: ['G', 'C', 'G']

Player Selects Door 1

Monty Selects Door 3

Player should switch to win.

Game 2

Doors: ['C', 'G', 'G']

Player Selects Door 1

Monty Selects Door 2

Player should stay to win.

Game 3

Doors: ['G', 'C', 'G']

Player Selects Door 2

Monty Selects Door 1

Player should stay to win.

Game 4

Doors: ['C', 'G', 'G']

Player Selects Door 1

Monty Selects Door 2

Player should stay to win.

Game 5

Doors: ['G', 'C', 'G']

Player Selects Door 3

Monty Selects Door 1

Player should switch to win.

Stay Won 60.0% of the time.

Switch Won 40.0% of the time.

How many tests should we run?

Thank you for using this program.

I am a pretty beginner programmer who's trying to learn so sorry if this is confusing or does not make sense! I have a program so far and I know it's not very good. If someone could help me at all, that would be greatly appreciated. I'm very confused about the randomization aspect of it.

**Here is what my program outputs (even if the input changes, the output doesn't**

Enter Random Seed:

Welcome to Monty Hall Analysis

Enter exit to quit.

How many tests should we run?

Seed is not a number!

Here is my program:

random_seed = input('Enter Random Seed: ')

try:

random_seed = int(random_seed)

print('Welcome to Monty Hall Analysis')

exit = input('Enter ''exit'' to quit. ')

tests = int(input('How many tests should we run? '))

try:

tests = int(tests)

while tests = True:

select_door = input('[Doors: G, C, G] ')

import random

doors = [1 , 2 , 3]

random.choice(doors)

print('Player Selects Door', select_door)

print('Monty Selects Door', random.choice(doors))

if exit == 'exit':

print('Thank you for using this program.')

break

except ValueError:

print('Please enter a number: ')

except ValueError:

print('Seed is not a number!')

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Systems A 360-degree Approach

Authors: Jawwad ShamsiMuhammad Khojaye

1st Edition

0429531575, 9780429531576

More Books

Students also viewed these Databases questions