def get_payoff_matrix(hand_A, hand_B):
  payoff_matrix = []
  for pass1 in itertools.combinations(range(hand_size), num_passed):
    row = []
    for pass2 in itertools.combinations(range(hand_size), num_passed):
      new_hand_A = set() 
      new_hand_B = set() 
      for i in range(hand_size):
        if i in pass1: new_hand_B.add(hand_A[i])
        else:          new_hand_A.add(hand_A[i])
        if i in pass2: new_hand_A.add(hand_B[i])
        else:          new_hand_B.add(hand_B[i])
      winner = hand_evaluation.poker_hand_comparator(new_hand_A, new_hand_B)

      # best_hand_A = hand_evaluation.best_poker_hand(new_hand_A)
      # best_hand_B = hand_evaluation.best_poker_hand(new_hand_B)
      # old_winner = hand_evaluation.poker_hand_comparator(best_hand_A, best_hand_B)
      # if (winner != old_winner): print winner, old_winner

      row.append(winner)
    payoff_matrix.append(row)
  return payoff_matrix
Exemple #2
0
def compare_hands(handA, handB):
  handA = [game_simulator.string_to_card(x) for x in handA]
  handB = [game_simulator.string_to_card(x) for x in handB]
  return hand_evaluation.poker_hand_comparator(handA, handB)