BWAPI
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
BayesianUnit Class Reference

#include <BayesianUnit.h>

Inheritance diagram for BayesianUnit:
Inheritance graph
[legend]
Collaboration diagram for BayesianUnit:
Collaboration graph
[legend]

List of all members.

Public Member Functions

bool isFighting ()
void move (BWAPI::Position p)
void switchMode (unit_mode um)
void setUnitsGroup (UnitsGroup *ug)
void dettachGroup ()
unit_mode getMode ()
int getMaxDimension ()
void newPath ()
void updatePPath ()
 BayesianUnit (BWAPI::Unit *u, const ProbTables *probTables)
 #define _PROB_GO_NOT_VISIBLE 0.4
virtual ~BayesianUnit ()
BWAPI::UnitType getType ()
void update ()
 Should be callable only from a UnitsGroup, maybe enforce it with a pattern (private+friend)
virtual void attack (const BWAPI::Position &p)
void attackEnemyUnit (BWAPI::Unit *u)
virtual void micro ()=0
virtual void check ()=0
virtual int getAttackDuration ()=0
virtual std::set< BWAPI::UnitType > getSetPrio ()=0

Static Public Member Functions

static pBayesianUnit newBayesianUnit (BWAPI::Unit *u)

Public Attributes

int _fleeingDmg
Vec dir
Vec obj

Protected Member Functions

void computeRepulseValues ()
void computeDamageValues ()
void straightLine (std::vector< BWAPI::Position > &ppath, const BWAPI::Position &p_start, const BWAPI::Position &p_end, bool quick=true)
void updateDirV ()
void testIfBlocked ()
void resumeFromBlocked ()
void updateRangeEnemies ()
void clearDamages ()
void updateTargetEnemy ()
void setTargetEnemy (BWAPI::Unit *u)
int computeDmg (BWAPI::Unit *u)
bool inRange (BWAPI::Unit *u)
bool outRanges (BWAPI::Unit *u)
bool outRanges (const std::set< Unit * > &units)
bool isOutrangingMe (BWAPI::Unit *u)
void drawDirV ()
void updateObj ()
void drawObj (int number=0)
void updateDir ()
void drawDir ()
void clickDir ()
void clickTarget ()
void aMoveTarget ()
void moveClick (BWAPI::Position p)
void flee ()
int fightMove ()
void drawArrow (Vec &v)
void updateAttractors ()
void drawAttractors ()
void drawRepulseValues ()
double computeProb (unsigned int i)
void computeProbs ()
void selectDir (const Vec &criterium)
virtual int addRangeGround ()
virtual int addRangeAir ()
virtual bool decideToFlee ()
void simpleFlee ()
bool dodgeStorm ()
bool dragScarab ()
bool dragMine ()
void drawProbs (std::multimap< double, Vec > &probs, int number=0)
void updateTargetingMe ()

Protected Attributes

std::vector< Vec_dirv
int _maxDimension
int _minDimension
int _lastAttackFrame
int _lastMoveFrame
int _lastClickFrame
int _lastRefreshPathRequest
double _maxDiag
int _maxWeaponsRange
BWAPI::Position _lastRightClick
BWAPI::Position _posAtMost13FramesAgo
BWAPI::Position _posAtMost23FramesAgo
bool _iThinkImBlocked
int _lastTotalHP
std::list< int > _HPLosts
int _sumLostHP
const int _refreshPathFramerate
int _maxDistWhileRefreshingPath
int _maxDistInOneClick
Position _inPos
bool _fleeing
bool _fightMoving
MapManagermapManager
std::vector< repulse_value_repulseValues
std::vector< damage_value_damageValues
const ProbTables_probTables
UnitsGroup_unitsGroup
std::multimap< double,
BWAPI::Unit * > 
_rangeEnemies
std::multimap< double, Vec_dirvProb
unit_mode _mode
std::set< Unit * > _targetingMe

Constructor & Destructor Documentation

BayesianUnit::BayesianUnit ( BWAPI::Unit *  u,
const ProbTables probTables 
)

#define _PROB_GO_NOT_VISIBLE 0.4

Here is the call graph for this function:


Member Function Documentation

int BayesianUnit::addRangeAir ( ) [protected, virtual]

Reimplemented in DragoonUnit.

Here is the caller graph for this function:

int BayesianUnit::addRangeGround ( ) [protected, virtual]

