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


Python Player.update_percentage方法代码示例

本文整理汇总了Python中models.Player.update_percentage方法的典型用法代码示例。如果您正苦于以下问题:Python Player.update_percentage方法的具体用法?Python Player.update_percentage怎么用?Python Player.update_percentage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Player的用法示例。


在下文中一共展示了Player.update_percentage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: print

# 需要导入模块: from models import Player [as 别名]
# 或者: from models.Player import update_percentage [as 别名]
                print("You were dealt a {}.".format(x))
                print("Your score is: {}".format(player_hand.score()))

        # dealer logic
        print(
            "The dealer shows his hand and has {}".format(
                dealer_hand.show_cards()))
        while((dealer_hand.score() <= 17) and (dealer_hand.score() < player_hand.score()) and (player_hand.score() <= 21)):
            x = deck.deal()
            dealer_hand.add_card(x)
            print("The dealer hits and gets a {}".format(x))
        print("His score is {}.".format(dealer_hand.score()))
        # win/lose conditions
        win_conditions(player, player_hand, dealer_hand)
    player.games_played += 1
    player.update_percentage()
    print("")
    play_another = (input("Are you up for another hand? (y/n)").lower())


# Goodbye message/warning.
clearscreen()

if player.money <= 0:
    print("Sorry friend, you've got to have money to rent a seat. Have a nice one.")
print(
    "Thanks for playing! You're leaving the table win percentage of {}%.".format(
        player.win_percentage))

if player.money >= player.start_money:
    print(
开发者ID:ThatClyde,项目名称:Simple_BlackJack,代码行数:33,代码来源:play.py


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