本文整理汇总了Python中Deck.Deck.push方法的典型用法代码示例。如果您正苦于以下问题:Python Deck.push方法的具体用法?Python Deck.push怎么用?Python Deck.push使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Deck.Deck
的用法示例。
在下文中一共展示了Deck.push方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Hand
# 需要导入模块: from Deck import Deck [as 别名]
# 或者: from Deck.Deck import push [as 别名]
cards = []
cards.append(Card("K", "H"))
cards.append(Card("K", "D"))
cards.append(Card("4", "S"))
cards.append(Card("4", "C"))
cards.append(Card("10", "H"))
hand4 = Hand(cards)
assert hand4.handType == 3, "Unit Test Failed : Two Pairs"
assert hand3 < hand4, "Unit Test Failed : Two pairs comparison"
# Random testing (todo: oracle)
for i in range(100):
deck = Deck()
deck.shuffle()
cards = []
for c in range(5):
cards.append(deck.pop())
hand1 = Hand(cards)
while len(cards) > 0:
deck.push(cards.pop())
deck.shuffle()
for c in range(5):
cards.append(deck.pop())
hand2 = Hand(cards)
if (hand1.compare(hand2) == 0):
print("1 : ", hand1)
print("2 : ", hand2)
print("1 < 2 : ", hand1.compare(hand2))
print("-----")