Ejemplo n.º 1
0
 def drawCardsAndDoRound(self, cardsToDraw):
     for player in self.playersInRound:
         self.playersBettedCurrentRound[player] = 0
     print("\n\nPot total is", self.pot)
     print("\n Flop:")
     self.board += self.deck.draw(cardsToDraw)
     Card.print_pretty_cards(self.board)
     if (len(self.getPlayersInRoundNotInAllIn()) > 1):
         self.doRound()
Ejemplo n.º 2
0
        st = PokerState()
        st.playerJustMoved = self.playerJustMoved
        st.deck = self.deck
        st.board = self.board
        st.player1 = self.player1
        st.player2 = self.player2
        return st

    def DoMove(self, move):
        """ Update a state by carrying out the given move.
            Must update playerJustMoved.
        """

        self.playerJustMoved = 3 - self.playerJustMoved

    def GetMoves(self):
        return ["aposta", "sai"]

    def GetResult(self, player1):
        p1 = self.evaluator.evaluate(self.player1, self.board)
        p2 = self.evaluator.evaluate(self.player2, self.board)
        if p1 < p2:
            return 1.0


board = [Card.new('Th'), Card.new('Kh'), Card.new('Qh'), Card.new('Jh')]
Card.print_pretty_cards(board)
p1 = [Card.new('8c'), Card.new('9c')]
e = Evaluator()

print e.evaluate(board, p1)
Ejemplo n.º 3
0
 def __str__(self):
     return Card.print_pretty_cards(self.cards)
Ejemplo n.º 4
0
from deuces.card import Card
from deuces.evaluator import Evaluator
from deuces.deck import Deck

# create a card
card = Card.new('Qh')

# create a board and hole cards
board = [Card.new('2h'), Card.new('2s'), Card.new('Jc')]
hand = [Card.new('Qs'), Card.new('Th')]

# pretty print cards to console
Card.print_pretty_cards(board + hand)

# create an evaluator
evaluator = Evaluator()

# and rank your hand
rank = evaluator.evaluate(board, hand)
print("Rank for your hand is: %d" % rank)

# or for random cards or games, create a deck
print("Dealing a new hand...")
deck = Deck()
board = deck.draw(5)
player1_hand = deck.draw(2)
player2_hand = deck.draw(2)

print("The board:")
Card.print_pretty_cards(board)
Ejemplo n.º 5
0
 def __str__(self):
     return Card.print_pretty_cards(self.cards)