本文整理汇总了Python中hand.Hand.isBlackJack方法的典型用法代码示例。如果您正苦于以下问题:Python Hand.isBlackJack方法的具体用法?Python Hand.isBlackJack怎么用?Python Hand.isBlackJack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hand.Hand
的用法示例。
在下文中一共展示了Hand.isBlackJack方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_compare
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import isBlackJack [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_emptyHandBlackJack
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import isBlackJack [as 别名]
def test_emptyHandBlackJack(self):
hand = Hand(1)
self.assertFalse(hand.isBlackJack(), "empty hand isn't blackjack")
示例3: test_blackJack
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import isBlackJack [as 别名]
def test_blackJack(self):
hand = Hand(1)
hand.addCard(Card(1, 0))
hand.addCard(Card(1, 10))
self.assertTrue(hand.isBlackJack())