# 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----" for k in sorted(hands_7.keys()):
# 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----"