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


Python Deck.newDeck方法代码示例

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


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

示例1: playGame

# 需要导入模块: from Deck import Deck [as 别名]
# 或者: from Deck.Deck import newDeck [as 别名]
 def playGame(self):
     while self.newGame != False:
         self.newGame = False
         print("Welcome to Bender's Totally Legit and Not Rigged at All Blackjack Table.")
         print("You're not a cop, are you?  You have to tell me if you're a cop...")
         self.getPlayers()
         print("Welcome",self.player.name)
         self.player.startingCash()
         print(self.player.name, "has $",self.player.cash,"available")
         deck = Deck()
         dealer = Dealer()
         while self.replayGame != False:
             if len(deck.currentDeck) <= 10:
                 house = deck.newDeck()
             round = Round(self)
             results = Results(self)
             score = Scoreboard(self)
             wager = score.placeBet(self.player.cash)
             if self.newGame == True:
                 break
             round.startingHands(self.player, dealer, deck, house)
             round.takeAction(self.player, dealer, deck, house)
             if self.player.score <= 21 and self.player.score > 0:
                 round.checkDealerHand(self.player, dealer, deck, house)
             results.determineWinner(self.player, dealer)
             self.player.cash = score.updateCash(self.player.cash, wager)
             print(self.player.name, "has $", self.player.cash, "available")
             replay = KeepPlaying()
             replay.replayGame(self.player, dealer)
             self.replayGame = replay.playAgain
         if self.newGame == False:
             print("I don't need you.  I'll build my own casino.  With Blackjack... and hookers... Awww, forget it.")
         elif self.newGame == True:
             print("Oops, you're broke! ¯\_(ツ)_/¯")
             print("Come back when you have some money to lose. (\/)(;,,;)(\/)")
开发者ID:jasonhoneyager,项目名称:Blackjack,代码行数:37,代码来源:Game.py

示例2: add

# 需要导入模块: from Deck import Deck [as 别名]
# 或者: from Deck.Deck import newDeck [as 别名]
    # def add(self, player, card):
    #     super(Deck, self).add(card)

    def best(self):
        best_card = self._cards[0]
        for card in list(self)[1:]:
            if best_card.color == Card.Color.TRUMP and card.color != Card.Color.TRUMP:
                continue
            elif best_card.color != Card.Color.TRUMP and card.color == Card.Color.TRUMP:
                best_card = card
            elif best_card.color == card.color:
                best_card = max(card, best_card)
        return best_card

if __name__ == "__main__":
    from Players import Player
    p = [Player(), Player(), Player(), Player()]
    print(p)
    d = Deck.newDeck()
    d.shuffle()
    hands, dog = d.distribute(len(p))
    for player, hand in zip(p, hands):
        player.deck = hand
        print(player.deck)
    t = Trick(p[0], random.choice(p[0].deck))
    t.add(random.choice(p[1].deck))
    t.add(random.choice(p[2].deck))
    t.add(random.choice(p[3].deck))
    print(t)
    print(t.best())
开发者ID:rbernand,项目名称:GodOfTarot,代码行数:32,代码来源:Trick.py


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