当前位置: 首页>>代码示例>>Python>>正文


Python Hand.initial_deal方法代码示例

本文整理汇总了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())
开发者ID:hpaasch,项目名称:blackjack,代码行数:10,代码来源:player.py

示例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
开发者ID:hpaasch,项目名称:blackjack,代码行数:15,代码来源:heptest.py

示例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
开发者ID:hpaasch,项目名称:blackjack,代码行数:19,代码来源:heptest.py


注:本文中的hand.Hand.initial_deal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。