本文整理汇总了Python中hand.Hand.initial_deal方法的典型用法代码示例。如果您正苦于以下问题:Python Hand.initial_deal方法的具体用法?Python Hand.initial_deal怎么用?Python Hand.initial_deal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hand.Hand
的用法示例。
在下文中一共展示了Hand.initial_deal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: opening
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import initial_deal [as 别名]
def opening(self):
Hand.initial_deal(self.players_hand)
Hand.initial_deal(self.dealers_hand)
print("-" * 40)
print("\nThe hand opens: \n")
print("Dealer showing one: {}".format(self.dealers_hand.cards_in_hand[0]))
print("Player showing: ", self.players_hand)
print("Player's cards tally: ", self.players_hand.value_the_cards())
示例2: dealers_logic
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import initial_deal [as 别名]
def dealers_logic(self):
Hand.initial_deal(self.dealers_hand)
print("Dealer holding: ", self.dealers_hand)
while self.dealers_hand.value_the_cards() < 17:
Hand.draw_a_card(self.dealers_hand)
print("Dealer now holding: ", self.dealers_hand)
# print("Dealer's cards tally: ", self.dealers_hand.value_the_cards()) # for testing
if self.dealers_hand.value_the_cards() > 21:
print("Dealer's hand is bust at {}.".format(self.dealers_hand.value_the_cards()))
else:
print("Dealer's hand: ", self.dealers_hand.value_the_cards())
dealer_total = self.dealers_hand.value_the_cards()
return dealer_total
示例3: players_logic
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import initial_deal [as 别名]
def players_logic(self):
Hand.initial_deal(self.players_hand)
print("Player holding: ", self.players_hand)
print("Player's cards tally: ", self.players_hand.value_the_cards())
while self.players_hand.value_the_cards() < 21:
hit = input("Hit or Stay? H/S ").lower()
if hit == 'h':
Hand.draw_a_card(self.players_hand)
print("Player holding: ", self.players_hand)
print("Player's cards tally: ", self.players_hand.value_the_cards()) # for testing
if self.players_hand.value_the_cards() > 21:
print("Player's hand is a bust.")
else:
print("Player's cards tally: ", self.players_hand.value_the_cards())
break
player_total = self.players_hand.value_the_cards()
return player_total