(self, node)
Sets the internal env wrapper to the state ""node"" is in.

        Args:
            node:                   Any node (of any type) in a PublicTree instance.
Sets the internal env wrapper to the state ""node"" is in.
Sets the internal env wrapper to the state node is in .
def set_to_public_tree_node_state(self, node):
        """
        Sets the internal env wrapper to the state ""node"" is in.

        Args:
            node:                   Any node (of any type) in a PublicTree instance.

        """
        state_seq = []  # will be sorted. [0] is root.

        def add(_node):
            if _node is not None:
                if _node.p_id_acting_next != _node.tree.CHANCE_ID:
                    self.env.load_state_dict(_node.env_state)
                    state_seq.insert(0, self.env.get_current_obs(is_terminal=False))
                add(_node.parent)

        add(node)  # will step from node to parent to parent of parent... to root.
        self.reset()
        self._reset_state()  # from .reset() the first obs is in by default

        # fake step in the internal env to gain current rr state
        for obs in state_seq:
            self._pushback(env_obs=obs)

        assert len(state_seq) == len(self._list_of_obs_this_episode)

        self.env.load_state_dict(node.env_state, blank_private_info=True)
        assert np.array_equal(node.env_state[EnvDictIdxs.board_2d], self.env.board)
def set_to_public_tree_node_state ( self , node ) : state_seq = [ ] # will be sorted. [0] is root. def add ( _node ) : if _node is not None : if _node . p_id_acting_next != _node . tree . CHANCE_ID : self . env . load_state_dict ( _node . env_state ) state_seq . insert ( 0 , self . env . get_current_obs ( is_terminal = False ) ) add ( _node . parent ) add ( node ) # will step from node to parent to parent of parent... to root. self . reset ( ) self . _reset_state ( ) # from .reset() the first obs is in by default # fake step in the internal env to gain current rr state for obs in state_seq : self . _pushback ( env_obs = obs ) assert len ( state_seq ) == len ( self . _list_of_obs_this_episode ) self . env . load_state_dict ( node . env_state , blank_private_info = True ) assert np . array_equal ( node . env_state [ EnvDictIdxs . board_2d ] , self . env . board )