def handle_info(self, line): logger.debug("Info: {}".format(line)) if line[1] == "hand": # Init bets self.match['round_bets'] = 0 self._parse_hand(line[2]) self.win_percent = float( self.hole_strategy.get_win_percentage(self.hole)) logger.info("Estimated win percentage: {}".format( self.win_percent)) elif line[1] in ["post", "stack"]: self.players[line[0]][line[1]] = line[2] elif line[1] == "table": # Reset bets self.match['round_bets'] = 0 self._parse_table(line[2]) self.hand = utils.highest_hand(self.hole, self.table) self.highest_hand = utils.highest_hand(self.hole, self.table, self.hand) elif line[0] == "player1" and line[1] == "raise": self.match['raise'] = line[2]
def test_4_not_flush(self): hand = utils.highest_hand([("8", "h"), ("9", "s")], self.test_flop) self.assertEqual("high card", hand)
def get_table_multiplier(self, hole, table, hand): highest_hand = utils.highest_hand(hole, table, hand) return MULTIPLIER[highest_hand]
def test_5_flush(self): hand = utils.highest_hand(self.test_hole, self.flush_flop) self.assertEqual("flush", hand)
def test_6_flush(self): hand = utils.highest_hand(self.test_hole, self.flush_flop + [("8", "s")]) self.assertEqual("flush", hand)
def test_4_not_straight(self): self.straight_flop[2] = ("7", "h") hand = utils.highest_hand(self.test_hole, self.straight_flop) self.assertEqual("high card", hand)
def test_ace_low_straight(self): hand = utils.highest_hand(self.test_hole, [("4", "h"), ("5", "h"), ("A", "h")]) self.assertEqual("straight", hand)
def test_6_straight(self): hand = utils.highest_hand(self.test_hole, self.straight_river) self.assertEqual("straight", hand)
def test_5_straight(self): hand = utils.highest_hand(self.test_hole, self.straight_flop) self.assertEqual("straight", hand)
def test_full_house_vier(self): hand = utils.highest_hand(self.test_hole, self.test_river) self.assertEqual("full_house", hand)
def test_two_pair_turn(self): hand = utils.highest_hand(self.test_hole, self.test_turn) self.assertEqual("two_pair", hand)
def test_pair_flop(self): hand = utils.highest_hand(self.test_hole, self.test_flop) self.assertEqual("pair", hand)