TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
Classes | Typedefs | Enumerations | Functions | Variables
cherrypi::movefilters Namespace Reference

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< PositionFilterPPositionFilter
 
typedef std::vector< PPositionFilterPositionFilters
 

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 Documentation

Enumeration Type Documentation

Enumerator
ACCEPT_IF_ALL 
ACCEPT_IF_ANY 

Function Documentation

std::vector<Unit*>& cherrypi::movefilters::allyUnitsInSightRangeGetter ( Unit u)
inline
PPositionFilter cherrypi::movefilters::avoidAttackers ( )
PPositionFilter cherrypi::movefilters::avoidEnemyUnitsInRange ( float  range)
PPositionFilter cherrypi::movefilters::avoidThreatening ( )
std::vector<Unit*>& cherrypi::movefilters::beingAttackedByEnemiesGetter ( Unit u)
inline
bool cherrypi::movefilters::dangerousAttack ( Unit unit,
Unit tgt 
)
auto cherrypi::movefilters::distanceScore ( Unit unit,
Position const &  pos,
Unit nmy 
)
inline
std::vector<Unit*>& cherrypi::movefilters::enemyUnitsInSightRangeGetter ( Unit u)
inline
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 
)
bool cherrypi::movefilters::insideSpecificUnit ( Position const &  pos,
Unit bldg,
int  margin 
)
bool cherrypi::movefilters::insideSpecificUnit ( Unit unit,
Position const &  pos,
Unit bldg 
)
PPositionFilter cherrypi::movefilters::makePositionFilter ( PPositionFilter  base,
PositionFilters  l,
bool  blocking 
)
PPositionFilter cherrypi::movefilters::makePositionFilter ( PositionFilters  l,
PositionFilterPolicy  policy,
bool  blocking 
)
template<typename T , typename UnaryFunctionReturnsContainerTType >
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 
)
auto cherrypi::movefilters::negDistanceScore ( Unit unit,
Position const &  pos,
Unit nmy 
)
inline
std::vector<Unit*>& cherrypi::movefilters::obstaclesInSightRangeGetter ( Unit u)
inline
Position cherrypi::movefilters::pathMoveTo ( State state,
Unit unit,
Position const &  pos 
)
bool cherrypi::movefilters::positionAvoids ( Unit unit,
Position const &  pos,
Unit nmy 
)
template<typename T >
Position cherrypi::movefilters::safeDirectionTo ( State state,
Unit unit,
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::safeMoveTo ( State state,
Unit unit,
Position const &  pos 
)
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,
Position  tgt 
)
Position cherrypi::movefilters::smartMove_ ( State state,
Unit unit,
PositionFilters  filters 
)
std::vector<Unit*>& cherrypi::movefilters::threateningEnemiesGetter ( Unit u)
inline
std::vector<Unit*>& cherrypi::movefilters::unitsInSightRangeGetter ( Unit u)
inline
bool cherrypi::movefilters::unitTouch ( Unit unit,
Unit v,
int  dirX,
int  dirY 
)
bool cherrypi::movefilters::walkable ( State state,
Position const &  pos 
)
auto cherrypi::movefilters::zeroScore ( Unit unit,
Position const &  pos,
Unit nmy 
)
inline

Variable Documentation

int constexpr cherrypi::movefilters::kMinDistToTargetPos
Initial value:
=
8
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