Esempio n. 1
0
def _restore_deck(str_exclude_cards):
    deck = Deck()
    exclude_ids = [Card.to_id(Card.from_str(s)) for s in str_exclude_cards]
    deck_cards = [
        Card.from_id(cid) for cid in range(1, 53) if cid not in exclude_ids
    ]
    deck.deck = deck_cards
    return deck
Esempio n. 2
0
def get_best_hand(community_card_list):
    hand_strength_set = {0}
    deck = Deck()
    for card in community_card_list:
        deck.deck.remove(card)
    for possible_card_a in deck.deck:
        deck.deck.remove(possible_card_a)
        for possible_card_b in deck.deck:
            hand_strength = HandEvaluator.eval_hand([possible_card_a, possible_card_b], community_card_list)
            if hand_strength > max(hand_strength_set):
                nuts_cards = {(str(possible_card_a), str(possible_card_b))}
            elif hand_strength == max(hand_strength_set):
                if not (str(possible_card_b), str(possible_card_a)) in nuts_cards:
                    nuts_cards.add((str(possible_card_a), str(possible_card_b)))
            hand_strength_set.add(hand_strength)
        deck.deck = [possible_card_a] + deck.deck
    return nuts_cards
Esempio n. 3
0
def _restore_deck(str_exclude_cards):
    deck = Deck()
    exclude_ids = [Card.to_id(Card.from_str(s)) for s in str_exclude_cards]
    deck_cards = [Card.from_id(cid) for cid in range(1, 53) if cid not in exclude_ids]
    deck.deck = deck_cards
    return deck