A base class of a unit in SimulatedGame that peforms actions according to some probability distribution. It does not represents any players in the game. It should be used if either (1) randomness affects actions available to other players (2) randomness heavily affects the game outcome. Random effects should be applied as actions of SimulatedGameStochasticUnit.
More...
#include <SimulatedGameStochasticUnit.hh>
|
virtual int | GetTeamIndex () const override |
| TeamIndex is relevant for SimulatedGameStochasticUnit only for GUI purposes (to show it as a separate team). More...
|
|
virtual size_t | GetRandomActionIndex (std::vector< std::unique_ptr< const ISimulatedGameAction >> &actions, RandomGenerator &rand_gen) const |
| This function returns index of the action (rather than the action itself) chosen according to the unit's logic. The default implementation assumes the uniform random distribution (each action chosen with equal probability). Override it if actions have different chances to be chosen. More...
|
|
virtual void | Reset ()=0 |
| Resets state of the unit to the beginning of the SimulatedGame. More...
|
|
virtual std::vector< std::unique_ptr< const ISimulatedGameAction > > | GetAvailableActions () const =0 |
| Returns the actions the unit may perform. It is strongly advised to create a new vector here, return it and no longer use it. It will be stored in the SimulatedGame structures. This method must always return the same set of actions in the same state. More...
|
|
virtual std::unique_ptr< const ISimulatedGameAction > | GetRandomAvailableAction (RandomGenerator &rand_gen) const |
| Returns a random action to be chosen in simulation. The default implementation samples from GetAvailableActions(). Override the method if you are able to return a uniform random action without the need of computing all available actions. More...
|
|
virtual void | AfterAction (SimulatedGameRuntime &) |
| This method is called after action.Apply(). You may insert custom logic here - for example - code that always needs to be executed after any action. More...
|
|
virtual std::string | ToString () const |
| Returns the text representation of the unit for debugging purposes. Default implementation returns an empty string. More...
|
|
virtual void | FillDebugRepresentation (std::map< std::string, std::string > &nameValueDictionary) const |
| Method used to gather data for GUI-based debugging. Insert properties of the state (key, value) you wish to view in the debugging tool. More...
|
|
|
std::vector< std::unique_ptr< SimulatedGameHeuristic > > | heuristicReasoners |
| Add or remove heuristic. See @SimulatedGameHeuristic. Heuristic is used to provide the action to play in certain moments without considering all the options. More...
|
|
A base class of a unit in SimulatedGame that peforms actions according to some probability distribution. It does not represents any players in the game. It should be used if either (1) randomness affects actions available to other players (2) randomness heavily affects the game outcome. Random effects should be applied as actions of SimulatedGameStochasticUnit.
◆ GetRandomActionIndex()
size_t grail::simgames::SimulatedGameStochasticUnit::GetRandomActionIndex |
( |
std::vector< std::unique_ptr< const ISimulatedGameAction >> & |
actions, |
|
|
RandomGenerator & |
rand_gen |
|
) |
| const |
|
virtual |
This function returns index of the action (rather than the action itself) chosen according to the unit's logic. The default implementation assumes the uniform random distribution (each action chosen with equal probability). Override it if actions have different chances to be chosen.
- Parameters
-
actions | The collection of available actions that is cached for the unit. |
rand_gen | Random generator (typedef std::mt19937_64 RandomGenerator) |
- Returns
- Index of the chosen action. This value cannot be greater than the size of @actions collection.
◆ GetTeamIndex()
int grail::simgames::SimulatedGameStochasticUnit::GetTeamIndex |
( |
| ) |
const |
|
overridevirtual |
The documentation for this class was generated from the following files: