Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Set the turn number to 1 # Let the user enter die roll values from a command line. This will allow for controlled test data.
Set the turn number to
# 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 or
Die roll is a number from to
If turn number and die roll or player loses
If turn number and die roll or player wins
else if turn number and die roll not or point number die roll and turn number
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 to
# 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 or
If turn number and die roll player loses
If turn number and die roll point number player wins
Else turn number
Print the turn number, the die roll and the result.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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