def test_histogram(self): hole_cards_p1 = (TexasCard.from_str('As'), TexasCard.from_str('Ac')) hole_cards_p2 = (TexasCard.from_str('7c'), TexasCard.from_str('8d')) board = Deck().pop(*hole_cards_p1, *hole_cards_p2).pool result = histogram(hole_cards_p1, board) for k, v in result.items(): print(f'{k:<13} : {v:.9f}')
def test_showdown_decision(self): hole_cards = (TexasCard.from_str('5h'), TexasCard.from_str('Th')) community_cards = Deck().pop(*hole_cards).deal(5) print(f'Hole cards: {hole_cards}') print(f'Community cards: {community_cards}') best = decide_showdown(hole_cards + community_cards) print('Best play -->') print(f'5 card picked: {best.cards()}') print(f'The type is \n {best}')
def test_deck(self): all_cards = Deck.gen_poker() # print(all_cards) self.assertTrue(len(all_cards) == 52) deck = Deck() hole_card1 = TexasCard.from_str('7h') hole_card2 = TexasCard.from_str('9s') # remove two cards removed = deck.pop(hole_card1, hole_card2) self.assertTrue(len(removed.pool) == 52 - 2) print(deck.deal(5))
def showdown(string: str): cards = [TexasCard.from_str(s) for s in string.split(' ')] hole_cards = tuple(cards[:2]) community_cards = tuple(cards[2:]) result = eval7_decide_showdown(hole_cards + community_cards) return result
def test_card(self): print([TexasCard.from_str(s) for s in ('As', '2c', '3d', '5s', '4c')])