def readFlop(self, hand): flopText = '*** FLOP *** ' if self.peek(len(flopText)) == flopText: self.text(flopText) flop = BettingRound() flop.cards = self.readCards() self.text('\n') actions = self.readBettingActions(flop, set(hand.players.keys())) hand.addBetRound(flop, actions) return True else: return False
def readFlop(self,hand): flopText = '*** FLOP *** ' if self.peek( len(flopText) ) == flopText: self.text( flopText ) flop = BettingRound() flop.cards = self.readCards() self.text('\n') actions = self.readBettingActions( flop, set( hand.players.keys() ) ) hand.addBetRound(flop,actions) return True else: return False
def readTurn(self,hand): turnText = '*** TURN *** ' if self.peek( len(turnText) ) == turnText: self.text( turnText ) turn = BettingRound() self.readCards() self.text(' ') turn.cards = self.readCards() self.text('\n') actions = self.readBettingActions( turn, set( hand.players.keys() ) ) hand.addBetRound(turn,actions) return True else: return False
def readRiver(self,hand): riverText = '*** RIVER *** ' if self.peek( len(riverText) ) == riverText: self.text( riverText ) river = BettingRound() self.readCards() self.text(' ') river.cards = self.readCards() self.text('\n') actions = self.readBettingActions( river, set( hand.players.keys() ) ) hand.addBetRound(river,actions) return True else: return False
def readTurn(self, hand): turnText = '*** TURN *** ' if self.peek(len(turnText)) == turnText: self.text(turnText) turn = BettingRound() self.readCards() self.text(' ') turn.cards = self.readCards() self.text('\n') actions = self.readBettingActions(turn, set(hand.players.keys())) hand.addBetRound(turn, actions) return True else: return False
def readRiver(self, hand): riverText = '*** RIVER *** ' if self.peek(len(riverText)) == riverText: self.text(riverText) river = BettingRound() self.readCards() self.text(' ') river.cards = self.readCards() self.text('\n') actions = self.readBettingActions(river, set(hand.players.keys())) hand.addBetRound(river, actions) return True else: return False
def readShowdown(self, hand): showdownText = '*** SHOW DOWN ***\n' if self.peek(len(showdownText)) == showdownText: self.text(showdownText) showdown = BettingRound() actions = self.readBettingActions(showdown, set(hand.players.keys())) hand.addBetRound(showdown, actions) return True else: return False
def readBlinds(self, hand): preflop = BettingRound() actions = [] playerSet = set(hand.players.keys()) while True: try: pid = self.alternative(playerSet) except scanner.BadAlternative: break self.alternative([ ': posts small blind ', ': posts big blind ', ': posts the ante ' ]) act = Action() act.action = Action.Post act.bet = self.number() actions.append([pid, act]) self.alternative(['\n', ' and is all-in\n']) hand.addBetRound(preflop, actions)