本文整理汇总了Python中Deck.deck方法的典型用法代码示例。如果您正苦于以下问题:Python Deck.deck方法的具体用法?Python Deck.deck怎么用?Python Deck.deck使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Deck
的用法示例。
在下文中一共展示了Deck.deck方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start
# 需要导入模块: import Deck [as 别名]
# 或者: from Deck import deck [as 别名]
def start():
new_deck1 = copy.deepcopy(Deck.deck())
new_dealer1 = 0
new_hand1 = 0
ace_dealer1 = 0
ace_hand1 = 0
print()
card_d = int(input("What card should the dealer start with? "))
print()
card_d = new_deck1[card_d-1]
print(card_d[0])
new_dealer1 += card_d[1]
if card_d[1] == 11:
ace_dealer1 += 1
print()
cards_h = input("What cards should the player start with? ").split(" ")
card_h = []
for card in cards_h:
card_h.append(int(card))
print()
card_h0 = new_deck1[card_h[0]-1]
card_h1 = new_deck1[card_h[1]-1]
new_deck1.remove(card_d)
new_deck1.remove(card_h0)
new_deck1.remove(card_h1)
new_hand1 += card_h0[1]
new_hand1 += card_h1[1]
if card_h0[1] == 11:
ace_hand1 += 1
if card_h1[1] == 11:
ace_hand1 += 1
print(card_h0[0])
print(card_h1[0])
print()
print("The dealer has", new_dealer1)
print("You have", new_hand1)
print()
return new_deck1, new_dealer1, new_hand1, ace_dealer1, ace_hand1