本文整理汇总了Python中hand.Hand.showHand方法的典型用法代码示例。如果您正苦于以下问题:Python Hand.showHand方法的具体用法?Python Hand.showHand怎么用?Python Hand.showHand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hand.Hand
的用法示例。
在下文中一共展示了Hand.showHand方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import showHand [as 别名]
def main():
"""
Doc string coming later
"""
deck1 = Deck()
deck1.shuffle()
dealerHand = Hand()
playerHand = Hand()
startGame(dealerHand, playerHand, deck1)
while dealerHand.handSum() < 16:
evalHand(dealerHand)
hitMe(dealerHand, deck1)
# print("dealer hand after evalHand is: ", dealerHand.showHand())
if dealerHand.handSum() > 21:
os.system("clear")
displayHands(playerHand, dealerHand)
print("Dealer sum exceeded 21."
" Dealer hand {}. Dealer sum {}. Player wins!!".format(dealerHand.handSum(), dealerHand.showHand()))
return
displayHands(playerHand, dealerHand)
evalHand(dealerHand)
"""
if dealerHand.handSum() > 21:
game_status = stand(playerHand, dealerHand)
print("Game status is: ", game_status)
"""
# print("\nYour hand score is: ", playerHand.handSum())
displayHands(playerHand, dealerHand)
ans = input("\nDo you want another card (y or n)? ")
while ans == 'y':
hitMe(playerHand, deck1)
evalHand(playerHand)
displayHands(playerHand, dealerHand)
if playerHand.handSum() > 21:
os.system("clear")
displayHands(playerHand, dealerHand)
print("Player exceeded 21. "
"Player hand {}. Dealer sum {}. Dealer wins!!".format(playerHand.showHand(), playerHand.handSum()))
return
ans = input("Do you want another card (y or n)?")
displayHands(playerHand, dealerHand)
print("\nGame outcome is: ", stand(playerHand, dealerHand))