parameters: (self, state)
docstring: Evaluate the value of a state.
docstring_summary: Evaluate the value of a state.
docstring_tokens: Evaluate the value of a state .
function: def eval_state(self, state):
      """Evaluate the value of a state."""
      state_str = state.observation_string(pyspiel.PlayerId.DEFAULT_PLAYER_ID)
      if self._state_value.has(state_str):
        return self._state_value(state_str)
      elif state.is_terminal():
        self._state_value.set_value(
            state_str,
            state.rewards()[state.mean_field_population()])
        return self._state_value(state_str)
      elif state.current_player() == pyspiel.PlayerId.CHANCE:
        self._state_value.set_value(state_str, 0.0)
        for action, prob in state.chance_outcomes():
          new_state = state.child(action)
          self._state_value.add_value(state_str,
                                      prob * self.eval_state(new_state))
        return self._state_value(state_str)
      elif state.current_player() == pyspiel.PlayerId.MEAN_FIELD:
        dist_to_register = state.distribution_support()
        dist = [
            self._distribution.value_str(str_state, 0.)
            for str_state in dist_to_register
        ]
        new_state = state.clone()
        new_state.update_distribution(dist)
        self._state_value.set_value(
            state_str,
            state.rewards()[state.mean_field_population()] +
            self.eval_state(new_state))
        return self._state_value(state_str)
      else:
        assert int(state.current_player()) >= 0, "The player id should be >= 0"
        v = 0.0
        for action, prob in self._policy.action_probabilities(state).items():
          new_state = state.child(action)
          v += prob * self.eval_state(new_state)
        self._state_value.set_value(
            state_str,
            state.rewards()[state.mean_field_population()] + v)
        return self._state_value(state_str)
function_tokens: def eval_state ( self , state ) : state_str = state . observation_string ( pyspiel . PlayerId . DEFAULT_PLAYER_ID ) if self . _state_value . has ( state_str ) : return self . _state_value ( state_str ) elif state . is_terminal ( ) : self . _state_value . set_value ( state_str , state . rewards ( ) [ state . mean_field_population ( ) ] ) return self . _state_value ( state_str ) elif state . current_player ( ) == pyspiel . PlayerId . CHANCE : self . _state_value . set_value ( state_str , 0.0 ) for action , prob in state . chance_outcomes ( ) : new_state = state . child ( action ) self . _state_value . add_value ( state_str , prob * self . eval_state ( new_state ) ) return self . _state_value ( state_str ) elif state . current_player ( ) == pyspiel . PlayerId . MEAN_FIELD : dist_to_register = state . distribution_support ( ) dist = [ self . _distribution . value_str ( str_state , 0. ) for str_state in dist_to_register ] new_state = state . clone ( ) new_state . update_distribution ( dist ) self . _state_value . set_value ( state_str , state . rewards ( ) [ state . mean_field_population ( ) ] + self . eval_state ( new_state ) ) return self . _state_value ( state_str ) else : assert int ( state . current_player ( ) ) >= 0 , "The player id should be >= 0" v = 0.0 for action , prob in self . _policy . action_probabilities ( state ) . items ( ) : new_state = state . child ( action ) v += prob * self . eval_state ( new_state ) self . _state_value . set_value ( state_str , state . rewards ( ) [ state . mean_field_population ( ) ] + v ) return self . _state_value ( state_str )