(self, node, agent)
The agent has to know the reach_probs. Therefore he has to go through all of the previous nodes to build
        be able to output a strategy for a given node. Reach_probs are saved directly under node.reach_probs
The agent has to know the reach_probs. Therefore he has to go through all of the previous nodes to build
        be able to output a strategy for a given node. Reach_probs are saved directly under node.reach_probs
The agent has to know the reach_probs . Therefore he has to go through all of the previous nodes to build be able to output a strategy for a given node . Reach_probs are saved directly under node . reach_probs
def _fill_with_agent_policy(self, node, agent):
        """
        The agent has to know the reach_probs. Therefore he has to go through all of the previous nodes to build
        be able to output a strategy for a given node. Reach_probs are saved directly under node.reach_probs
        """

        if node is not self._tree.root and node.p_id_acted_last is not self._tree.CHANCE_ID:
            assert node.parent.strategy.shape == (self._env_bldr.rules.RANGE_SIZE, len(node.parent.children),)
            assert np.all(np.abs(np.sum(node.parent.strategy, axis=1) - 1) < 0.001)

        if node.is_terminal:
            return

        # _______________________________________ set strategy of node _________________________________________________
        # Chance acted last or regular action after action node
        if isinstance(node, ChanceNode) or (isinstance(node, PlayerActionNode)
                                            and (not node.is_terminal)
                                            and node.p_id_acting_next != self._tree.CHANCE_ID):
            # fake steps the agent's internal env to the current state
            agent.set_to_public_tree_node_state(node=node)

            assert node.p_id_acting_next == agent._internal_env_wrapper.env.current_player.seat_id, node.p_id_acting_next

            agent_strat = agent.get_a_probs_for_each_hand()
            node.strategy = agent_strat[:, node.allowed_actions]

        # ___________ recursion
        for c in node.children:
            self._fill_with_agent_policy(node=c, agent=agent)
def _fill_with_agent_policy ( self , node , agent ) : if node is not self . _tree . root and node . p_id_acted_last is not self . _tree . CHANCE_ID : assert node . parent . strategy . shape == ( self . _env_bldr . rules . RANGE_SIZE , len ( node . parent . children ) , ) assert np . all ( np . abs ( np . sum ( node . parent . strategy , axis = 1 ) - 1 ) < 0.001 ) if node . is_terminal : return # _______________________________________ set strategy of node _________________________________________________ # Chance acted last or regular action after action node if isinstance ( node , ChanceNode ) or ( isinstance ( node , PlayerActionNode ) and ( not node . is_terminal ) and node . p_id_acting_next != self . _tree . CHANCE_ID ) : # fake steps the agent's internal env to the current state agent . set_to_public_tree_node_state ( node = node ) assert node . p_id_acting_next == agent . _internal_env_wrapper . env . current_player . seat_id , node . p_id_acting_next agent_strat = agent . get_a_probs_for_each_hand ( ) node . strategy = agent_strat [ : , node . allowed_actions ] # ___________ recursion for c in node . children : self . _fill_with_agent_policy ( node = c , agent = agent )