Exemple #1
0
}
# 6/7 card hands--they should evaluate to the same 5-card hands though
# (except high-card/kicker stuff)
hands_6 = {}
for k in hands_5.keys():
    hands_6[k] = hands_5[k] + [Card(10,3)]
hands_6_more = {}
hands_7 = {}
for k in hands_6.keys():
    hands_7[k] = hands_6[k] + [Card(2,4)]

print "----Testing 2-card hands----"
for k in sorted(hands_2.keys()):
    cards = hands_2[k]
    print "Percentile of %s is %s (%s expected)" % (k,
        HandEvaluator.evaluate_hand(cards),
        HandEvaluator.evaluate_preflop_hand(cards)
    )
print "----Testing 5-card hands----"
for k in sorted(hands_5.keys()):
    cards = hands_5[k]
    print "Rank of %s is %s" % (k, HandEvaluator.Five.evaluate_rank(cards))
    print "Percentile of %s is %s" % (k, HandEvaluator.evaluate_hand(cards[0:2],cards[2:7]))
print "----Testing 6-card hands----"
for k in sorted(hands_6.keys()):
    cards = hands_6[k]
    rank_6 = HandEvaluator.Six.evaluate_rank(cards)
    rank_5 = min(map(HandEvaluator.Five.evaluate_rank, combinations(cards,5)))
    print "Rank of %s is %s (%s expected)" % (k, rank_6, rank_5)
    print "Percentile of %s is %s" % (k, HandEvaluator.evaluate_hand(cards[0:2],cards[2:7]))
print "----Testing 7-card hands----"
Exemple #2
0
        Card(11,1), Card(11,2), Card(11,3), Card(11,4),
        Card(12,1), Card(12,2), Card(12,3), Card(12,4),
        Card(13,1), Card(13,2), Card(13,3), Card(13,4),
        Card(14,1), Card(14,2), Card(14,3), Card(14,4)
    ]

    random.shuffle(deck)
    h1 = deck.pop()
    h2 = deck.pop()
    c1 = deck.pop()
    c2 = deck.pop()
    c3 = deck.pop()

    your_hand = (h1, h2,)
    flop = (c1, c2, c3,)
    your_rank = HandEvaluator.evaluate_hand(your_hand + flop)
    possible_opponent_hands = combinations(deck, 2)
    counter = 0
    for hand in possible_opponent_hands:
        counter += 1
        opponent_rank = HandEvaluator.evaluate_hand(hand + flop)

    turn = (deck.pop(),)
    your_rank = HandEvaluator.evaluate_hand(your_hand + flop + turn)
    counter = 0
    possible_opponent_hands = combinations(deck, 2)
    for hand in possible_opponent_hands:
        counter += 1
        opponent_rank = HandEvaluator.evaluate_hand(hand + flop)

    river = (deck.pop(),)
Exemple #3
0
}
# 6/7 card hands--they should evaluate to the same 5-card hands though
# (except high-card/kicker stuff)
hands_6 = {}
for k in hands_5.keys():
    hands_6[k] = hands_5[k] + [Card(10, 3)]
hands_6_more = {}
hands_7 = {}
for k in hands_6.keys():
    hands_7[k] = hands_6[k] + [Card(2, 4)]

print "----Testing 2-card hands----"
for k in sorted(hands_2.keys()):
    cards = hands_2[k]
    print "Percentile of %s is %s (%s expected)" % (
        k, HandEvaluator.evaluate_hand(cards),
        HandEvaluator.evaluate_preflop_hand(cards))
print "----Testing 5-card hands----"
for k in sorted(hands_5.keys()):
    cards = hands_5[k]
    print "Rank of %s is %s" % (k, HandEvaluator.Five.evaluate_rank(cards))
    print "Percentile of %s is %s" % (
        k, HandEvaluator.evaluate_hand(cards[0:2], cards[2:7]))
print "----Testing 6-card hands----"
for k in sorted(hands_6.keys()):
    cards = hands_6[k]
    rank_6 = HandEvaluator.Six.evaluate_rank(cards)
    rank_5 = min(map(HandEvaluator.Five.evaluate_rank, combinations(cards, 5)))
    print "Rank of %s is %s (%s expected)" % (k, rank_6, rank_5)
    print "Percentile of %s is %s" % (
        k, HandEvaluator.evaluate_hand(cards[0:2], cards[2:7]))