def deck_without(cards): returnme = [] for c in Deck.GetFullDeck(): if c not in cards: returnme.append(c) return returnme flop = deck.draw(3) pr(flop) h_rc_flop = e.get_rank_class(e.evaluate(hole, flop)) if pause: dummy = raw_input('Think hard... ') print print "Starting with", e.class_to_string(h_rc_flop) ## start simulating turn cards, counting outs n_outs = 0 maxiter = 52 - 5 # runs every turn card remaining in deck outs = [] # You have five outs. Five outs to WHAT HANDS? Two outs get you trips, # and three outs get you two pair. Setup a dict that lets us answer # this question. outs_hands = {} for i in range(1,10): # rank classes are [1 .. 9] outs_hands[e.class_to_string(i)] = 0 for i in range(maxiter):
def distinguish_high_card(hole, board): hrs, brs = extract_ranks(hole, board) if 12 in hrs: return 'Ace High in Hole' if 12 in brs: return 'Ace High to Board' else: return 'No Made Hand' #### main loop #### lol = all_hands_in_range(range_list) for L in lol: hr = e.evaluate(L, board) rc = e.get_rank_class(hr) s = e.class_to_string(rc) if s == 'Pair': s = distinguish_pairs(L, board) if s == 'Three of a Kind': s = distinguish_three_of(L, board) if s == 'High Card': s = distinguish_high_card(L, board) increment_dict(rc_counts, s) #### print #### def pad_to(n, s): while len(s) < n: s += ' ' return s
def r2t(x): return evaluator.class_to_string(evaluator.get_rank_class(x)) def r2c(x): return evaluator.get_rank_class(x) def list_to_pretty_str(card_ints): output = " " for i in range(len(card_ints)): c = card_ints[i] if i != len(card_ints) - 1: output += Card.int_to_pretty_str(c) + "," else: output += Card.int_to_pretty_str(c) + " " return output print "nut_hand,flop_leader,num_players" for num_players in range(2,7): for i in range(5000): deck = Deck() flop = deck.draw(3) rank_clasess= [] for p in range(num_players): player = deck.draw(4) realrank = omaha_eval(player, flop) rank_clasess.append(r2c(realrank)) winner = min(rank_clasess) print nut_hand(flop) + "," + str(winner) + ' ' + evaluator.class_to_string(winner) + "," + str(num_players)