Reimplemented in DragoonUnit.

Here is the caller graph for this function:

void BayesianUnit::aMoveTarget ( ) [inline, protected]

Here is the caller graph for this function:

void BayesianUnit::attack ( const BWAPI::Position &  p) [virtual]

Reimplemented from BattleUnit.

void BayesianUnit::attackEnemyUnit ( BWAPI::Unit *  u)

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void BayesianUnit::check ( ) [pure virtual]
void BayesianUnit::clearDamages ( ) [protected]

Reimplemented in ZealotUnit.

Here is the call graph for this function:

Here is the caller graph for this function:

void BayesianUnit::clickDir ( ) [inline, protected]

Here is the call graph for this function:

Here is the caller graph for this function:

void BayesianUnit::clickTarget ( ) [inline, protected]

Here is the caller graph for this function:

void BayesianUnit::computeDamageValues ( ) [inline, protected]

Here is the caller graph for this function:

int BayesianUnit::computeDmg ( BWAPI::Unit *  u) [protected]

Here is the caller graph for this function:

double BayesianUnit::computeProb ( unsigned int  i) [inline, protected]

Attraction of the obj (== target in INPOS)

Repulsion of the other units incoming towards us

damage map influence

wanted target influence

Here is the call graph for this function:

Here is the caller graph for this function:

void BayesianUnit::computeProbs ( ) [inline, protected]

Here is the call graph for this function:

Here is the caller graph for this function:

void BayesianUnit::computeRepulseValues ( ) [inline, protected]

repulse on actual units positions (against splash damage)

repulse on interpolated units position (against collision)

Here is the call graph for this function:

Here is the caller graph for this function:

bool BayesianUnit::decideToFlee ( ) [protected, virtual]

Reimplemented in DragoonUnit, ZealotUnit, MarineUnit, MedicUnit, CorsairUnit, ScoutUnit, and ArchonUnit.

Here is the caller graph for this function:

bool BayesianUnit::dodgeStorm ( ) [protected]

Here is the call graph for this function:

Here is the caller graph for this function:

bool BayesianUnit::dragMine ( ) [protected]

Here is the call graph for this function:

Here is the caller graph for this function:

bool BayesianUnit::dragScarab ( ) [protected]

Here is the call graph for this function:

Here is the caller graph for this function:

void BayesianUnit::drawArrow ( Vec v) [protected]
void BayesianUnit::drawAttractors ( ) [protected]
void BayesianUnit::drawDir ( ) [protected]

Here is the call graph for this function:

Here is the caller graph for this function:

void BayesianUnit::drawDirV ( ) [protected]
void BayesianUnit::drawObj ( int  number = 0) [protected]
void BayesianUnit::drawProbs ( std::multimap< double, Vec > &  probs,
int  number = 0 
) [protected]

Here is the caller graph for this function:

void BayesianUnit::drawRepulseValues ( ) [protected]
int BayesianUnit::fightMove ( ) [protected]

approach siege tanks or approach our targetEnemy if not in range

Or simply move away from our friends and kite if we can

Reimplemented in ZealotUnit, and MedicUnit.

Here is the call graph for this function:

Here is the caller graph for this function:

void BayesianUnit::flee ( ) [protected]

Reimplemented in ZealotUnit.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual int BayesianUnit::getAttackDuration ( ) [pure virtual]

Here is the caller graph for this function:

virtual std::set<BWAPI::UnitType> BayesianUnit::getSetPrio ( ) [pure virtual]
UnitType BayesianUnit::getType ( )
bool BayesianUnit::inRange ( BWAPI::Unit *  u) [protected]

Reimplemented in ReaverUnit.

Here is the call graph for this function:

Here is the caller graph for this function:

bool BayesianUnit::isOutrangingMe ( BWAPI::Unit *  u) [protected]

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void BayesianUnit::micro ( ) [pure virtual]
void BayesianUnit::move ( BWAPI::Position  p)

Here is the caller graph for this function:

void BayesianUnit::moveClick ( BWAPI::Position  p) [inline, protected]

Here is the caller graph for this function:

pBayesianUnit BayesianUnit::newBayesianUnit ( BWAPI::Unit *  u) [static]

Here is the caller graph for this function:

Here is the caller graph for this function:

bool BayesianUnit::outRanges ( BWAPI::Unit *  u) [protected]

Here is the call graph for this function:

