TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
|
Access point for area and base information. More...
#include <areainfo.h>
Classes | |
struct | BaseInfo |
Public Member Functions | |
AreaInfo (State *state) | |
AreaInfo (AreaInfo const &)=delete | |
AreaInfo & | operator= (AreaInfo const &)=delete |
void | update () |
std::vector< Area > const & | areas () const |
Area & | getArea (int id) |
Area const & | getArea (int id) const |
Area & | getArea (Position p) |
Area const & | getArea (Position p) const |
Area & | getArea (Tile const &tile) |
Area const & | getArea (Tile const &tile) const |
Area * | tryGetArea (int id) |
Area const * | tryGetArea (int id) const |
Area * | tryGetArea (Position p) |
Area const * | tryGetArea (Position p) const |
int | numMyBases () const |
const BaseInfo * | myBase (int n) const |
Returns data for our n-th base. More... | |
std::vector< BaseInfo > const & | myBases () const |
Returns data for all our bases. More... | |
bool | foundMyStartLocation () const |
Returns true, if our start location is known. More... | |
Position | myStartLocation () const |
Returns our start location if it is known, otherwise returns kInvalidPosition. More... | |
int | myClosestBaseIdx (Position const &p) const |
Returns the closest base according to Euclidean distance. More... | |
std::vector< Unit * > | myBaseResources (int n) const |
int | numEnemyBases () const |
const BaseInfo * | enemyBase (int n) const |
Returns data for enemy's n-th base. More... | |
bool | foundEnemyStartLocation () const |
Returns true, if enemy start location is known. More... | |
Position | enemyStartLocation () const |
Returns enemy start location if it is known, otherwise returns kInvalidPosition. More... | |
std::vector< Position > const & | candidateEnemyStartLocations () const |
std::vector< Position > | walkPath (Position a, Position b, float *length=nullptr) const |
Returns a path of choke points to walk from a to b. More... | |
std::vector< Area const * > | walkPathAreas (Position a, Position b, float *length=nullptr) const |
Returns a path of areas to walk from a to b. More... | |
float | walkPathLength (Position a, Position b) const |
Returns the distance in walktiles for a walking path a to b. More... | |
Access point for area and base information.
Beside providing access to area information, this class also provides a few convenience wrappers for functionality in BWEM::Map.
cherrypi::AreaInfo::AreaInfo | ( | State * | state | ) |
|
delete |
std::vector< Area > const & cherrypi::AreaInfo::areas | ( | ) | const |
std::vector< Position > const & cherrypi::AreaInfo::candidateEnemyStartLocations | ( | ) | const |
const AreaInfo::BaseInfo * cherrypi::AreaInfo::enemyBase | ( | int | n | ) | const |
Returns data for enemy's n-th base.
Position cherrypi::AreaInfo::enemyStartLocation | ( | ) | const |
Returns enemy start location if it is known, otherwise returns kInvalidPosition.
bool cherrypi::AreaInfo::foundEnemyStartLocation | ( | ) | const |
Returns true, if enemy start location is known.
bool cherrypi::AreaInfo::foundMyStartLocation | ( | ) | const |
Returns true, if our start location is known.
Area & cherrypi::AreaInfo::getArea | ( | int | id | ) |
Area const & cherrypi::AreaInfo::getArea | ( | int | id | ) | const |
const AreaInfo::BaseInfo * cherrypi::AreaInfo::myBase | ( | int | n | ) | const |
Returns data for our n-th base.
std::vector< Unit * > cherrypi::AreaInfo::myBaseResources | ( | int | n | ) | const |
std::vector< AreaInfo::BaseInfo > const & cherrypi::AreaInfo::myBases | ( | ) | const |
Returns data for all our bases.
int cherrypi::AreaInfo::myClosestBaseIdx | ( | Position const & | p | ) | const |
Returns the closest base according to Euclidean distance.
Position cherrypi::AreaInfo::myStartLocation | ( | ) | const |
Returns our start location if it is known, otherwise returns kInvalidPosition.
int cherrypi::AreaInfo::numEnemyBases | ( | ) | const |
int cherrypi::AreaInfo::numMyBases | ( | ) | const |
Area * cherrypi::AreaInfo::tryGetArea | ( | int | id | ) |
Area const * cherrypi::AreaInfo::tryGetArea | ( | int | id | ) | const |
void cherrypi::AreaInfo::update | ( | ) |
std::vector< Position > cherrypi::AreaInfo::walkPath | ( | Position | a, |
Position | b, | ||
float * | length = nullptr |
||
) | const |
Returns a path of choke points to walk from a to b.
If a or b are not accessible or a is not accessible from b, returns an empty path and sets length to infinity.
std::vector< Area const * > cherrypi::AreaInfo::walkPathAreas | ( | Position | a, |
Position | b, | ||
float * | length = nullptr |
||
) | const |
Returns a path of areas to walk from a to b.
If a or b are not accessible or a is not accessible from b, returns an empty path and sets length to infinity.
Returns the distance in walktiles for a walking path a to b.