示例#1
0
def find_best_hand(cardlist):
    combos = itertools.combinations(cardlist, 5)
    best_hand = None
    for c in combos:
        if best_hand is None:
            best_hand = Hand(c)
        else:
            compare = best_hand.compare_to_hand(Hand(c))
            if compare == 1:
                continue
            elif compare == -1:
                best_hand = Hand(c)
            elif compare == 0:
                continue
    return best_hand
示例#2
0
def find_best_plo_hand(player_cards, shared_cards):
    combos = select_combinations([
        (player_cards, 2),
        (shared_cards, 3),
    ])
    best_hand = None
    for c in combos:
        if best_hand is None:
            best_hand = Hand(list(c))
        else:
            compare = best_hand.compare_to_hand(Hand(list(c)))
            if compare == 1:
                continue
            elif compare == -1:
                best_hand = Hand(list(c))
            elif compare == 0:
                continue
    return best_hand