def test_two_pairs(self): hand = YatzyHand() hand[:] = [ self.dice[1], self.dice[0], self.dice[0], self.dice[3], self.dice[3] ] self.assertEqual(self.scoresheet.score_two_pairs(hand), 10)
def main(): hand = YatzyHand() three = D6(value=3) four = D6(value=4) one = D6(value=1) hand[:] = [one, three, three, four, four] print(YatzyScoresheet().score_one_pair(hand))
def test_four_of_a_kind(self): hand = YatzyHand() hand[:] = self._seed([2, 2, 2, 2, 5]) self.assertEqual(self.scoresheet.score_four_of_a_kind(hand), 8)
def test_three_of_a_kind(self): hand = YatzyHand() hand[:] = self._seed([2, 2, 2, 4, 5]) self.assertEqual(self.scoresheet.score_three_of_a_kind(hand), 6)
def test_two_pairs_no_pairs(self): hand = YatzyHand() hand[:] = self.dice[1:] self.assertEqual(self.scoresheet.score_two_pairs(hand), 0)
def test_yatzy(self): hand = YatzyHand() hand[:] = self._seed([2, 2, 2, 2, 2]) self.assertEqual(self.scoresheet.score_yatzy(hand), 50)
def test_sixes(self): hand = YatzyHand() hand[:] = self.dice[1:] self.assertEqual(self.scoresheet.score_sixes(hand), 6)
from hands import YatzyHand from dice import D6 from scoresheets import YatzyScoresheet hand = YatzyHand() three = D6(value=3) four = D6(value=4) one = D6(value=1) hand[:] = [one, three, three, four, four] pr = YatzyScoresheet().score_one_pair(hand) print(pr)
def test_chance(self): hand = YatzyHand() hand[:] = self._seed([4, 3, 3, 2, 1]) self.assertEqual(self.scoresheet.score_chance(hand), 13)
def test_fives(self): hand = YatzyHand() hand[:] = self.dice[:5] self.assertEqual(self.scoresheet.score_fives(hand), 5)
def test_full_house(self): hand = YatzyHand() hand[:] = self._seed([2, 2, 5, 5, 5]) self.assertEqual(self.scoresheet.score_full_house(hand), 19)
def test_large_straight(self): hand = YatzyHand() hand[:] = self.dice[1:] self.assertEqual(self.scoresheet.score_large_straight(hand), 20)
def test_small_straight(self): hand = YatzyHand() hand[:] = self.dice[:5] self.assertEqual(self.scoresheet.score_small_straight(hand), 15)
import dice, hands from hands import YatzyHand hand = hands.Hand(size=5, die_class=dice.D6) yh = YatzyHand()
def test_one_pair(self): hand = YatzyHand() hand[:] = [self.dice[0], self.dice[0], self.dice[3]] self.assertEqual(self.scoresheet.score_one_pair(hand), 2)
from hands import YatzyHand from dice import D6 from scoresheets import YatzyScoresheet monopoly = YatzyHand() d1 = D6(value=4) d2 = D6(value=5) monopoly[:] = [d1, d2] print(monopoly) print(monopoly.doubles)
def test_one_pair_no_pairs(self): hand = YatzyHand() hand[:] = self.dice[:5] self.assertEqual(self.scoresheet.score_one_pair(hand), 0)
def __init__(self, hand = YatzyHand()): self.hand = hand
def roll(self): self.hand = YatzyHand() return