Python Object-Oriented Python Dice Roller Yatzy Scoring

_score_set method

I'm lost here. I don't understand this _score_set code. I guess I don't understand the game rules. Can anyone please explain the logic of this code.

1 Answer

Steven Parker
Steven Parker
204,855 Points

The "_set" property of a Hand is an object that groups all the dice by value (this is done earlier in the course).

So what "_score_set" does is loop through all the possible values, and determine how many points each set is worth (the value multiplied by how many). Then it returns the highest of these values.

The game rules only relate to why you'd care about this total.