|
TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
|
A unit production controller for units that require a worker. More...
#include <builderc.h>
Inherits cherrypi::BuilderControllerBase.
Public Member Functions | |
| WorkerBuilderController (Module *module, BuildType const *type, std::unordered_map< Unit *, float > unitProbs, std::shared_ptr< BuilderControllerData > bcdata, Position pos) | |
| virtual | ~WorkerBuilderController ()=default |
| virtual void | step (State *state) override |
| Advance controller state and produce UPCs. More... | |
| virtual void | removeUnit (State *state, Unit *unit, UpcId id) override |
| Remove a unit from this controller. More... | |
| virtual const char * | getName () const override |
| A name for this Controller, for debugging purposes. More... | |
Public Member Functions inherited from cherrypi::BuilderControllerBase | |
| BuilderControllerBase (Module *module, BuildType const *type, std::unordered_map< Unit *, float > unitProbs, std::shared_ptr< BuilderControllerData > bcdata) | |
| virtual | ~BuilderControllerBase ()=default |
| float | priority () |
| void | setPriority (float value) |
| BuildType const * | type () |
Public Member Functions inherited from cherrypi::Controller | |
| Controller (Module *module) | |
| virtual | ~Controller ()=default |
| void | setUpcId (UpcId id) |
| Set the UPC ID of the corresponding task. More... | |
Public Member Functions inherited from cherrypi::ControllerBase | |
| ControllerBase (Module *module) | |
| virtual | ~ControllerBase ()=default |
| virtual void | addUnit (State *state, Unit *unit, UpcId id) |
| Add a unit to this controller. More... | |
| virtual bool | keepUnit (State *state, Unit *unit) const |
| Decide whether to keep a unit. More... | |
| bool | isControllingUnitWith (Unit *unit, UpcId id) const |
| Checks if the controller is controlling the given unit via the given UPC ID. More... | |
Protected Member Functions | |
| std::string | logPrefix () const |
Protected Member Functions inherited from cherrypi::BuilderControllerBase | |
| virtual bool | didSucceed () const override |
| Implement this to return whether your custom Controller did succeed in its mission (if applicable) and can be disposed. More... | |
| virtual bool | didFail () const override |
| Implement this to return whether your custom Controller did fail in its mission (if applicable) and can be disposed. More... | |
| void | grabUnit (State *state, Unit *unit) |
| void | releaseUnit (State *state, Unit *unit) |
| bool | findBuilder (State *state, Position const &pos=Position()) |
| auto | defaultUnitBuilderScore (State *state) |
| Returns scoring function for selecting a unit to build another (non-building) unit. More... | |
| auto | larvaBuilderScore (State *state, bool preferSaturation) |
| Returns scoring function for selecting a unit to build a Larva-based unit. More... | |
| auto | hatcheryTechBuilderScore (State *state) |
| Returns scoring function for selecting a unit to morph a hatchery or lair. More... | |
| bool | cancelled (State *state) const |
Protected Member Functions inherited from cherrypi::ControllerBase | |
| void | postUpcs (State *state) |
| Posts scheduled UPCs to the Blackboard. More... | |
| template<typename... Args> | |
| void | addUpc (Unit *unit, Args &&...args) |
| Schedules an action (as a UPC) for the given unit which will be posted after doStep(). More... | |
Additional Inherited Members | |
Protected Attributes inherited from cherrypi::BuilderControllerBase | |
| BuildType const * | type_ |
| Unit * | builder_ = nullptr |
| std::unordered_map< Unit *, float > | unitProbs_ |
| std::shared_ptr< BuilderControllerData > | bcdata_ |
| bool | succeeded_ = false |
| bool | failed_ = false |
| float | priority_ |
Protected Attributes inherited from cherrypi::Controller | |
| UpcId | upcId_ |
Protected Attributes inherited from cherrypi::ControllerBase | |
| Module * | module_ |
| std::unordered_map< Unit *, UpcId > | units_ |
| std::unordered_map< Unit *, std::pair< UpcId, std::shared_ptr< UPCTuple > > > | upcs_ |
A unit production controller for units that require a worker.
This is used by BuilderModule. It is assumed that every type that this controller should produce is a building.
| cherrypi::WorkerBuilderController::WorkerBuilderController | ( | Module * | module, |
| BuildType const * | type, | ||
| std::unordered_map< Unit *, float > | unitProbs, | ||
| std::shared_ptr< BuilderControllerData > | bcdata, | ||
| Position | pos | ||
| ) |
|
virtualdefault |
|
inlineoverridevirtual |
A name for this Controller, for debugging purposes.
Reimplemented from cherrypi::BuilderControllerBase.
|
protected |
|
overridevirtual |
Remove a unit from this controller.
This is usually called from Task::update() to remove units that were assigned to other Tasks, or for which keepUnit() returns false. Re-implement this function if you need to update internal data structures when gaining control of units but make sure to also call the base class method.
Reimplemented from cherrypi::ControllerBase.
|
overridevirtual |
Advance controller state and produce UPCs.
This is intended to be called from Module::step() of the instantiating module. The default implementation does nothing.
Reimplemented from cherrypi::ControllerBase.
1.8.11