|
TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
|
Functions | |
| DEFINE_bool (builderhelper_logfailure, false,"Always log failed placements") | |
| std::shared_ptr< UPCTuple > | upcWithPositionForBuilding (State *state, UPCTuple const &upc, BuildType const *type) |
| Refine a building UPC by selecting a dirac location according. More... | |
| template<typename ScoreFunc > | |
| Position | findBuildLocation (State *state, std::vector< Position > const &seeds, BuildType const *type, UPCTuple const &upc, ScoreFunc &&scoreFunc) |
| Position | findBuildLocation (State *state, std::vector< Position > const &seeds, BuildType const *type, UPCTuple const &upc) |
| Find location to construct the building. More... | |
| Position | findBuildLocation (State *state, std::vector< Position > const &seeds, BuildType const *type, UPCTuple const &upc, std::function< double(State *, const BuildType *, const Tile *)> scoreFunc) |
| bool | canBuildAt (State *state, const BuildType *type, const Position &pos, bool ignoreReserved=false, bool logFailure=false) |
| Check whether the building can be constructed at specified location. More... | |
| bool | checkCreepAt (State *state, const BuildType *type, const Position &pos) |
| Check whether there is enough creep for the building at the specified position. More... | |
| Unit * | findGeyserForRefinery (State *state, BuildType const *type, UPCTuple const &upc) |
| Find a free Vespene Geyser for a refinery. More... | |
| Position | findRefineryLocation (State *state, BuildType const *type, UPCTuple const &upc) |
| Find Vespene Geyser location for a refinery. More... | |
| void | dumpMap (const std::string &fname, std::function< bool(const Tile *)> predicate, State *state, const std::vector< Position > &candidateLocations) |
| Position | findResourceDepotLocation (State *state, const BuildType *type, const std::vector< Position > &candidateLocations, bool isExpansion=true) |
| Find location for a new resource depot. More... | |
| std::vector< Position > | candidateExpansionResourceDepotLocations (State *state) |
| Use map information to produce candidate resource depot locations sorted by their proximity to the main base. More... | |
| std::list< std::pair< Position, int > > | candidateExpansionResourceDepotLocationsDistances (State *state) |
| Use map information to produce candidate resource depot locations sorted by their proximity to the main base. More... | |
| std::vector< Position > | buildLocationSeeds (State *state, BuildType const *type, UPCTuple const &upc, Unit *builder=nullptr) |
| Produce seed locations for the building. More... | |
| std::string | buildLocationMasks (State *state, const BuildType *type, const Position &pos) |
| Produces string representation of masks (buildable, building, reservedAsUnbuildable, resourceDepotUnbuildable, reservedForResourceDepot) around the provided build location. More... | |
| void | fullReserve (TilesInfo &tt, BuildType const *type, Position const &pos) |
| Sets Tile::reservedAsUnbuildable to reserve the tiles occupied by a given building type when placed at pos. More... | |
| void | fullUnreserve (TilesInfo &tt, BuildType const *type, Position const &pos) |
| Clears Tile::reservedAsUnbuildable to free the tiles occupied by a given building type when placed at pos. More... | |
| std::string cherrypi::builderhelpers::buildLocationMasks | ( | State * | state, |
| const BuildType * | type, | ||
| const Position & | pos | ||
| ) |
Produces string representation of masks (buildable, building, reservedAsUnbuildable, resourceDepotUnbuildable, reservedForResourceDepot) around the provided build location.
Used for verbose logs mostly for debugging purposes.
| state | Bot's state |
| type | Building type |
| pos | Coordinates of an upper-left corner of the proposed location (in walktiles) |
| bool cherrypi::builderhelpers::canBuildAt | ( | State * | state, |
| const BuildType * | type, | ||
| const Position & | pos, | ||
| bool | ignoreReserved = false, |
||
| bool | logFailure = false |
||
| ) |
Check whether the building can be constructed at specified location.
| state | Bot's state |
| type | Type of the building |
| pos | Location to be checked |
| std::vector< Position > cherrypi::builderhelpers::candidateExpansionResourceDepotLocations | ( | State * | state | ) |
Use map information to produce candidate resource depot locations sorted by their proximity to the main base.
| std::list< std::pair< Position, int > > cherrypi::builderhelpers::candidateExpansionResourceDepotLocationsDistances | ( | State * | state | ) |
Use map information to produce candidate resource depot locations sorted by their proximity to the main base.
| bool cherrypi::builderhelpers::checkCreepAt | ( | State * | state, |
| const BuildType * | type, | ||
| const Position & | pos | ||
| ) |
Check whether there is enough creep for the building at the specified position.
If the building does not require creep, checks that there isn't any. Does not anticipate creep.
| state | Bot's state |
| type | Type of the building |
| pos | Location to be checked |
| cherrypi::builderhelpers::DEFINE_bool | ( | builderhelper_logfailure | , |
| false | , | ||
| "Always log failed placements" | |||
| ) |
| void cherrypi::builderhelpers::dumpMap | ( | const std::string & | fname, |
| std::function< bool(const Tile *)> | predicate, | ||
| State * | state, | ||
| const std::vector< Position > & | candidateLocations | ||
| ) |
| Position cherrypi::builderhelpers::findBuildLocation | ( | State * | state, |
| std::vector< Position > const & | seeds, | ||
| BuildType const * | type, | ||
| UPCTuple const & | upc, | ||
| ScoreFunc && | scoreFunc | ||
| ) |
| Position cherrypi::builderhelpers::findBuildLocation | ( | State * | state, |
| std::vector< Position > const & | seeds, | ||
| BuildType const * | type, | ||
| UPCTuple const & | upc | ||
| ) |
Find location to construct the building.
| state | Bot's state |
| seeds | Seed locations for building location search |
| type | Type of the building |
| upc | UPCTuple with possible restrictions regarding position |
| Position cherrypi::builderhelpers::findBuildLocation | ( | State * | state, |
| std::vector< Position > const & | seeds, | ||
| BuildType const * | type, | ||
| UPCTuple const & | upc, | ||
| std::function< double(State *, const BuildType *, const Tile *)> | scoreFunc | ||
| ) |
| Position cherrypi::builderhelpers::findRefineryLocation | ( | State * | state, |
| BuildType const * | type, | ||
| UPCTuple const & | upc | ||
| ) |
Find Vespene Geyser location for a refinery.
| state | Bot's state |
| type | Building type of the refinery |
| upc | UPCTuple with possible restrictions regarding position |
| Position cherrypi::builderhelpers::findResourceDepotLocation | ( | State * | state, |
| const BuildType * | type, | ||
| const std::vector< Position > & | candidateLocations, | ||
| bool | isExpansion = true |
||
| ) |
Find location for a new resource depot.
| state | Bot's state |
| type | Type of the building |
| candidateLocations | Candidate locations for resource depots, sorted in the order of location preference - the most preferred comes first |
| void cherrypi::builderhelpers::fullReserve | ( | TilesInfo & | tt, |
| BuildType const * | type, | ||
| Position const & | pos | ||
| ) |
Sets Tile::reservedAsUnbuildable to reserve the tiles occupied by a given building type when placed at pos.
| void cherrypi::builderhelpers::fullUnreserve | ( | TilesInfo & | tt, |
| BuildType const * | type, | ||
| Position const & | pos | ||
| ) |
Clears Tile::reservedAsUnbuildable to free the tiles occupied by a given building type when placed at pos.
| std::shared_ptr< UPCTuple > cherrypi::builderhelpers::upcWithPositionForBuilding | ( | State * | state, |
| UPCTuple const & | upc, | ||
| BuildType const * | type | ||
| ) |
Refine a building UPC by selecting a dirac location according.
This will use a combination of the individual rules defined in this namespace.
| upc | Source UPC |
| type | A concrete building type selected from the source UPC |
1.8.11