Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

DSC 4 3 0 : Python Programming Assignment 0 5 0 2 : Rolling Game For this problem you will use the classes from the

DSC 430: Python Programming
Assignment 0502: Rolling Game
For this problem you will use the classes from the previous problem to build a game. The game will work as follows:
Greet the user and ask their name.
Ask them if they would like to play a game.
Initiate a game with zero score for the user.
Generate a random number between 1 and 100. This number will be called the goal.
Ask the user how many of each die (6-,10- or 20-sided) they would like to roll to get as close as possible to the goal.
Create a cup filled with dice according to the user's input.
Roll the cup and display the results.
If the roll exactly matches the goal, the user receives 10 scores.
Otherwise, if the roll is within 3 of the goal but not over, the user receives 5 scores.
Otherwise, if the roll is within 10 of the goal but not over, the user receives 2 scores.
Otherwise, the user does not receive any scores.
Report the results to the user. The message should include their name and updated score.
Ask if they would like to play again. If so, go to step 4. Record a three minute video in which you run the code. Then, present your code. Specifically, answer the following questions:
Show your primary loop and briefly explain how you calculate the score updates.
Describe how you leverage the dice and cups classes from the previous assignment. Use the classes - don't store a bunch of values in the game engine that you need!
Submission: Submit a single .py file containing all the code to the D2L. Do not zip or archive the file. Your code must include comments at the top including your name, date, video link, and the honor statement, "I have not given or received any unauthorized assistance on this assignment." Each function must include a docstring and be commented appropriately.
image text in transcribed

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

Mysql Examples Explanations Explain Examples

Authors: Harry Baker ,Ray Yao

1st Edition

B0CQK9RN2J, 979-8872176237

More Books

Students also viewed these Databases questions