def instantiate_full_houses(self): full_house_index = 167 for three_card in reversed(ranks): for two_card in reversed(ranks): if two_card != three_card: hand = Hand([Card(three_card, 's')] * 3 + [Card(two_card, 'd')] * 2) self.prime_table[hand.p_value()] = full_house_index full_house_index += 1
def instantiate_four_of_a_kinds(self): four_of_a_kind_index = 11 for four_card in reversed(ranks): for single_card in reversed(ranks): if single_card != four_card: hand = Hand([Card(four_card, 's')] * 4 + [Card(single_card, 'd')]) self.prime_table[hand.p_value()] = four_of_a_kind_index four_of_a_kind_index += 1
def instantiate_two_pair(self): two_pair_index = 2468 for two_card_1, two_card_2 in combinations(reversed(ranks), 2): for single_card in reversed( [c for c in ranks if c != two_card_1 and c != two_card_2]): hand = Hand([Card(two_card_1, 'd')] * 2 + [Card(two_card_2, 'c')] * 2 + [Card(single_card, 'c')]) self.prime_table[hand.p_value()] = two_pair_index two_pair_index += 1
def instantiate_three_of_a_kind(self): three_of_a_kind_index = 1610 for three_card in reversed(ranks): for single_card_1, single_card_2 in combinations( reversed([c for c in ranks if c != three_card]), 2): hand = Hand( [Card(three_card, 's')] * 3 + [Card(single_card_1, 'd'), Card(single_card_2, 'd')]) self.prime_table[hand.p_value()] = three_of_a_kind_index three_of_a_kind_index += 1
def instantiate_one_pair(self): one_pair_index = 3326 for two_card in reversed(ranks): for single_card_1, single_card_2, single_card_3 in combinations( reversed([c for c in ranks if c != two_card]), 3): hand = Hand([Card(two_card, 's')] * 2 + [ Card(single_card_1, 'd'), Card(single_card_2, 'd'), Card(single_card_3, 'd') ]) self.prime_table[hand.p_value()] = one_pair_index one_pair_index += 1