Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Does anyone know how to do this using python? In a dice rolling game a hand is made up of any number of random dice

Does anyone know how to do this using python?

image text in transcribed

In a dice rolling game a hand is made up of any number of random dice throws and is valued in the following way: In this game a run is a sequence of dice values starting from 1, e.g., 123, 12345, 1234, 1. the hand score. If there is no 1 in a hand of dice, the score for the whole hand is 0. A hand of dice can contain more than one run. Study the following five example hands of dice and their corresponding valuation. Make sure you understand how the hands are valued [5, 3, 2, 5, 4, 5, 6, 4, 3] has valuee [3, 4, 1, 5, 3, 1, 4, 6] has value 2 (contains one run with just the dice [1] and a second run with just [11) [5, 3, 2, 2, 6, 4, 5, 1, 4] has value 21 (contains one run with the dice [1, 2, 3, 4, 5, 6]) [2, 1, 1,1, 2, 3, 3, 1, 3, 2] has value 19 (contains three separate runs with the dice [1, 2, 31 and a second run with the dice [1 [3, 4, 1, 5, 2, 1, 5, 1, 2, 3, 4, 6] has value 37 (contains one run with the dice [1, 2, 3, 4, 5, 6], a second run with 1, 3,5) and a th ird run with the dice [1]) Complete the get_hand_score0 function which is passed a list of dice throws and returns the value of the hand according to the rules described above

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

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions