Exemplo n.º 1
0
    def endround(self):
        self.aliveplayers = sorted(self.aliveplayers, key=lambda x: p.convert(x.hand), reverse=True)
        copy = self.aliveplayers[:]
        max_hand = p.convert(self.aliveplayers[0].hand)

        for player in copy:
            if p.convert(player.hand) != max_hand:
                self.aliveplayers.remove(player)
                self.deadplayers.append(player)

        for player in self.aliveplayers:
            m.add_amount(player.id,self.pot//len(self.aliveplayers))
Exemplo n.º 2
0
    def handlebet(self, amount):
        if amount == self.bet:
            self.callcount += 1
        else:
            self.callcount = 1

        m.add_amount(self.players[self.turn].id, -amount)
        self.pot += amount
        self.turn = (self.turn + 1) % len(self.aliveplayers)
        self.actions += 1
        self.bet = amount
        if self.callcount == self.playercount:
            self.phase += 1
            self.handlephase()
Exemplo n.º 3
0
    def newround(self,players):
        self.phase = 0
        self.aliveplayers = players
        self.calls = [False for i in self.aliveplayers]
        self.startingplayer = (self.startingplayer + 1) % len(self.aliveplayers)
        self.turn = self.startingplayer
        self.pot = 0
        self.bet = self.ante
        self.playercount = len(self.aliveplayers)
        for player in self.aliveplayers:
            m.add_amount(player.id,-self.ante)
            self.pot += self.ante

        self.newdeck()

        for player in players:
            player.hand = [player.draw() for i in range(5)]