|
Player
Class header file: BWAPI/Player.h Each player in a match will have his or her own player instance. There is also a neutral player which owns all the neutral units.
MethodsgetIDint getID() const; Returns a unique ID for the player. getNamestd::string getName() const; Returns the name of the player. getUnitsconst std::set< Unit* >& getUnits() const; Returns the set of units the player own. Note that units loaded into Terran dropships, Terran bunkers, Terran refineries, Protoss assimilators, and Zerg extractors are not yet included in the set. getRaceRace getRace() const; Returns the race of the player. getTypePlayerType getType() const; Returns the type of the player. getForceForce* getForce() const; Returns the force the player is on. isAllybool isAlly(Player* player) const; Returns true if other player is an ally of this player. isEnemybool isEnemy(Player* player) const; Returns true if other player is an enemy of this player. isNeutralbool isNeutral() const; Returns true if the player is the neutral player. getStartLocationTilePosition getStartLocation() const; Returns the starting location of the player. If complete map information is disabled, this function will return TilePositions::Unknown for enemy players. For the complete set of starting locations for the current map, see Game::getStartLocations. isVictoriousbool isVictorious() const; Returns true if the player has achieved victory. isDefeatedbool isDefeated() const; Returns true if the player has been defeated. leftGamebool leftGame() const; Returns true if the player left the game. mineralsint minerals() const; Returns the amount of minerals the player currently has. Note that minerals() is equal to gatheredMinerals() + refundedMinerals() - repairedMinerals() - spentMinerals(). gasint gas() const; Returns the amount of vespene gas the player currently has. Note that gas() is equal to gatheredGas() + refundedGas() - repairedGas() - spentGas(). gatheredMineralsint gatheredMinerals() const; Returns the cumulative amount of minerals the player has mined up to this point (including the 50 minerals at the start of the game). gatheredGasint gatheredGas() const; Returns the cumulative amount of gas the player has harvested up to this point. repairedMineralsint repairedMinerals() const; Returns the cumulative amount of minerals the player has spent on repairs up to this point. repairedGasint repairedGas() const; Returns the cumulative amount of gas the player has spent on repairs up to this point. refundedMineralsint refundedMinerals() const; Returns the cumulative amount of minerals refunded from canceled units, canceled upgrades, and canceled research. refundedGasint refundedGas() const; Returns the cumulative amount of gas refunded from canceled units, canceled upgrades, and canceled research. spentMineralsint spentMinerals() const; Returns the cumulative amount of minerals spent, not including repairs. spentGasint spentGas() const; Returns the cumulative amount of gas spent, not including repairs. supplyTotalint supplyTotal() const; int supplyTotal(Race race) const; Returns the total amount of supply the player has. If a race is provided, the total supply for the given race will be returned, otherwise the player's initial race will be used. Supply counts returned by BWAPI are double what you would expect to see from playing the game. This is because zerglings take up 0.5 in-game supply. supplyUsedint supplyUsed() const; int supplyUsed(Race race) const; Returns how much of the supply is actually being used by units. If a race is provided, the used supply for the given race will be returned, otherwise the player's initial race will be used. Supply counts returned by BWAPI are double what you would expect to see from playing the game. This is because zerglings take up 0.5 in-game supply. allUnitCountint allUnitCount(UnitType type) const; Returns the current number of all accessible units of the given type owned by this player (both completed units and incomplete units). If the Complete Map Information flag is disabled, only visible units will be accessible so this function will return the same values as visibleUnitCount. visibleUnitCountint visibleUnitCount(UnitType type) const; Returns the current number of all visible units of the given type owned by this player (both completed units and incomplete units). If the Complete Map Information flag is disabled, then this function will return the same values as allUnitCount. completedUnitCountint completedUnitCount(UnitType type) const; Returns the current number of completed accessible units of the given type owned by this player. incompleteUnitCountint incompleteUnitCount(UnitType type) const; Returns the current number of incomplete accessible units of the given type owned by this player. deadUnitCountint deadUnitCount(UnitType unit) const; Returns the total number of friendly units of the given type that this player has lost. If the Complete Map Information flag is disabled, this will return 0 for enemy players. killedUnitCountint killedUnitCount(UnitType unit) const; Returns the total number of enemy units of the given type that this player has killed. If the Complete Map Information flag is disabled, this will return 0 for enemy players. isUnitAvailablebool isUnitAvailable(UnitType unit) const; Returns true if the player is allowed to build the given unit type. Some Use Map Settings maps can restrict the use of certain units. getUpgradeLevelint getUpgradeLevel(UpgradeType upgrade) const; Returns the player's current upgrade level of the given upgrade. To order a unit to upgrade a given upgrade type, see Unit::upgrade. isUpgradingbool isUpgrading(UpgradeType upgrade) const; Returns true if the player is upgrading the given upgrade. To order a unit to upgrade a given upgrade type, see Unit::upgrade. getMaxUpgradeLevelint getMaxUpgradeLevel(UpgradeType upgrade) const; Returns the maximum upgrades the player can perform using the specified upgrade. Some Use Map Settings maps can increase or decrease the number of upgrades the player can perform (up to 255). hasResearchedbool hasResearched(TechType tech) const; Returns true if the player has finished researching the given tech. To order a unit to research a given tech type, see Unit::research. isResearchingbool isResearching(TechType tech) const; Returns true if the player is researching the given tech. To order a unit to research a given tech type, see Unit::reseach. isResearchAvailablebool isResearchAvailable(TechType tech) const Returns true if the player is allowed to research the given tech. Some Use Map Settings maps can enforce restrictions on technologies. getColorColor getColor() const; Returns the color of the player, used for drawing to the screen. getTextColorint getTextColor() const; Returns a control character that represents the player's color. Used for printing text to the screen. maxEnergyint maxEnergy(UnitType unit) const; Returns the maximum amount of energy for the given unit type, taking into account the upgrades the player has. topSpeeddouble topSpeed(UnitType unit) const; Returns the top speed for the given unit type, taking into account the upgrades the player has. groundWeaponMaxRangeint groundWeaponMaxRange(UnitType unit) const; Returns the maximum range of the given unit type's ground weapon, taking into account the upgrades the player has. airWeaponMaxRangeint airWeaponMaxRange(UnitType unit) const; Returns the maximum range of the given unit type's air weapon, taking into account the upgrades the player has. weaponMaxRangeint weaponMaxRange(WeaponType weapon) const; Returns the maximum range of the given weapon type with the player's upgrades applied. sightRangeint sightRange(UnitType unit) const; Returns the sight range for the given unit type, taking into account the upgrades the player has. groundWeaponDamageCooldownint groundWeaponDamageCooldown(UnitType unit) const; Returns the attack cooldown of the given unit type's ground weapon, taking into account the upgrades the player has. armorint armor(UnitType unit) const; Returns the armor for the given unit type, taking into account the upgrades the player has. getUnitScoreint getUnitScore() const; Returns the total unit score that the player has accumulated. This excludes buildings. getKillScoreint getKillScore() const; Returns the total kill score that the player has accumulated. This excludes buildings. getBuildingScoreint getBuildingScore() const; Returns the total building score that the player has accumulated. getRazingScoreint getRazingScore() const; Returns the total razings score that the player has accumulated. In other words, the score for buildings destroyed. getCustomScoreint getCustomScore() const; Returns the custom score used in Use Map Settings. | |
For learning algorithms, the ability to get enemy score in onEnd would be really useful - unless we're missing something, this is only available when complete map information is true.