Question: Program 2 - This Game need to be in- Python 3.7 1. Algorithm Due 2. Program Due Going to MU is a simply dice game.
Program 2 - This Game need to be in- Python 3.7
1. Algorithm Due
2. Program Due
Going to MU is a simply dice game. The rules are simple and are used to help small children learn and recognize numbers. The game is normally played with 2-6 people, but our version will only be the user vs the computer.
The rules are simple each player rolls 2 dice and keep the highest die. Whichever player has the highest roll has that added to their score. Whichever player reaches the win threshold first is the winner.
Program Requirements
- Ask the player how many miles to MU to play for the game. (The threshold). It must be a value from 1 to 30 inclusive.
- Roll 2 six-sided die for the player, ask them which one they are going to keep. If they are the same value, then there is no need to ask. It should validate that the choice is valid
- Roll 2 six-sided die for the computer, choose the highest one.
- Whichever player gets the highest roll will have that roll added to their total score. Show the scores after each round.
- Once a player makes it past the threshold they win. Output the winner Ask the user if they want to play again. Valid Responses are only Y or N.
Development Notes:
- You need a way to roll die. The random module for python is included and is just what we need. Import the random module at the top of your program, to get a die roll the randint function will return a random number from a to b, inclusive.
coin = random.randint(1, 6)
- Strings have two methods that could be useful. .lower() and .upper(). These methods return a string that is lowercased or upper cased respectively. o abcLower = "ABC".lower() # abcLower is "abc"
abcUpper = "abc".upper() # abcUpper is "ABC"
Example
How many miles is it to MU (1 - 30) ==> 0
You must enter a value larger than 0.
How many miles is it to MU (1 - 30) ==> -1
You must enter a value larger than 0.
How many miles is it to UMKC (1 - 30) ==> 10
You rolled 4 and 1
Which dice do you want to use for your score? ==> 4
The computer rolled 4 and 4
The computer chose 4
You both tied, no one wins the round
Scores
Player: 0
Computer: 0
You rolled 2 and 1
Which dice do you want to use for your score? ==> 2
The computer rolled 2 and 2
The computer chose 2
You both tied, no one wins the round
Scores
Player: 0
Computer: 0
You rolled 6 and 3
Which dice do you want to use for your score? ==> 6
The computer rolled 6 and 6
The computer chose 6
You both tied, no one wins the round
Scores
Player: 0
Computer: 0
You rolled 2 and 5
Which dice do you want to use for your score? ==> 5
The computer rolled 2 and 3
The computer chose 3
You beat the computer this round
Scores
Player: 5
Computer: 0
You rolled 4 and 3
Which dice do you want to use for your score? ==> 4
The computer rolled 1 and 1
The computer chose 1
You beat the computer this round
Scores
Player: 9
Computer: 0
You rolled 1 and 3
Which dice do you want to use for your score? ==> 3
The computer rolled 6 and 4
The computer chose 6
The computer won this round
Scores
Player: 9
Computer: 6
You rolled 3 and 6
Which dice do you want to use for your score? ==> 6
The computer rolled 5 and 1
The computer chose 5
You beat the computer this round
Scores
Player: 15
Computer: 6
Congratulations, you won
Do you want to play again Y/N ==> e You must enter Y or N only
Do you want to play again Y/N ==> y
How many miles is it to UMKC (1 - 30) ==> 10
You rolled 6 and 6
The computer rolled 3 and 5
The computer chose 5
You beat the computer this round
Scores
Player: 6
Computer: 0
You rolled 3 and 4
Which dice do you want to use for your score? ==> 4
The computer rolled 1 and 6
The computer chose 6
The computer won this round
Scores
Player: 6
Computer: 6
You rolled 5 and 4
Which dice do you want to use for your score? ==> 5
The computer rolled 1 and 5
The computer chose 5
You both tied, no one wins the round
Scores
Player: 6
Computer: 6
You rolled 4 and 5
Which dice do you want to use for your score? ==> 5
The computer rolled 4 and 2
The computer chose 4
You beat the computer this round
Scores
Player: 11
Computer: 6
Congratulations, you won
Do you want to play again Y/N ==> n
>>>
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
