Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Enforcing Game Rules ( 1 5 pts ) Game rules require the player to choose one, and only one, score category every round even if
Enforcing Game Rules pts
Game rules require the player to choose one, and only one, score category every round even if the
category is not achieved. The result is for the selected category. Track which categories have been
selected using a python dictionary. Each key is a category name and the corresponding value is
TrueFalse For example:
selected ind:False,traight:False
scratchhighestcategoryselectedthis function is passed a dictionary that
contains TrueFalse for each scoring category. Step through the dictionary from left to
right highest to lowest score and change the first category marked False to True. This
prevents the category from being selected a second time called a scratch For example, if
fiveofkind has not yet been rolled then it will be first to be scratched since it is the highest
remaining category.
scoredice dice update this function. Create a dictionary that holds a pair for the
eight score categories see above For each scoring category, only update the game score if the
category is achieved and it has not been selected. Also, mark the category as selected. If no
category is achieved after checking all eight possibiliteis, call
scratchhighestcategory selected
elif fourofkinddice and not selected.getfourofkind":
score FOUR OF KIND
selectedfourofkind" True
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