Ejemplo n.º 1
0
 def test_score_heels(self):
     hand = self.deck.by_rank(standard.FIVE)
     turned = self.deck.by_rank(standard.JACK).pop()
     score = cribbage.score_hand(hand, turned=turned, dealer=False)
     self.assertEqual(score["heels"], 0)
     score = cribbage.score_hand(hand, turned=turned, dealer=True)
     self.assertEqual(score["heels"], 2)
Ejemplo n.º 2
0
 def test_score_heels(self):
     hand = self.deck.by_rank(standard.FIVE)
     turned = self.deck.by_rank(standard.JACK).pop()
     score = cribbage.score_hand(hand, turned=turned, dealer=False)
     self.assertEqual(score["heels"], 0)
     score = cribbage.score_hand(hand, turned=turned, dealer=True)
     self.assertEqual(score["heels"], 2)
Ejemplo n.º 3
0
 def test_score_crib_turn(self):
     hand = self.spades.deal(4)
     turned = self.deck.by_suit(standard.HEART).pop()
     score = cribbage.score_hand(hand, turned=turned, crib=False)
     self.assertEqual(score["flush"], 4)
     score = cribbage.score_hand(hand, turned=turned, crib=True)
     self.assertEqual(score["flush"], 0)
     turned = self.spades.pop()
     score = cribbage.score_hand(hand, turned=turned, crib=False)
     self.assertEqual(score["flush"], 5)
     score = cribbage.score_hand(hand, turned=turned, crib=True)
     self.assertEqual(score["flush"], 5)
Ejemplo n.º 4
0
 def test_score_crib_turn(self):
     hand = self.spades.deal(4)
     turned = self.deck.by_suit(standard.HEART).pop()
     score = cribbage.score_hand(hand, turned=turned, crib=False)
     self.assertEqual(score["flush"], 4)
     score = cribbage.score_hand(hand, turned=turned, crib=True)
     self.assertEqual(score["flush"], 0)
     turned = self.spades.pop()
     score = cribbage.score_hand(hand, turned=turned, crib=False)
     self.assertEqual(score["flush"], 5)
     score = cribbage.score_hand(hand, turned=turned, crib=True)
     self.assertEqual(score["flush"], 5)
Ejemplo n.º 5
0
 def test_score_crib_noturn(self):
     hand = self.spades.deal(4)
     score = cribbage.score_hand(hand, crib=False)
     self.assertEqual(score["flush"], 4)
     score = cribbage.score_hand(hand, crib=True)
     self.assertEqual(score["flush"], 4)
Ejemplo n.º 6
0
 def test_score(self):
     self.assertEqual(cribbage.score_hand(self.deck), self.dscore)
     self.assertEqual(cribbage.score_hand(self.spades), self.sscore)
Ejemplo n.º 7
0
 def test_score_nobs(self):
     hand = self.deck.by_rank(standard.JACK)
     turned = self.deck.by_rank(standard.FIVE).pop()
     for d in [True, False]:
         score = cribbage.score_hand(hand, turned=turned, dealer=d)
         self.assertEqual(score["nobs"], 1)
Ejemplo n.º 8
0
 def test_score_dealer_noturn(self):
     self.assertEqual(cribbage.score_hand(self.deck, dealer=True),
                      self.dscore)
     self.assertEqual(cribbage.score_hand(self.spades, dealer=True),
                      self.sscore)
Ejemplo n.º 9
0
 def test_score_crib_noturn(self):
     hand = self.spades.deal(4)
     score = cribbage.score_hand(hand, crib=False)
     self.assertEqual(score["flush"], 4)
     score = cribbage.score_hand(hand, crib=True)
     self.assertEqual(score["flush"], 4)
Ejemplo n.º 10
0
 def test_score(self):
     self.assertEqual(cribbage.score_hand(self.deck), self.dscore)
     self.assertEqual(cribbage.score_hand(self.spades), self.sscore)
Ejemplo n.º 11
0
 def test_score_nobs(self):
     hand = self.deck.by_rank(standard.JACK)
     turned = self.deck.by_rank(standard.FIVE).pop()
     for d in [True, False]:
         score = cribbage.score_hand(hand, turned=turned, dealer=d)
         self.assertEqual(score["nobs"], 1)
Ejemplo n.º 12
0
 def test_score_dealer_noturn(self):
     self.assertEqual(cribbage.score_hand(self.deck, dealer=True), self.dscore)
     self.assertEqual(cribbage.score_hand(self.spades, dealer=True), self.sscore)