def _create_community_combinations(self, opp_hand: Tuple[Card, Card], state: State) -> List[List[Card]]: deck = Deck().get_cards() indexes = [] popped_cards = 0 community_combos = [] nbr_of_comm_cards = len(state.community_cards) if nbr_of_comm_cards >= 5: community_combos.append(state.community_cards) else: for i, c in enumerate(deck): if c in self.get_hand( ) or c in state.community_cards or c in opp_hand: indexes.append(i) for i in indexes: deck.pop(i - popped_cards) popped_cards += 1 if nbr_of_comm_cards < 3: for i1, c1 in enumerate(deck): for i2, c2 in enumerate(deck[i1 + 1:]): for i3, c3 in enumerate(deck[i2 + 1:]): for i4, c4 in enumerate(deck[i3 + 1:]): for c5 in deck[i4 + 1:]: community_combos.append( [c1, c2, c3, c4, c5]) elif nbr_of_comm_cards < 4: for i, c1 in enumerate(deck): for c2 in deck[i + 1:]: community_combos.append( list(state.community_cards) + [c1, c2]) elif nbr_of_comm_cards < 5: for c in deck: community_combos.append(list(state.community_cards) + [c]) return community_combos
def _create_opponent_hand_combinations( self, state: State) -> List[Tuple[Card, Card]]: deck = Deck().get_cards() indexes = [] popped_cards = 0 opponent_hand_combinations = [] for i, c in enumerate(deck): if c in self.get_hand() or c in state.community_cards: indexes.append(i) for i in indexes: deck.pop(i - popped_cards) popped_cards += 1 for i, c1 in enumerate(deck): for c2 in deck[i + 1:]: opponent_hand_combinations.append((c1, c2)) return opponent_hand_combinations