Yuyang Peng5,665 Points
hand.ones Shouldn't 1s,2s,3s,4s,5s be YatzyHand s property?
So in the YatzyScoreSheet class, Kenneth used hand.ones. Looking back and I found out that those values belong to YatsyHand instead of hand and Yatsyhand is a subclass of hand,so hand shouldn't have access to properties? Could someone explain this to me please?
class YatzyScoreSheet: def score_ones(self, hand): return sum(hand.ones)
Dave StSomeWhere19,810 Points
The "hand" defined in YatzyScoresheet is not referring to the class Hand - it is just the variable name used for the arguments (so it does seem confusing).
You'll notice that when testing the code, Kenneth imports and instantiates the YatzyHand class:
from hands import YatzyHand from dice import D6 from scoresheets import YatzyScoresheet hand = YatzyHand()
Does that make sense?
Anthony Grodowski4,902 Points
I feel angry at Kenneth now because he didn't say what excatly
hand is doing there and I wasted like an hour on figuring that out because it completely didn't make sense until watching the rest of the video... SMH