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


Python Player.start_money方法代码示例

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


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

示例1: clearscreen

# 需要导入模块: from models import Player [as 别名]
# 或者: from models.Player import start_money [as 别名]
from models import Card, Deck, Hand, Player
from utils import clearscreen, get_bet, win_conditions, blackjack_test


# Starting with a nice, clear screen:
clearscreen()

# Getting the player info
player = Player()
player.name = input("What's your name, pardner? ")
money = (
    input(
        "How much money are you bringing to the table, {}? $".format(
            player.name)))
player.money = Decimal(money)
player.start_money = player.money
bet = 0

# Building the Deck with the number of packs of cards specified
while True:
    try:
        packs = int(
            input("How many packs of cards should make up your deck? [1-10] "))
        if packs < 0:
            raise ValueError()
        break
    except ValueError:
        print("{} is not a valid number of packs. They will throw you out of Vegas for that kinda crap".format(packs))
deck = Deck(packs)
deck.shuffle()
开发者ID:ThatClyde,项目名称:Simple_BlackJack,代码行数:32,代码来源:play.py


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