本文整理汇总了Python中hand.Hand.getValidCount方法的典型用法代码示例。如果您正苦于以下问题:Python Hand.getValidCount方法的具体用法?Python Hand.getValidCount怎么用?Python Hand.getValidCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hand.Hand
的用法示例。
在下文中一共展示了Hand.getValidCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_compare
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import getValidCount [as 别名]
def test_compare(self):
hand1 = Hand(1)
hand1.addCard(Card(0, 6))
hand1.addCard(Card(0, 7))
hand2 = Hand(1)
hand2.addCard(Card(0, 9))
hand2.addCard(Card(0, 3))
self.assertGreater(hand1.compare(hand2), 0)
self.assertLess(hand2.compare(hand1), 0)
self.assertEqual(hand1.compare(hand1), 0)
# BlackJack should beat a normal 21 hand.
hand1 = Hand(1)
hand1.addCard(Card(0, 0))
hand1.addCard(Card(0, 11))
self.assertTrue(hand1.isBlackJack())
hand2 = Hand(1)
hand2.addCard(Card(0, 3))
hand2.addCard(Card(0, 9))
hand2.addCard(Card(0, 6))
self.assertEqual(21, hand2.getValidCount())
self.assertFalse(hand2.isBlackJack())
self.assertGreater(hand1.compare(hand2), 0)
self.assertLess(hand2.compare(hand1), 0)
self.assertEqual(hand1.compare(hand1), 0)
示例2: test_emptyHandValidCount
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import getValidCount [as 别名]
def test_emptyHandValidCount(self):
hand = Hand(1)
self.assertEqual(0, hand.getValidCount(), "valid count wasn't 0 for empty deck")