TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
|
A simple utility module that runs a user-supplied function once per game. More...
#include <once.h>
Inherits cherrypi::LambdaModule.
Public Member Functions | |
OnceModule (StepFunctionState func, std::string name=std::string()) | |
OnceModule (StepFunctionStateModule func, std::string name=std::string()) | |
virtual | ~OnceModule ()=default |
virtual void | step (State *state) override |
Public Member Functions inherited from cherrypi::LambdaModule | |
LambdaModule (StepFunctionState fn, std::string name=std::string()) | |
LambdaModule (StepFunctionStateModule fn, std::string name=std::string()) | |
virtual | ~LambdaModule ()=default |
Public Member Functions inherited from cherrypi::Module | |
virtual | ~Module ()=default |
virtual void | setPlayer (BasePlayer *p) |
void | setName (std::string name) |
std::string | name () |
virtual void | onGameStart (State *s) |
virtual void | onGameEnd (State *s) |
Static Public Member Functions | |
static std::shared_ptr< Module > | makeWithSpawns (const std::vector< SpawnPosition > &spawns, std::string name=std::string()) |
Spawns ally units. More... | |
static std::shared_ptr< Module > | makeWithEnemySpawns (const std::vector< SpawnPosition > &spawns, std::string name=std::string()) |
Similar function for enemy units. More... | |
static std::vector< tc::Client::Command > | makeSpawnCommands (const std::vector< SpawnPosition > &spawns, State *state, int playerId) |
Returns a list of commands which spawn units. More... | |
Static Public Member Functions inherited from cherrypi::Module | |
template<typename T , typename... Args> | |
static std::shared_ptr< T > | make (Args &&...args) |
static std::shared_ptr< Module > | make (std::string const &typeName) |
static std::string | makeName (std::type_index const &type) |
Static Protected Member Functions | |
static LambdaModule::StepFunctionState | makeSpawnFn (const std::vector< SpawnPosition > &spawns, bool enemy) |
Convenience function that returns a lambda to spawn units If enemy is true, then the units are spawned for the enemy. More... | |
Additional Inherited Members | |
Public Types inherited from cherrypi::LambdaModule | |
using | StepFunctionState = std::function< void(State *)> |
using | StepFunctionStateModule = std::function< void(State *, Module *)> |
Protected Member Functions inherited from cherrypi::Module | |
Module () | |
Protected Attributes inherited from cherrypi::LambdaModule | |
mapbox::util::variant< StepFunctionState, StepFunctionStateModule > | fn_ |
Protected Attributes inherited from cherrypi::Module | |
BasePlayer * | player_ |
std::string | name_ |
A simple utility module that runs a user-supplied function once per game.
cherrypi::OnceModule::OnceModule | ( | StepFunctionState | func, |
std::string | name = std::string() |
||
) |
cherrypi::OnceModule::OnceModule | ( | StepFunctionStateModule | func, |
std::string | name = std::string() |
||
) |
|
virtualdefault |
|
static |
Returns a list of commands which spawn units.
|
staticprotected |
Convenience function that returns a lambda to spawn units If enemy is true, then the units are spawned for the enemy.
|
static |
Similar function for enemy units.
|
static |
Spawns ally units.
|
overridevirtual |
Reimplemented from cherrypi::LambdaModule.