Here is the caller graph for this function:

bool BayesianUnit::outRanges ( const std::set< Unit * > &  units) [protected]

Here is the call graph for this function:

void BayesianUnit::resumeFromBlocked ( ) [inline, protected]

Here is the call graph for this function:

Here is the caller graph for this function:

void BayesianUnit::selectDir ( const Vec criterium) [inline, protected]

Here is the call graph for this function:

Here is the caller graph for this function:

void BayesianUnit::setTargetEnemy ( BWAPI::Unit *  u) [inline, protected]

<=> _unitsGroup->unitDamages.left[u] += computeDmg(u);

Here is the call graph for this function:

Here is the caller graph for this function:

void BayesianUnit::simpleFlee ( ) [protected]

Don't flee only a single enemy that we don't outrange

Here is the call graph for this function:

Here is the caller graph for this function:

void BayesianUnit::straightLine ( std::vector< BWAPI::Position > &  ppath,
const BWAPI::Position &  p_start,
const BWAPI::Position &  p_end,
bool  quick = true 
) [protected]

Here is the call graph for this function:

Here is the call graph for this function:

Here is the caller graph for this function:

void BayesianUnit::testIfBlocked ( ) [inline, protected]

Here is the caller graph for this function:

void BayesianUnit::update ( ) [virtual]

Should be callable only from a UnitsGroup, maybe enforce it with a pattern (private+friend)

check() for all inherited classes

Switch to fight if we're not fighting already nor scouting and there are enemies (and we can attack)

Implements BattleUnit.

Here is the call graph for this function:

void BayesianUnit::updateAttractors ( ) [inline, protected]

Here is the call graph for this function:

Here is the caller graph for this function:

void BayesianUnit::updateDir ( ) [protected]

Here is the call graph for this function:

Here is the caller graph for this function:

void BayesianUnit::updateDirV ( ) [inline, protected]

Here is the call graph for this function:

Here is the caller graph for this function:

void BayesianUnit::updateObj ( ) [protected]

fleeing gradient influence

target influence

Here is the call graph for this function:

Here is the caller graph for this function:

Do not pathfind for a small distance (1 build tile diagonal)

Request a path from the MapManager (without spamming it)

remove path points we passed

Here is the call graph for this function:

void BayesianUnit::updateRangeEnemies ( ) [protected]

Here is the caller graph for this function:

void BayesianUnit::updateTargetEnemy ( ) [protected]

take one in our priority set and in focus fire order

take one in our priority set

take the best in focus fire order, not especially out of range

Choose a priority target in the ones in range in focus fire order

Focus fire in range

Take a new one

In range or almost and in the priority set

In range and not in the priority set

Not in range and the first one, priority to the priority set

Anywhere and not particularly in the priority set OR not defense building

Take the default target of the UnitGroup

No target in rangeEnemies nor as a default target, follow the old one // should never happen

WTF??? // should never happen

Reimplemented in ZealotUnit.

Here is the call graph for this function:

Here is the caller graph for this function:

void BayesianUnit::updateTargetingMe ( ) [protected]

Here is the caller graph for this function:


Member Data Documentation

std::vector<damage_value> BayesianUnit::_damageValues [protected]
std::vector<Vec> BayesianUnit::_dirv [protected]
std::multimap<double, Vec> BayesianUnit::_dirvProb [protected]
bool BayesianUnit::_fightMoving [protected]
bool BayesianUnit::_fleeing [protected]
std::list<int> BayesianUnit::_HPLosts [protected]
Position BayesianUnit::_inPos [protected]
BWAPI::Position BayesianUnit::_lastRightClick [protected]
int BayesianUnit::_lastTotalHP [protected]
double BayesianUnit::_maxDiag [protected]
int BayesianUnit::_maxDimension [protected]
int BayesianUnit::_minDimension [protected]
BWAPI::Position BayesianUnit::_posAtMost13FramesAgo [protected]
BWAPI::Position BayesianUnit::_posAtMost23FramesAgo [protected]
std::multimap<double, BWAPI::Unit*> BayesianUnit::_rangeEnemies [protected]
const int BayesianUnit::_refreshPathFramerate [protected]
std::vector<repulse_value> BayesianUnit::_repulseValues [protected]
int BayesianUnit::_sumLostHP [protected]
std::set<Unit*> BayesianUnit::_targetingMe [protected]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines