Grail (C++)
1.1.1
A multi-platform, modular, universal engine for embedding advanced AI in games.
|
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>
Public Member Functions | |
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... | |
Public Member Functions inherited from grail::simulation::ISimulatedGameUnit | |
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. 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... | |
Friends | |
class | SimulatedGame |
Additional Inherited Members | |
Public Attributes inherited from grail::simulation::ISimulatedGameUnit | |
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.
|
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.
actions | The collection of available actions that is cached for the unit. |
rand_gen | Random generator (typedef std::mt19937_64 RandomGenerator) |
|
overridevirtual |
TeamIndex is relevant for SimulatedGameStochasticUnit only for GUI purposes (to show it as a separate team).
Implements grail::simulation::ISimulatedGameUnit.