10 #include "controller.h" 12 #include "modules/builder.h" 30 std::unordered_map<Unit*, float> unitProbs,
31 std::shared_ptr<BuilderControllerData> bcdata);
33 virtual const char*
getName()
const override {
71 std::shared_ptr<BuilderControllerData>
bcdata_;
89 std::unordered_map<Unit*, float> unitProbs,
90 std::shared_ptr<BuilderControllerData> bcdata,
96 virtual const char*
getName()
const override {
97 return "WorkerBuilder";
101 std::string logPrefix()
const;
105 Unit* detector_ =
nullptr;
107 bool constructionStarted_ =
false;
108 int lastCheckLocation_ = 0;
109 int lastMoveUnitsInTheWay_ = 0;
110 int moveAttempts_ = 0;
111 std::unordered_set<Unit*> movedUnits_;
112 int buildAttempts_ = 0;
113 std::shared_ptr<Tracker> tracker_ =
nullptr;
115 bool moving_ =
false;
116 bool building_ =
false;
129 std::unordered_map<Unit*, float> unitProbs,
130 std::shared_ptr<BuilderControllerData> bcdata);
133 virtual void step(
State* state)
override;
137 std::string logPrefix()
const;
141 bool constructionStarted_ =
false;
142 std::shared_ptr<Tracker> tracker_ =
nullptr;
virtual bool didSucceed() const override
Implement this to return whether your custom Controller did succeed in its mission (if applicable) an...
Definition: builderc.h:38
auto larvaBuilderScore(State *state, bool preferSaturation)
Returns scoring function for selecting a unit to build a Larva-based unit.
Definition: builderc.cpp:141
Game state.
Definition: state.h:42
std::shared_ptr< BuilderControllerData > bcdata_
Definition: builderc.h:71
virtual bool didFail() const override
Implement this to return whether your custom Controller did fail in its mission (if applicable) and c...
Definition: builderc.h:41
void setPriority(float value)
Definition: builderc.h:60
auto hatcheryTechBuilderScore(State *state)
Returns scoring function for selecting a unit to morph a hatchery or lair.
Definition: builderc.cpp:203
virtual const char * getName() const override
A name for this Controller, for debugging purposes.
Definition: builderc.h:96
Represents and holds information about buildable types (units, upgrades, techs).
Definition: buildtype.h:36
bool cancelled(State *state) const
Definition: builderc.cpp:234
void releaseUnit(State *state, Unit *unit)
Definition: builderc.cpp:89
bool findBuilder(State *state, Position const &pos=Position())
Definition: builderc.cpp:249
BuilderControllerBase(Module *module, BuildType const *type, std::unordered_map< Unit *, float > unitProbs, std::shared_ptr< BuilderControllerData > bcdata)
Definition: builderc.cpp:40
virtual void step(State *state)
Advance controller state and produce UPCs.
Definition: controller.cpp:54
TrackerStatus
Definition: tracker.h:16
Unit * builder_
Definition: builderc.h:69
virtual ~BuilderControllerBase()=default
void grabUnit(State *state, Unit *unit)
Definition: builderc.cpp:50
bool failed_
Definition: builderc.h:73
virtual const char * getName() const override
A name for this Controller, for debugging purposes.
Definition: builderc.h:33
std::unordered_map< Unit *, float > unitProbs_
Definition: builderc.h:70
Represents a unit in the game.
Definition: unitsinfo.h:35
BuildType const * type_
Definition: builderc.h:68
Base class for single-task controllers.
Definition: controller.h:156
A unit production controller for units that require a worker.
Definition: builderc.h:84
A unit production controller for all other units.
Definition: builderc.h:124
float priority()
Definition: builderc.h:57
bool succeeded_
Definition: builderc.h:72
BuildType const * type()
Definition: builderc.h:63
float priority_
Definition: builderc.h:74
Main namespace for bot-related code.
Definition: areainfo.cpp:17
virtual void removeUnit(State *state, Unit *unit, UpcId id)
Remove a unit from this controller.
Definition: controller.cpp:22
int UpcId
Definition: basetypes.h:23
Interface for bot modules.
Definition: module.h:30
Base class for controllers used by BuilderModule.
Definition: builderc.h:25
Vec2T< int > Position
Definition: basetypes.h:178
auto defaultUnitBuilderScore(State *state)
Returns scoring function for selecting a unit to build another (non-building) unit.
Definition: builderc.cpp:116