gym_splendor_code/envs/mechanics/abstract_observation.py
def recreate_state(self):
        """Loads observation and return a current_state that agrees with the observation. Warning: this method is ambiguous,
        that is, many states can have the same observation (they may differ in the order of hidden cards)."""
        state = State(all_cards=StochasticObservation.all_cards, all_nobles=StochasticObservation.all_nobles, prepare_state=False)
        cards_on_board_names = self.observation_dict['cards_on_board_names']
        nobles_on_board_names = self.observation_dict['nobles_on_board_names']
        for card_name in cards_on_board_names:
            card = name_to_card_dict[card_name]
            state.board.cards_on_board.add(card)
            state.board.deck.decks_dict[card.row].remove(card)

        for noble_name in nobles_on_board_names:
            noble = name_to_noble_dict[noble_name]
            state.board.nobles_on_board.add(noble)
            state.board.deck.deck_of_nobles.remove(noble)

        state.board.gems_on_board = self.observation_dict['gems_on_board']

        players_hands = []
        for player_observation in self.observation_dict['players_hands']:
            players_hand = PlayersHand()
            players_hand.gems_possessed = player_observation['gems_possessed']
            for card_name in player_observation['cards_possessed_names']:
                card = name_to_card_dict[card_name]
                players_hand.cards_possessed.add(card)
                state.board.deck.decks_dict[card.row].remove(card)
            for card_name in player_observation['cards_reserved_names']:
                card = name_to_card_dict[card_name]
                players_hand.cards_reserved.add(card)
                state.board.deck.decks_dict[card.row].remove(card)
            for noble_name in player_observation['nobles_possessed_names']:
                noble = name_to_noble_dict[noble_name]
                players_hand.nobles_possessed.add(noble)
                state.board.deck.deck_of_nobles.remove(noble)
            players_hands.append(players_hand)

        state.active_player_id = self.observation_dict['active_player_id']
        state.list_of_players_hands = players_hands
        return state
Loads observation and return a current_state that agrees with the observation. Warning: this method is ambiguous,
        that is, many states can have the same observation (they may differ in the order of hidden cards).
Loads observation and return a current_state that agrees with the observation. Warning: this method is ambiguous,
that is, many states can have the same observation (they may differ in the order of hidden cards).
Loads observation and return a current_state that agrees with the observation . Warning : this method is ambiguous that is many states can have the same observation ( they may differ in the order of hidden cards ) .
def recreate_state(self):
        state = State(all_cards=StochasticObservation.all_cards, all_nobles=StochasticObservation.all_nobles, prepare_state=False)
        cards_on_board_names = self.observation_dict['cards_on_board_names']
        nobles_on_board_names = self.observation_dict['nobles_on_board_names']
        for card_name in cards_on_board_names:
            card = name_to_card_dict[card_name]
            state.board.cards_on_board.add(card)
            state.board.deck.decks_dict[card.row].remove(card)
        for noble_name in nobles_on_board_names:
            noble = name_to_noble_dict[noble_name]
            state.board.nobles_on_board.add(noble)
            state.board.deck.deck_of_nobles.remove(noble)
        state.board.gems_on_board = self.observation_dict['gems_on_board']
        players_hands = []
        for player_observation in self.observation_dict['players_hands']:
            players_hand = PlayersHand()
            players_hand.gems_possessed = player_observation['gems_possessed']
            for card_name in player_observation['cards_possessed_names']:
                card = name_to_card_dict[card_name]
                players_hand.cards_possessed.add(card)
                state.board.deck.decks_dict[card.row].remove(card)
            for card_name in player_observation['cards_reserved_names']:
                card = name_to_card_dict[card_name]
                players_hand.cards_reserved.add(card)
                state.board.deck.decks_dict[card.row].remove(card)
            for noble_name in player_observation['nobles_possessed_names']:
                noble = name_to_noble_dict[noble_name]
                players_hand.nobles_possessed.add(noble)
                state.board.deck.deck_of_nobles.remove(noble)
            players_hands.append(players_hand)
        state.active_player_id = self.observation_dict['active_player_id']
        state.list_of_players_hands = players_hands
        return state
def recreate_state ( self ) : state = State ( all_cards = StochasticObservation . all_cards , all_nobles = StochasticObservation . all_nobles , prepare_state = False ) cards_on_board_names = self . observation_dict [ 'cards_on_board_names' ] nobles_on_board_names = self . observation_dict [ 'nobles_on_board_names' ] for card_name in cards_on_board_names : card = name_to_card_dict [ card_name ] state . board . cards_on_board . add ( card ) state . board . deck . decks_dict [ card . row ] . remove ( card ) for noble_name in nobles_on_board_names : noble = name_to_noble_dict [ noble_name ] state . board . nobles_on_board . add ( noble ) state . board . deck . deck_of_nobles . remove ( noble ) state . board . gems_on_board = self . observation_dict [ 'gems_on_board' ] players_hands = [ ] for player_observation in self . observation_dict [ 'players_hands' ] : players_hand = PlayersHand ( ) players_hand . gems_possessed = player_observation [ 'gems_possessed' ] for card_name in player_observation [ 'cards_possessed_names' ] : card = name_to_card_dict [ card_name ] players_hand . cards_possessed . add ( card ) state . board . deck . decks_dict [ card . row ] . remove ( card ) for card_name in player_observation [ 'cards_reserved_names' ] : card = name_to_card_dict [ card_name ] players_hand . cards_reserved . add ( card ) state . board . deck . decks_dict [ card . row ] . remove ( card ) for noble_name in player_observation [ 'nobles_possessed_names' ] : noble = name_to_noble_dict [ noble_name ] players_hand . nobles_possessed . add ( noble ) state . board . deck . deck_of_nobles . remove ( noble ) players_hands . append ( players_hand ) state . active_player_id = self . observation_dict [ 'active_player_id' ] state . list_of_players_hands = players_hands return state
Loads observation and return a current_state that agrees with the observation.
Loads observation and return a current_state that agrees with the observation .
"""Loads observation and return a current_state that agrees with the observation. Warning: this method is ambiguous,
        that is, many states can have the same observation (they may differ in the order of hidden cards)."""
self