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


Python Match.hit方法代码示例

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


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

示例1: BlackJackTable

# 需要导入模块: from match import Match [as 别名]
# 或者: from match.Match import hit [as 别名]
class BlackJackTable(cmd.Cmd):
    minbet = 3
    maxbet = 10
    intro = (
        "Welcome to the blackjack table. Type help or ? to list commands.\n The minimum bet is %s dollars, the maximum bet is %s dollars\n"
        % (minbet, maxbet)
    )
    prompt = "(input) "
    file = None

    # Instructions
    def do_start(self, arg):
        "Starts a game"
        self.match = Match(table=self)
        self.do_display(None)

    def feedback(self, question):
        return input(question)

    def do_hitme(self, arg):
        "Hit me"
        self.match.hit()
        self.do_display(None)

    def do_bet(self, arg):
        "Bet an amount of money"

    def do_buyIn(self, arg):
        "Buy a certain amount of chips"
        self.match.playerBuysIn(*parse(arg))

    def do_deck(self, arg):
        "Fix the number of decks be used: deck 6"
        self.math.newDecks(*parse(arg))

    def do_changeDefault(self, arg):
        "Change the default amount for a bet: changeDefault 3 10"
        if parse(arg)[0] >= parse(arg)[1]:
            print("Ensure that minimum is lower than the maximum")
        else:
            (BlackJackTable.minbet, BlackJackTable.maxbet) = parse(arg)

    def do_rules(self, arg):
        "Print the current rules"
        print("The minimum bet is " + str(BlackJackTable.minbet) + " and maximum is " + str(BlackJackTable.maxbet))

    def do_display(self, arg):
        "Display your hand"
        print(self.match)

    def do_quit(self, arg):
        "Quit the game"
        print("Thanks for visiting.")
        return True
开发者ID:JeromeLefebvre,项目名称:CardsForTheWorkingMathematician,代码行数:56,代码来源:table.py


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