TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
|
Classes | |
class | ConstantGetter |
class | FuncPositionFilter |
Input: More... | |
class | MultiPositionFilter |
This filter uses the score of the base filter, only of all subfilters return that the position is valid. More... | |
class | PositionFilter |
Assigns positions a score and validity, based on some criteria. More... | |
class | UnionPositionFilter |
class to combine filters More... | |
Typedefs | |
typedef std::shared_ptr< PositionFilter > | PPositionFilter |
typedef std::vector< PPositionFilter > | PositionFilters |
Enumerations | |
enum | PositionFilterPolicy { PositionFilterPolicy::ACCEPT_IF_ALL = 1, PositionFilterPolicy::ACCEPT_IF_ANY } |
Functions | |
PPositionFilter | makePositionFilter (PPositionFilter base, PositionFilters l, bool blocking) |
PPositionFilter | makePositionFilter (PositionFilters l, PositionFilterPolicy policy, bool blocking) |
bool | insideSpecificUnit (Position const &pos, Unit *bldg, int margin) |
bool | unitTouch (Unit *unit, Unit *v, int dirX, int dirY) |
bool | insideSpecificUnit (Unit *unit, Position const &pos, Unit *bldg) |
bool | insideAnyUnit (Unit *unit, Position const &pos, std::vector< Unit * > units) |
bool | positionAvoids (Unit *unit, Position const &pos, Unit *nmy) |
bool | dangerousAttack (Unit *unit, Unit *tgt) |
PPositionFilter | fleeAttackers () |
PPositionFilter | fleeThreatening () |
PPositionFilter | avoidAttackers () |
PPositionFilter | avoidThreatening () |
PPositionFilter | avoidEnemyUnitsInRange (float range) |
PPositionFilter | getCloserTo (std::vector< Position > coordinates) |
PPositionFilter | getCloserTo (Unit *bldg) |
PPositionFilter | getCloserTo (Position const &pos) |
bool | walkable (State *state, Position const &pos) |
bool | moveIsPossible (State *state, Position const &pos, std::vector< Unit * > const &obstacles, bool outOfBoundsInvalid) |
template<typename T > | |
Position | safeDirectionTo (State *state, Unit *unit, T tgt) |
template Position | safeDirectionTo< Unit * > (State *state, Unit *unit, Unit *tgt) |
template Position | safeDirectionTo< Position const & > (State *state, Unit *unit, Position const &tgt) |
template Position | safeDirectionTo< std::vector< Position > > (State *state, Unit *unit, std::vector< Position > tgt) |
Position | safeMoveTo (State *state, Unit *unit, Position const &pos) |
Position | pathMoveTo (State *state, Unit *unit, Position const &pos) |
Position | smartMove (State *state, Unit *unit, PositionFilters const &filters, int moveLength, int nbPossibleMoves, int stepSize, bool outOfBoundsInvalid) |
Position | smartMove (State *state, Unit *unit, PPositionFilter const &filter, int moveLength, int nbPossibleMoves, int stepSize, bool outOfBoundsInvalid) |
Position | smartMove_ (State *state, Unit *unit, PositionFilters filters) |
Position | smartMove (State *state, Unit *unit, Position tgt) |
template<typename T , typename UnaryFunctionReturnsContainerTType > | |
PPositionFilter | makePositionFilter (UnaryFunctionReturnsContainerTType getter, std::function< bool(Unit *, Position const &, T)> valid, std::function< float(Unit *, Position const &, T)> scoreFunc, PositionFilterPolicy policy=PositionFilterPolicy::ACCEPT_IF_ALL, bool blocking=false) |
std::vector< Unit * > & | threateningEnemiesGetter (Unit *u) |
std::vector< Unit * > & | beingAttackedByEnemiesGetter (Unit *u) |
std::vector< Unit * > & | unitsInSightRangeGetter (Unit *u) |
std::vector< Unit * > & | obstaclesInSightRangeGetter (Unit *u) |
std::vector< Unit * > & | enemyUnitsInSightRangeGetter (Unit *u) |
std::vector< Unit * > & | allyUnitsInSightRangeGetter (Unit *u) |
auto | negDistanceScore (Unit *unit, Position const &pos, Unit *nmy) |
auto | distanceScore (Unit *unit, Position const &pos, Unit *nmy) |
auto | zeroScore (Unit *unit, Position const &pos, Unit *nmy) |
std::vector< std::vector< std::pair< float, Position > > > | getValidMovePositions (State *state, Unit *unit, PositionFilters const &filters, int moveLength=kMoveLength, int nbPossibleMoves=kNumberPossibleMoves, int stepSize=kMoveLOSStepSize, bool outOfBoundsInvalid=true) |
Variables | |
int constexpr | kMoveLength = 16 |
int constexpr | kNumberPossibleMoves = 64 |
int constexpr | kMinMoveLength = 8 |
int constexpr | kMoveLOSStepSize = 4 |
int constexpr | kMinDistToTargetPos |
int constexpr | kTimeUpdateMove = 7 |
typedef std::vector<PPositionFilter> cherrypi::movefilters::PositionFilters |
typedef std::shared_ptr<PositionFilter> cherrypi::movefilters::PPositionFilter |
|
strong |
PPositionFilter cherrypi::movefilters::avoidAttackers | ( | ) |
PPositionFilter cherrypi::movefilters::avoidEnemyUnitsInRange | ( | float | range | ) |
PPositionFilter cherrypi::movefilters::avoidThreatening | ( | ) |
PPositionFilter cherrypi::movefilters::fleeAttackers | ( | ) |
PPositionFilter cherrypi::movefilters::fleeThreatening | ( | ) |
PPositionFilter cherrypi::movefilters::getCloserTo | ( | std::vector< Position > | coordinates | ) |
PPositionFilter cherrypi::movefilters::getCloserTo | ( | Unit * | bldg | ) |
PPositionFilter cherrypi::movefilters::getCloserTo | ( | Position const & | pos | ) |
std::vector<std::vector<std::pair<float, Position> > > cherrypi::movefilters::getValidMovePositions | ( | State * | state, |
Unit * | unit, | ||
PositionFilters const & | filters, | ||
int | moveLength = kMoveLength , |
||
int | nbPossibleMoves = kNumberPossibleMoves , |
||
int | stepSize = kMoveLOSStepSize , |
||
bool | outOfBoundsInvalid = true |
||
) |
bool cherrypi::movefilters::insideAnyUnit | ( | Unit * | unit, |
Position const & | pos, | ||
std::vector< Unit * > | units | ||
) |
PPositionFilter cherrypi::movefilters::makePositionFilter | ( | PPositionFilter | base, |
PositionFilters | l, | ||
bool | blocking | ||
) |
PPositionFilter cherrypi::movefilters::makePositionFilter | ( | PositionFilters | l, |
PositionFilterPolicy | policy, | ||
bool | blocking | ||
) |
PPositionFilter cherrypi::movefilters::makePositionFilter | ( | UnaryFunctionReturnsContainerTType | getter, |
std::function< bool(Unit *, Position const &, T)> | valid, | ||
std::function< float(Unit *, Position const &, T)> | scoreFunc, | ||
PositionFilterPolicy | policy = PositionFilterPolicy::ACCEPT_IF_ALL , |
||
bool | blocking = false |
||
) |
bool cherrypi::movefilters::moveIsPossible | ( | State * | state, |
Position const & | pos, | ||
std::vector< Unit * > const & | obstacles, | ||
bool | outOfBoundsInvalid | ||
) |
|
inline |
Position cherrypi::movefilters::safeDirectionTo | ( | State * | state, |
Unit * | unit, | ||
T | tgt | ||
) |
template Position cherrypi::movefilters::safeDirectionTo< Position const & > | ( | State * | state, |
Unit * | unit, | ||
Position const & | tgt | ||
) |
template Position cherrypi::movefilters::safeDirectionTo< std::vector< Position > > | ( | State * | state, |
Unit * | unit, | ||
std::vector< Position > | tgt | ||
) |
template Position cherrypi::movefilters::safeDirectionTo< Unit * > | ( | State * | state, |
Unit * | unit, | ||
Unit * | tgt | ||
) |
Position cherrypi::movefilters::smartMove | ( | State * | state, |
Unit * | unit, | ||
PositionFilters const & | filters, | ||
int | moveLength, | ||
int | nbPossibleMoves, | ||
int | stepSize, | ||
bool | outOfBoundsInvalid | ||
) |
Position cherrypi::movefilters::smartMove | ( | State * | state, |
Unit * | unit, | ||
PPositionFilter const & | filter, | ||
int | moveLength, | ||
int | nbPossibleMoves, | ||
int | stepSize, | ||
bool | outOfBoundsInvalid | ||
) |
Position cherrypi::movefilters::smartMove_ | ( | State * | state, |
Unit * | unit, | ||
PositionFilters | filters | ||
) |
int constexpr cherrypi::movefilters::kMinDistToTargetPos |
int constexpr cherrypi::movefilters::kMinMoveLength = 8 |
int constexpr cherrypi::movefilters::kMoveLength = 16 |
int constexpr cherrypi::movefilters::kMoveLOSStepSize = 4 |
int constexpr cherrypi::movefilters::kNumberPossibleMoves = 64 |
int constexpr cherrypi::movefilters::kTimeUpdateMove = 7 |