本文整理汇总了Python中card.Card.get_all_cards方法的典型用法代码示例。如果您正苦于以下问题:Python Card.get_all_cards方法的具体用法?Python Card.get_all_cards怎么用?Python Card.get_all_cards使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类card.Card
的用法示例。
在下文中一共展示了Card.get_all_cards方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from card import Card [as 别名]
# 或者: from card.Card import get_all_cards [as 别名]
def main():
player=Player()
player2=Player()
# player.take_cards(Card('Hearts','Q'), Card('Spades','J'))
all_cards=Card.get_all_cards()
shuffle(all_cards)
player.take_cards(*all_cards)
print("Player1:")
player.show_hand()
print("Player2:")
player2.show_hand()
player2.take_cards(*player.give_cards('5'))
print("Player1:")
player.show_hand()
print("Player2:")
player2.show_hand()
kings=player.give_cards('K')
jacks=player.give_cards('J')
queens=player.give_cards('Q')
aces=player.give_cards('1')
print("Took {c} Kings from P1.".format(c=len(kings)))
print("Took {c} Jacks from P1.".format(c=len(jacks)))
print("Took {c} Queens from P1.".format(c=len(queens)))
print("Took {c} Acess from P1.".format(c=len(aces)))
player2.take_cards(*kings)
player2.take_cards(*jacks)
player2.take_cards(*queens)
player2.take_cards(*aces)
print("Player1's hand:")
player.show_hand()
print("Player2's hand:")
player2.show_hand()
players = [player,player2]
target=player.get_target_player(1, players)
print("Chose target player: {p}".format(p=target))
target=player.get_guess_value(Card.values, players)
print("Chose guess value: {v}".format(v=target))
示例2: __init__
# 需要导入模块: from card import Card [as 别名]
# 或者: from card.Card import get_all_cards [as 别名]
def __init__ (self):
self.deck = Card.get_all_cards()
shuffle(self.deck)