Question
Here is some Pseudocode for a dice game to make with python. Simulate a random die roll. Be as simple as possible. Set the turn
Here is some Pseudocode for a dice game to make with python. Simulate a random die roll.
Be as simple as possible.
Set the turn number to 1
# Let the user enter die roll values from a command line. This will allow for controlled test data. Eventually, we can convert the die roll to a pseudorandom number for game simulations.
#Validate data entry by throwing an error for numerical input <2 or>12.
Die roll is a number from 2 to 12
If turn number = 1 and die roll = 2, 3, or 12, player loses
If turn number = 1 and die roll = 7 or 11, player wins
else if turn number = 1 and die roll not = 2, 3, 7, 11, or 12, point number = die roll and turn number += 1
Print the turn number, the die roll and the result.
# The section below will become a loop to extend the game. We will work on the loop next
week. The loop functionality is not required for this week's assignment.
Die roll is a new number from 2 to 12
# Let the user enter die roll values from a command line. This will allow for controlled test data. Eventually, we can convert the die roll to a pseudorandom number for game simulations.
#Validate data entry by throwing an error for numerical input <2 or>12.
If turn number > 1 and die roll = 7 player loses
If turn number > 1 and die roll = point number player wins
Else turn number +=1
Print the turn number, the die roll and the result.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Python code for the dice game import random Set the turn number to 1 turnnumber 1 Get the u...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started