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

Main namespace for bot-related code. More...

Namespaces

 autobuild
 
 bos
 
 builderhelpers
 
 buildorders
 
 buildtypes
 
 defogger
 
 detail
 
 featureimpl
 
 features
 
 model
 
 movefilters
 
 utils
 

Classes

class  ABBO10HatchLing
 
class  ABBO12HatchHydras
 
class  ABBO12PoolMuta
 
class  ABBO2BaseMutas
 
class  ABBO2HatchMuta
 
class  ABBO3BasePoolLings
 
class  ABBO5Pool
 
class  ABBO9PoolSpeedLingMuta
 
class  ABBOBase
 
class  ABBOdelayed4Pool
 Dummy build for verifying that opponents are functioning correctly. More...
 
class  ABBOhydracheese
 
class  ABBOhydras
 
class  ABBOmidmassling
 
class  ABBOpve2gate1012
 
class  ABBOpve4gate
 
class  ABBOpvp2gatedt
 
class  ABBOpvpgategateobs
 
class  ABBOpvzffe5gategoon
 
class  ABBOt5rax
 
class  ABBOtvpjoyorush
 
class  ABBOtvtz2portwraith
 
class  ABBOultras
 
class  ABBOzve9poolspeed
 
class  ABBOzvp10hatch
 
class  ABBOzvp3hatchhydra
 
class  ABBOzvp6hatchhydra
 
class  ABBOzvpmutas
 
class  ABBOzvpohydras
 
class  ABBOzvpomutas
 
class  ABBOzvpoverpoolbase
 
class  ABBOzvt2basedefiler
 
class  ABBOzvt2baseguardian
 
class  ABBOzvt2basehivebase
 
class  ABBOzvt2baseultra
 
class  ABBOzvt3hatchlurker
 
class  ABBOzvtantimech
 
class  ABBOzvtMacro
 
class  ABBOzvtp1hatchlurker
 
class  ABBOzvz12poolhydras
 
class  ABBOzvz9gas10pool
 
class  ABBOzvz9poolspeed
 
class  ABBOzvzoverpool
 
class  ABBOzvzoverpoolplus1
 
class  Agent
 An Agent represents the micromanagement state of one of our units. More...
 
struct  Area
 Represents an area on the map. More...
 
class  AreaInfo
 Access point for area and base information. More...
 
class  AssignedUnitsFilter
 Removes units from an UPC that are allocated to high-priority tasks. More...
 
class  AttackTracker
 Tracks a set of units attacking enemy units. More...
 
class  AutoBuildModule
 
class  AutoBuildTask
 AutoBuildTasks are "build orders" in the colloquial sense. More...
 
class  BaseJitter
 
class  BasePlayer
 The main bot object. More...
 
class  Behavior
 A Behavior is a self-contained situational micro rule. More...
 
class  BehaviorSeries
 
class  Blackboard
 An access-aware blackboard. More...
 
struct  BoardValueToString
 
class  BuilderController
 A unit production controller for all other units. More...
 
class  BuilderControllerBase
 Base class for controllers used by BuilderModule. More...
 
struct  BuilderControllerData
 Shared data among all builder controllers. More...
 
class  BuilderModule
 A general-purpose unit production module. More...
 
class  BuildingHarassTask
 
class  BuildingPlacerModule
 Determines positions for buildings. More...
 
struct  BuildingPlacerSample
 Describes a sample that can be used to learn the BuildingPlacerModel. More...
 
class  BuildTracker
 Tracks construction of a building or training of a unit. More...
 
struct  BuildType
 Represents and holds information about buildable types (units, upgrades, techs). More...
 
class  CherryVisDumperModule
 Records bot internal state and dumps it to a file readable by CherryVis. More...
 
class  CherryVisLogSink
 
class  CombatMicroModule
 Unit micro-management for combats. More...
 
class  CombatModule
 A combat module that controls squads of units. More...
 
class  CombatParameters
 
class  CombatSim
 Predicts the outcome of a hypothetical fight by simulating unit movements/attacks. More...
 
struct  CommandPost
 Game command are posted with an associated UPC ID. More...
 
class  Controller
 Base class for single-task controllers. More...
 
class  ControllerBase
 Base class for controllers. More...
 
class  ControllerTask
 Generic Task for Controller. More...
 
class  CreateGatherAttackModule
 Generates separate, unspecific UPCTuples for Create, Gather and Delete/Move. More...
 
class  DefaultAutoBuildTask
 A very simple build order which builds a fixed list of targets and then stops. More...
 
class  DefoggerFeaturizer
 Copypasted from defoggerFeaturizer on the defogger branch. More...
 
class  DummyTacticsModule
 A simple Tactics module that issues a globally-distributed Delete UPC. More...
 
struct  EnemyState
 
class  EnvironmentBuilder
 
struct  EnvVar
 
struct  FeatureData
 Represents a collection of spatial feature data. More...
 
struct  FeatureDescriptor
 Decribes a specific feature within FeatureData. More...
 
struct  FeaturePositionMapper
 Maps walktile positions to feature positions for a given bounding box. More...
 
class  FileDescriptor
 File descriptors passed as arguments to ForkServer::fork must be wrapped in this class. More...
 
struct  FixedScenario
 
struct  FixedScenarioGroup
 
struct  FixedScenarioPlayer
 
class  FogOfWar
 Calculates which tiles should be revealed by a unit's vision. More...
 
class  FogParameters
 
class  ForkServer
 This class lets us fork when using MPI. More...
 
class  GameMultiPlayer
 
struct  GameOptions
 
struct  GamePlayerOptions
 
class  GameSinglePlayer
 A constructed gameplay scenario for training/testing purposes. More...
 
class  GameVsBotInOpenBW
 Launches a game against a DLL bot using OpenBW. More...
 
class  GameVsBotInWine
 Launches a game series against a bot using StarCraft: Brood War(TM) via Wine. More...
 
struct  GathererAssignments
 Assigns workers to resources for optimal gathering. More...
 
class  GathererController
 Controls gathering workers for GathererModule. More...
 
class  GathererModule
 Manages worker units for resource gathering. More...
 
class  GenericAutoBuildModule
 Loads and uses a build order from the blackboard. More...
 
class  HarassModule
 Scouts the enemy's base with a worker. More...
 
class  HarassTask
 
class  Jitter
 When featurizing units, we represent each 2D cell as having one unit. More...
 
class  LambdaModule
 Lets you construct a lightweight module by providing your own step() as an std::function. More...
 
class  LayeredJitter
 This jitter class treats all units depending on their height: flying, on the ground or under ground (burrowed). More...
 
class  MacroParameters
 
class  MasterHarassTask
 
struct  MicroAction
 Represents a decision of how to control a unit. More...
 
struct  MicroModel
 
class  MicroPlayer
 The main bot object for training scenarios. More...
 
class  MicroScenarioProvider
 
class  MicroScenarioProviderFixed
 
class  MicroScenarioProviderRandom
 Generates Random armies. More...
 
class  MicroScenarioProviderSnapshot
 Provides scenarios constructed from Snapshots of real games. More...
 
class  Module
 Interface for bot modules. More...
 
class  MovementTracker
 Tracks movement of a set of units to a target location. More...
 
class  MultiProxyTask
 A task that tracks execution of multiple other tasks. More...
 
class  NoJitter
 
class  OnceModule
 A simple utility module that runs a user-supplied function once per game. More...
 
class  OpenBwProcess
 Launches and manages an OpenBW process. More...
 
struct  overloaded
 
class  Player
 The main bot object for complete games of StarCraft. More...
 
class  PlayScript
 
class  ProxyTask
 A task that tracks execution of another task (for another UPCTuple). More...
 
class  Rect2T
 
class  Replayer
 Play back a Brood War replay using OpenBW. More...
 
struct  ReplayerConfiguration
 
class  ResearchTracker
 Tracks research progress. More...
 
struct  ResourceWorkers
 Data structure for storing the state of our gathering assignments. More...
 
struct  Reward
 
struct  RewardCombat
 
struct  RewardDefilerProtectZerglings
 
struct  RewardDefilerWinLoss
 
struct  RewardKillSpeed
 
struct  RewardProtectCivilians
 
struct  RewardProximityTo
 
struct  RewardProximityToEnemy
 
class  SanityFilter
 Try to fix the malformed UPCs. More...
 
class  ScenarioProvider
 Base class for providing scenarios. More...
 
struct  ScenarioUpgradeLevel
 
class  ScoutingModule
 
class  SharedController
 Base class for Controllers shared between multiple tasks. More...
 
class  SharedControllerTask
 Generic Task for SharedController. More...
 
struct  Snapshot
 A low-resolution snapshot of a game state, intended for producing micro training scenarios. More...
 
struct  SnapshotPlayer
 A low-resolution snapshot of a player state, used as a component of Snapshots. More...
 
class  Snapshotter
 Records "snapshots" – low-fidelity recordings of game state which can be loaded as micro scenarios. More...
 
struct  SnapshotUnit
 A low-resolution snapshot of a unit state, used as a component of Snapshots. More...
 
struct  SpawnPosition
 
class  SquadCombatModule
 Module which controls ("micromanages") units into and out of combat. More...
 
class  SquadTask
 SquadTask controls a "squad" of units (units which share the same Delete or Flee UPC) More...
 
class  State
 Game state. More...
 
class  StaticDefenceFocusFireModule
 This module issues direct attack commands to static defence (sunken colonies, spore colonies, cannons and turrets) in order to focus fire and kill targets more efficiently. More...
 
class  StrategyModule
 
class  SubclassRegistry
 
class  TacticsAlwaysFightModule
 
struct  TacticsFightScores
 
struct  TacticsGroup
 
struct  TacticsMapNode
 
class  TacticsModule
 The Tactics module decides where on the map to allocate combat units. More...
 
struct  TacticsState
 
class  TacticsTask
 
class  Task
 The primary way for modules to publish their activity. More...
 
struct  TaskData
 Task and associated owner. More...
 
class  TCReplayer
 Play back a Brood War replay using OpenBW. More...
 
struct  Tile
 Represents a tile on the map. More...
 
class  TilesInfo
 Manages and updates per-tile data. More...
 
class  TopModule
 The first module run in each frame. More...
 
class  Tracker
 Abstract base class for Trackers. More...
 
struct  Unit
 Represents a unit in the game. More...
 
struct  UnitAttributeFeaturizer
 Abstract base class for featurizing unit attributes in a sparse manner. More...
 
struct  UnitCount
 
struct  UnitFlagsFeaturizer
 Sparse featurizer for unit flags. More...
 
struct  UnitPresenceFeaturizer
 Sparse featurizer for unit presence. More...
 
class  UnitsInfo
 Updates and organizes information about all the units in the game. More...
 
struct  UnitStatFeaturizer
 
struct  UnitTypeDefoggerFeaturizer
 Sparse featurizer for unit types, defogger-style. More...
 
struct  UnitTypeFeaturizer
 Sparse featurizer for numeric unit types. More...
 
struct  UnitTypeMDefoggerFeaturizer
 A variant of UnitTypeDefoggerFeaturizer that stores the target type of morphing units. More...
 
struct  UPCData
 UPCTuple and associated origin. More...
 
class  UPCFilter
 Base class for UPC filters. More...
 
struct  UpcPost
 Stores information about UPCs that have been posted to the board. More...
 
struct  UpcPostData
 Base class for data attached to the posting of an UPC. More...
 
class  UpcStorage
 Stores a graph of UPC communication, including any transactional data. More...
 
class  UPCToCommandModule
 The last module run in each frame. More...
 
struct  UPCTuple
 (Unit, Position, Command) tuple. More...
 
class  UpgradeTracker
 Tracks upgrade development. More...
 
class  Vec2T
 
class  WorkerBuilderController
 A unit production controller for units that require a worker. More...
 

Typedefs

typedef int PlayerId
 
typedef int FrameNum
 
typedef int UpcId
 
typedef Vec2T< float > Vec2
 
typedef Vec2T< int > Position
 
typedef Rect2T< int > Rect
 
using Duration = std::chrono::nanoseconds
 
using hires_clock = std::chrono::steady_clock
 
using AnyFeatureType = mapbox::util::variant< PlainFeatureType, CustomFeatureType >
 
using bt = torchcraft::BW::UnitType
 
typedef bos::StaticData BosStaticData
 
typedef bos::Sample BosSample
 
typedef std::pair< const BuildType *, std::vector< autobuild::BuildStateUnit > > BuildUnitPair
 
typedef std::pair< int, const BuildType * > ProductionPair
 
typedef std::vector< std::shared_ptr< Behavior > > BehaviorList
 Gives a series of Behaviors the option of issuing a UPC for the unit. More...
 
typedef int UpgradeLevel
 Type to represent upgrade level values. More...
 
typedef int32_t UnitId
 

Enumerations

enum  Command : uint64_t {
  None = 0, Create = 1 << 0, Move = 1 << 1, Delete = 1 << 2,
  Gather = 1 << 3, Scout = 1 << 4, Cancel = 1 << 5, Harass = 1 << 6,
  Flee = 1 << 7, SetCreatePriority = 1 << 8, ReturnCargo = 1 << 9, Cast = 1 << 10,
  MAX = 1 << 11
}
 Abstract "meta" commands for UPCTuples. More...
 
enum  PlainFeatureType {
  PlainFeatureType::Invalid = -1, PlainFeatureType::GroundHeight = 1, PlainFeatureType::Walkability, PlainFeatureType::Buildability,
  PlainFeatureType::FogOfWar, PlainFeatureType::Creep, PlainFeatureType::CandidateEnemyStartLocations, PlainFeatureType::ReservedAsUnbuildable,
  PlainFeatureType::TallDoodad, PlainFeatureType::OneHotGroundHeight, PlainFeatureType::StartLocations, PlainFeatureType::XYGrid,
  PlainFeatureType::Resources, PlainFeatureType::HasStructure, PlainFeatureType::UserFeature1 = 1001, PlainFeatureType::UserFeature2 = 1002
}
 Defines a family of "plain" features. More...
 
enum  CustomFeatureType {
  CustomFeatureType::UnitPresence = 10001, CustomFeatureType::UnitType, CustomFeatureType::UnitFlags, CustomFeatureType::UnitHP,
  CustomFeatureType::UnitShield, CustomFeatureType::UnitGroundCD, CustomFeatureType::UnitAirCD, CustomFeatureType::UnitStat,
  CustomFeatureType::UnitTypeDefogger, CustomFeatureType::UnitTypeMDefogger, CustomFeatureType::Other = 1 >> 30
}
 Defines custom features. More...
 
enum  SubsampleMethod { SubsampleMethod::Sum, SubsampleMethod::Average, SubsampleMethod::Max }
 Various methods for spatial subsampling. More...
 
enum  GameType { GameType::Melee, GameType::UseMapSettings }
 
enum  ScoutingGoal {
  ScoutingGoal::FindEnemyBase = 0, ScoutingGoal::ExploreEnemyBase, ScoutingGoal::FindEnemyExpand, ScoutingGoal::SneakyOverlord,
  ScoutingGoal::Automatic
}
 Scout management. More...
 
enum  TaskStatus {
  TaskStatus::Unknown = -1, TaskStatus::Ongoing, TaskStatus::Success, TaskStatus::Cancelled,
  TaskStatus::Failure
}
 Describes the current status of a task. More...
 
enum  ProxyPolicy { ProxyPolicy::ANY, ProxyPolicy::MOST, ProxyPolicy::ALL }
 Policies for tracking multiple tasks. More...
 
enum  TrackerStatus {
  TrackerStatus::NotTracking, TrackerStatus::Pending, TrackerStatus::Timeout, TrackerStatus::Ongoing,
  TrackerStatus::Success, TrackerStatus::Failure, TrackerStatus::Cancelled
}
 

Functions

int constexpr numUpcCommands ()
 Does not count the "None" command. More...
 
void setupPlayerFromCli (Player *player)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBO10HatchLing, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBO12HatchHydras, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBO12PoolMuta, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBO2BaseMutas, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBO2HatchMuta, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBO3BasePoolLings, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBO5Pool, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBO9PoolSpeedLingMuta, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOdelayed4Pool, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOhydracheese, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOhydras, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOmidmassling, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOpve2gate1012, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOpve4gate, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOpvp2gatedt, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOpvpgategateobs, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOpvzffe5gategoon, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOt5rax, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOtvpjoyorush, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOtvtz2portwraith, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOultras, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOzve9poolspeed, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOzvp10hatch, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOzvp3hatchhydra, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOzvp6hatchhydra, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOzvpmutas, UpcId, State *, Module *)
 
 DEFINE_double (zvpoverpool_distance_fear, 0.6,"How heavily to weigh enemy army units that are far from our base. ""Reasonably ranges on [0.0, 1.0]")
 
 DEFINE_double (zvpoverpool_distance_fear_limit, 6.0,"Maximum amount by which to diminish enemy army size due to distance")
 
 DEFINE_double (zvpoverpool_army_slope, 1.1,"How many times larger to make our army with respect to the enemy army's ""threat level.")
 
 DEFINE_double (zvpoverpool_army_offset, 1.0,"How many zealots-worth larger to make our ground army with respect to the ""enemy army's threat level.")
 
 DEFINE_double (zvpoverpool_hidden_threat_multiplier, 0.9,"Multiplier of hidden enemy army strength to consider.")
 
 DEFINE_double (zvpoverpool_hidden_threat_cap, 20.0,"Maximum amount of hidden enemy army strength to infer.")
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOzvpohydras, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOzvpomutas, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOzvt2basedefiler, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOzvt2baseultra, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOzvt2baseguardian, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOzvt3hatchlurker, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOzvtantimech, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOzvtMacro, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOzvtp1hatchlurker, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOzvz12poolhydras, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOzvz9gas10pool, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOzvz9poolspeed, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOzvzoverpool, UpcId, State *, Module *)
 
 REGISTER_SUBCLASS_3 (ABBOBase, ABBOzvzoverpoolplus1, UpcId, State *, Module *)
 
const BuildTypegetBuildType (BWAPI::UnitType type)
 
const BuildTypegetUnitBuildType (int unit)
 
const BuildTypegetBuildType (BWAPI::TechType type)
 
const BuildTypegetTechBuildType (int tech)
 
const BuildTypegetBuildType (BWAPI::UpgradeType type, int level)
 
const BuildTypegetUpgradeBuildType (int upgrade, int level)
 
void init (int64_t randomSeed)
 
void init ()
 
void installSignalHandlers ()
 
void initLogging (const char *execName, std::string logSinkDir, bool logSinkToStderr)
 
void shutdown (bool logSinkToStderr)
 
void setLoggingFrame (int frame)
 Set a frame number to prefix log messages with. More...
 
void unsetLoggingFrame ()
 Reset the frame number for log messages. More...
 
FeatureData featurizePlain (State *state, std::vector< PlainFeatureType > types, Rect boundingBox=Rect())
 Extracts plain features from the current state. More...
 
FeatureData combineFeatures (std::vector< FeatureData > const &feats)
 Combines multiple features along channels. More...
 
FeatureData selectFeatures (FeatureData const &feat, std::vector< AnyFeatureType > types)
 Selects a subset of features. More...
 
FeatureData subsampleFeature (FeatureData const &feat, SubsampleMethod method, int factor, int stride=-1)
 Applies a spatial subsampling method to a feature. More...
 
 GEN_SPARSE_UNIT_ATTRIBUTE_FEATURIZER (HP, health)
 
 GEN_SPARSE_UNIT_ATTRIBUTE_FEATURIZER (Shield, shield)
 
 GEN_SPARSE_UNIT_ATTRIBUTE_FEATURIZER (GroundCD, groundCD)
 
 GEN_SPARSE_UNIT_ATTRIBUTE_FEATURIZER (AirCD, airCD)
 
void incr (ssize_t)
 
void incr (ssize_t n, off_t &offset)
 
template<class F , class... Offset>
ssize_t wrapFull (F f, int fd, void *buf, size_t count, Offset...offset)
 
ssize_t readFull (int fd, void *buf, size_t count)
 
ssize_t writeFull (int fd, const void *buf, size_t count)
 
std::string readData (int fd)
 
void sendData (int fd, std::string const &data)
 
void sendfd (int socket, int fd)
 
int recvfd (int socket)
 
void checkedPipe (int *p)
 
int popen2 (std::vector< std::string > const &command, std::vector< EnvVar > const &env, int *infp, int *outfp, int *outfpw)
 
int rangeOn (int minInclusive, int maxInclusive)
 
FixedScenarioasymmetric (FixedScenario &scenario, const std::vector< UnitCount > &unitsAlly, const std::vector< UnitCount > &unitsEnemy, float unitSpread=5, int teamSeparationFloor=40, int teamSeparationSpread=0, int centerSpread=0, bool teamRotate=false)
 
FixedScenariosymmetric (FixedScenario &scenario, const std::vector< UnitCount > &units)
 
FixedScenarioGroup baselineScenarios ()
 Scenarios that have been used in previous papers. More...
 
FixedScenarioGroup simpleScenarios ()
 Some easier scenarios. More...
 
FixedScenarioGroup symmetricSingleUnitScenarios ()
 Scenarios involving a symmetric fight between units of a single type. More...
 
FixedScenarioGroup symmetricAirGroundScenarios ()
 Scenarios involving a symmetric fight between mixed air/ground units. More...
 
FixedScenarioGroup symmetricBigScenarios ()
 Scenarios involving a symmetric fight between large numbers of units. More...
 
FixedScenarioGroup regroupingScenarios ()
 Scenarios requiring regrouping before fighting. More...
 
FixedScenarioGroup kitingScenarios ()
 Scenarios requiring alternating attack/move actions. More...
 
FixedScenarioGroup miscellaneousScenarios ()
 All other scenarios. More...
 
FixedScenarioGroup defilerScenarios ()
 
FixedScenarioGroup defilerTankScenarios ()
 
std::vector< FixedScenarioGroupallScenarioGroups ()
 
std::vector< FixedScenarioallScenarios ()
 
FixedScenario getScenario (const std::string &scenarioName)
 
GameSinglePlayer GameSinglePlayerUMS (std::string const &map, std::string const &race, bool forceGui=false)
 
GameSinglePlayer GameSinglePlayerMelee (std::string map, std::string myRace, std::string enemyRace=std::string(), bool forceGui=false)
 
char const * gameTypeName (GameType type)
 
std::tuple< float, float, float, float > getUnitCountsHealth (State *state)
 
std::unique_ptr< RewardcombatReward ()
 
std::unique_ptr< RewardkillSpeedReward ()
 
std::unique_ptr< RewardproximityToEnemyReward ()
 
std::unique_ptr< RewardproximityToReward (int y, int x)
 
std::unique_ptr< RewardprotectCiviliansReward ()
 
std::unique_ptr< RewarddefilerProtectZerglingsReward ()
 
std::unique_ptr< RewarddefilerWinLossReward ()
 
template<typename procT >
std::shared_ptr< torchcraft::ClientmakeTorchCraftClient (procT &&proc, torchcraft::Client::Options opts, int timeout)
 
 AUTOGRAD_CONTAINER_CLASS (BuildingPlacerModel)
 A CNN model for determining building positions. More...
 
 REGISTER_SUBCLASS_0 (Module, AutoBuildModule)
 
std::string mineralsToString (State *state)
 
std::string gasToString (State *state)
 
std::string supplyToString (State *state)
 
std::string larvaToString (State *state)
 
void logColumns (const std::vector< std::string > &strings, int logLevel, int width)
 
 REGISTER_SUBCLASS_0 (Module, BuilderModule)
 
 REGISTER_SUBCLASS_0 (Module, BuildingPlacerModule)
 
 REGISTER_SUBCLASS_0 (Module, CherryVisDumperModule)
 
void to_json (nlohmann::json &json, CherryVisDumperModule::Logger const &logger)
 
template<class... Ts>
 overloaded (Ts...) -> overloaded< Ts... >
 
void to_json (nlohmann::json &json, CherryVisDumperModule::Dumpable const &key)
 
void to_json (nlohmann::json &json, Unit const *unit)
 
void to_json (nlohmann::json &json, Position const &p)
 
 REGISTER_SUBCLASS_0 (Module, CombatModule)
 
 REGISTER_SUBCLASS_0 (Module, CombatMicroModule)
 
double EHPScoreHeuristic (Unit const *me, Unit const *o)
 
double HPScoreHeuristic (Unit const *me, Unit const *o)
 
double UnityScoreHeuristic (Unit const *me, Unit const *o)
 
 REGISTER_SUBCLASS_0 (Module, CreateGatherAttackModule)
 
bool isValidResource (Unit *u)
 Should we be allowed to gather from this resource? More...
 
auto order (Unit *worker)
 
void vlog (int level, Unit *worker, Unit *resource, std::string &&logTemplate)
 
auto comparableProxy (Unit *unit)
 
 REGISTER_SUBCLASS_0 (Module, GathererModule)
 
 REGISTER_SUBCLASS_0 (Module, GenericAutoBuildModule)
 
 REGISTER_SUBCLASS_0 (Module, HarassModule)
 
int getSpawnCoordinate (State *state, int base, int max, float noiseMax)
 
 REGISTER_SUBCLASS_0 (Module, ScoutingModule)
 
 DEFINE_bool (behavior_chase, false,"Toggles chasing behaviors")
 
 DEFINE_bool (behavior_kite, false,"Toggles kiting behaviors")
 
 REGISTER_SUBCLASS_0 (Module, SquadCombatModule)
 
 REGISTER_SUBCLASS_0 (Module, StaticDefenceFocusFireModule)
 
 REGISTER_SUBCLASS_0 (Module, StrategyModule)
 
 DEFINE_FLAG_OPERATORS (StrategyModule::Duty)
 
 REGISTER_SUBCLASS_0 (Module, TacticsModule)
 
 REGISTER_SUBCLASS_0 (Module, TopModule)
 
 REGISTER_SUBCLASS_0 (Module, UPCToCommandModule)
 
FixedScenario snapshotToScenario (const Snapshot &snapshot)
 
Snapshot stateToSnapshot (torchcraft::State *state)
 
void saveSnapshot (const Snapshot &snapshot, const std::string &path)
 
Snapshot loadSnapshot (const std::string &path)
 

Variables

UpcId constexpr kRootUpcId = 0
 
UpcId constexpr kInvalidUpcId = -1
 
UpcId constexpr kFilteredUpcId = -2
 
double constexpr kDegPerRad = 180 / M_PI
 
float constexpr kfInfty = std::numeric_limits<float>::infinity()
 
float constexpr kfLowest = std::numeric_limits<float>::lowest()
 
float constexpr kfMax = std::numeric_limits<float>::max()
 
float constexpr kfEpsilon = std::numeric_limits<float>::epsilon()
 
double constexpr kdInfty = std::numeric_limits<double>::infinity()
 
double constexpr kdLowest = std::numeric_limits<double>::lowest()
 
double constexpr kdMax = std::numeric_limits<double>::max()
 
double constexpr kdEpsilon = std::numeric_limits<double>::epsilon()
 
int constexpr kForever = 24 * 60 * 60 * 24 * 7
 
constexpr int kLarvaFrames = 342
 
constexpr Position kInvalidPosition {-1, -1}
 
constexpr int mapMidpointX = 128
 
constexpr int mapMidpointY = 128
 
const double kMapDiagonal
 
auto eachFrameRechargeMyEnergy
 
constexpr double kDistanceMining = 4 * 12
 How far a resource can be from our base before it's considered long-distance mining. More...
 
constexpr double kInvalid = std::numeric_limits<double>::infinity()
 
constexpr int kChaseHpThreshold = 20
 
constexpr double kChaseDelProbThreshold = 1.0
 
constexpr double kChaseOvershoot = 4.0
 
constexpr double kChaseLookahead = 4.0
 
constexpr int kKiteHpThreshold = 20
 
constexpr double kKiteDelProbThreshold = 0.85
 
constexpr double kKiteRatioDefault = 0.25
 
constexpr double kKiteRatioPunish = 1.0
 
constexpr double kKiteRatioFallback = 0.5
 
constexpr double kKiteRatioBreathe = 0.5
 
constexpr int kKiteFrameMargin = 3
 
constexpr int kKiteRangeMargin = 4
 
constexpr int kLurkerBurrowFrames = 24
 
constexpr int kLurkerUnburrowFrames = 12
 
char constexpr kAutoTopModule [] = "Top"
 
char constexpr kAutoBottomModule [] = "UPCToCommand"
 
char constexpr kDefaultModules []
 The default set of modules. More...
 

Detailed Description

Main namespace for bot-related code.

Copyright (c) 2017-present, Facebook, Inc.

This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.

Typedef Documentation

using cherrypi::AnyFeatureType = typedef mapbox::util::variant<PlainFeatureType, CustomFeatureType>
typedef std::vector<std::shared_ptr<Behavior> > cherrypi::BehaviorList

Gives a series of Behaviors the option of issuing a UPC for the unit.

Continues until a Behavior either:

  • Issues a UPC, indicating a command for the unit
  • Issues a null UPC, indicating that the unit should be left alone
using cherrypi::bt = typedef torchcraft::BW::UnitType
typedef std::pair<const BuildType*, std::vector<autobuild::BuildStateUnit> > cherrypi::BuildUnitPair
using cherrypi::Duration = typedef std::chrono::nanoseconds
typedef int cherrypi::FrameNum
using cherrypi::hires_clock = typedef std::chrono::steady_clock
typedef int cherrypi::PlayerId
typedef Vec2T<int> cherrypi::Position
typedef std::pair<int, const BuildType*> cherrypi::ProductionPair
typedef Rect2T<int> cherrypi::Rect
typedef int32_t cherrypi::UnitId
typedef int cherrypi::UpcId

Type to represent upgrade level values.

typedef Vec2T<float> cherrypi::Vec2

Enumeration Type Documentation

enum cherrypi::Command : uint64_t

Abstract "meta" commands for UPCTuples.

Enumerator
None 
Create 
Move 
Delete 
Gather 
Scout 
Cancel 
Harass 
Flee 
SetCreatePriority 
ReturnCargo 
Cast 
MAX 

Defines custom features.

These features are extracted using various custom feature extractors. They're defined explicitly so that they can be referred to easily in feature descriptors.

Use this enum as a central "registry" for your feature type.

Enumerator
UnitPresence 
UnitType 
UnitFlags 
UnitHP 
UnitShield 
UnitGroundCD 
UnitAirCD 
UnitStat 
UnitTypeDefogger 
UnitTypeMDefogger 
Other 
enum cherrypi::GameType
strong
Enumerator
Melee 
UseMapSettings 

Defines a family of "plain" features.

These features can directly be extracted from the bot State into a spatial FeatureData instance. Use featurizePlain() to extract these features.

Enumerator
Invalid 
GroundHeight 

Ground height: 0 (low), 1 (high) or 2 (very high); -1 outside of map.

Walkability 

Whether units can walk here or not: 0 or 1; -1 outside of map.

Buildability 

Whether buildings can be placed here or not: 0 or 1; -1 outside of map.

FogOfWar 

Whether this position is under the fog of war: 0 or 1; -1 outside of map.

Creep 

Whether there is creep here: 0 or 1; -1 outside of map.

CandidateEnemyStartLocations 

Whether the enemy starts from this position: 0 or 1, -1 outside of map.

ReservedAsUnbuildable 

Whether the corresponding buildtile is reserved.

TallDoodad 

Whether this walktile contains a doodad that alters the ground height and thus affects visibility and attack miss rates.

OneHotGroundHeight 

One-hot ground height: channel for height 0, 2, 4 and on the map (4 total)

StartLocations 

Whether this position is a starting location.

XYGrid 

Grid of X/Y coordinates from (0,0) top left to (N,M) bottom right.

One channel for Y, one channel for X. -1 outside of map. N is map_width/512, M map_height/512 (all in walktiles).

Resources 

1 if there is a resource tile at this location, 0 otherwise

HasStructure 

This map tile has a structure on it, so it's not passable.

Since this works at the walktile level and structures are on pixels, it will mark a walktile as impassable as long as the walktile is at all partially impassable.

UserFeature1 

User-defined single-channel feature.

UserFeature2 

User-defined two channel feature.

enum cherrypi::ProxyPolicy
strong

Policies for tracking multiple tasks.

Enumerator
ANY 

One task has a given status.

MOST 

Most tasks (i.e. more than half) have a given status.

ALL 

All tasks have a given status.

Scout management.

Enumerator
FindEnemyBase 
ExploreEnemyBase 
FindEnemyExpand 
SneakyOverlord 
Automatic 

Various methods for spatial subsampling.

Enumerator
Sum 
Average 
Max 
enum cherrypi::TaskStatus
strong

Describes the current status of a task.

Enumerator
Unknown 
Ongoing 

Task is currently ongoing.

Success 

Task finished successfully.

Cancelled 

Task Canceled.

Failure 

Task failed or was aborted.

Enumerator
NotTracking 

Haven't found the target that should be tracker yet.

Pending 

Corresponding order picked up but not being actually executed yet (e.g.

worker moving to building location)

Timeout 

NotTracking or Pending for too long.

Ongoing 

Corresponding target is being executed.

Success 

Corresponding target finished succesfully.

Failure 

Corresponding target aborted and no chance of automatic recovery.

Cancelled 

Tracker was cancelled externally.

Function Documentation

std::vector<FixedScenarioGroup> cherrypi::allScenarioGroups ( )
std::vector< FixedScenario > cherrypi::allScenarios ( )
FixedScenario& cherrypi::asymmetric ( FixedScenario scenario,
const std::vector< UnitCount > &  unitsAlly,
const std::vector< UnitCount > &  unitsEnemy,
float  unitSpread = 5,
int  teamSeparationFloor = 40,
int  teamSeparationSpread = 0,
int  centerSpread = 0,
bool  teamRotate = false 
)
cherrypi::AUTOGRAD_CONTAINER_CLASS ( BuildingPlacerModel  )

A CNN model for determining building positions.

This is a relatively simple feature pyramid model. The input is 128x128 (build tile resolution); after two conv layers + max pooling we are at 32x32. Then, use a series of conv layers at that scale (4 by default). Afterwards, convolutions and upsampling to go back to 128x128. There are skip connections from the first two conv layers to the deconv layers.

The following properties will alter the model output:

  • masked: Softmax masking to eliminiate zero-probability positions from input UPC. If this is set to false, forward() will return return an all-ones mask.
  • flatten: Output flat tensors instead of 2-dimensional ones
  • logprobs: Output log-probabilities instead of probabilities

The following properties will alter the model structure:

  • num_top_channels: The number of channels in the top-level (lowest-resolution) convolutions.
  • num_top_convs: The number of convolutional layers at the top level.

Build network input from a batch of samples.

Build network input and target from a batch of samples.

The first element of the resulting pair is the network input, the second element are the targets for this batch.

Network forward.

Expected input, with batch dimension as first dimension:

  • maps: map features
  • units_pos: 2D coordinates for entries in units_data:w -units_data: unit type IDs -type: requested building type -valid_mask`: mask set to 1 at valid build locations, 0 otherwise Use makeBatch() to generate inputs from one or more samples.

Output (batched):

  • output: probability distribution over the whole map
  • mask: effective mask that was applied to the output
FixedScenarioGroup cherrypi::baselineScenarios ( )

Scenarios that have been used in previous papers.

Scenarios from previous works: EE: 5m,5m 15m,16m 2d+3z,2d+3z w15,w17 COMA: 3m,3m 5m,5m 5w,5w 2d+3z,2d+3z

void cherrypi::checkedPipe ( int *  p)
std::unique_ptr< Reward > cherrypi::combatReward ( )
FeatureData cherrypi::combineFeatures ( std::vector< FeatureData > const &  feats)

Combines multiple features along channels.

Ensures they have the same scale and performs zero-padding according to feature offsets.

auto cherrypi::comparableProxy ( Unit unit)
std::unique_ptr< Reward > cherrypi::defilerProtectZerglingsReward ( )
FixedScenarioGroup cherrypi::defilerScenarios ( )
FixedScenarioGroup cherrypi::defilerTankScenarios ( )
std::unique_ptr< Reward > cherrypi::defilerWinLossReward ( )
cherrypi::DEFINE_bool ( behavior_chase  ,
false  ,
"Toggles chasing behaviors"   
)
cherrypi::DEFINE_bool ( behavior_kite  ,
false  ,
"Toggles kiting behaviors"   
)
cherrypi::DEFINE_double ( zvpoverpool_distance_fear  ,
0.  6,
"How heavily to weigh enemy army units that are far from our base. ""Reasonably ranges on "  [0.0, 1.0] 
)
cherrypi::DEFINE_double ( zvpoverpool_distance_fear_limit  ,
6.  0,
"Maximum amount by which to diminish enemy army size due to distance"   
)
cherrypi::DEFINE_double ( zvpoverpool_army_slope  ,
1.  1,
"How many times larger to make our army with respect to the enemy army's ""threat level."   
)
cherrypi::DEFINE_double ( zvpoverpool_army_offset  ,
1.  0,
"How many zealots-worth larger to make our ground army with respect to the ""enemy army's threat level."   
)
cherrypi::DEFINE_double ( zvpoverpool_hidden_threat_multiplier  ,
0.  9,
"Multiplier of hidden enemy army strength to consider."   
)
cherrypi::DEFINE_double ( zvpoverpool_hidden_threat_cap  ,
20.  0,
"Maximum amount of hidden enemy army strength to infer."   
)
cherrypi::DEFINE_FLAG_OPERATORS ( StrategyModule::Duty  )
double cherrypi::EHPScoreHeuristic ( Unit const *  me,
Unit const *  o 
)
inline
FeatureData cherrypi::featurizePlain ( State state,
std::vector< PlainFeatureType types,
Rect  boundingBox = Rect() 
)

Extracts plain features from the current state.

boundingBox defaults to all available data, but can also be larger to have constant-size features irrespective of actual map size, for example.

GameSinglePlayer cherrypi::GameSinglePlayerMelee ( std::string  map,
std::string  myRace,
std::string  enemyRace = std::string(),
bool  forceGui = false 
)
GameSinglePlayer cherrypi::GameSinglePlayerUMS ( std::string const &  map,
std::string const &  race,
bool  forceGui = false 
)
char const* cherrypi::gameTypeName ( GameType  type)
inline
std::string cherrypi::gasToString ( State state)
cherrypi::GEN_SPARSE_UNIT_ATTRIBUTE_FEATURIZER ( HP  ,
health   
)
cherrypi::GEN_SPARSE_UNIT_ATTRIBUTE_FEATURIZER ( Shield  ,
shield   
)
cherrypi::GEN_SPARSE_UNIT_ATTRIBUTE_FEATURIZER ( GroundCD  ,
groundCD   
)
cherrypi::GEN_SPARSE_UNIT_ATTRIBUTE_FEATURIZER ( AirCD  ,
airCD   
)
const BuildType * cherrypi::getBuildType ( BWAPI::UnitType  type)
const BuildType * cherrypi::getBuildType ( BWAPI::TechType  type)
const BuildType * cherrypi::getBuildType ( BWAPI::UpgradeType  type,
int  level 
)
FixedScenario cherrypi::getScenario ( const std::string &  scenarioName)
int cherrypi::getSpawnCoordinate ( State state,
int  base,
int  max,
float  noiseMax 
)
const BuildType * cherrypi::getTechBuildType ( int  tech)
const BuildType * cherrypi::getUnitBuildType ( int  unit)
std::tuple<float, float, float, float> cherrypi::getUnitCountsHealth ( State state)
const BuildType * cherrypi::getUpgradeBuildType ( int  upgrade,
int  level 
)
double cherrypi::HPScoreHeuristic ( Unit const *  me,
Unit const *  o 
)
inline
void cherrypi::incr ( ssize_t  )
inline
void cherrypi::incr ( ssize_t  n,
off_t &  offset 
)
inline
void cherrypi::init ( int64_t  randomSeed)
void cherrypi::init ( )
void cherrypi::initLogging ( const char *  execName,
std::string  logSinkDir,
bool  logSinkToStderr 
)
void cherrypi::installSignalHandlers ( )
bool cherrypi::isValidResource ( Unit u)

Should we be allowed to gather from this resource?

std::unique_ptr< Reward > cherrypi::killSpeedReward ( )
FixedScenarioGroup cherrypi::kitingScenarios ( )

Scenarios requiring alternating attack/move actions.

std::string cherrypi::larvaToString ( State state)
Snapshot cherrypi::loadSnapshot ( const std::string &  path)
void cherrypi::logColumns ( const std::vector< std::string > &  strings,
int  logLevel,
int  width 
)
template<typename procT >
std::shared_ptr<torchcraft::Client> cherrypi::makeTorchCraftClient ( procT &&  proc,
torchcraft::Client::Options  opts,
int  timeout 
)
std::string cherrypi::mineralsToString ( State state)
FixedScenarioGroup cherrypi::miscellaneousScenarios ( )

All other scenarios.

int constexpr cherrypi::numUpcCommands ( )

Does not count the "None" command.

auto cherrypi::order ( Unit worker)
inline
template<class... Ts>
cherrypi::overloaded ( Ts...  ) -> overloaded< Ts... >
int cherrypi::popen2 ( std::vector< std::string > const &  command,
std::vector< EnvVar > const &  env,
int *  infp,
int *  outfp,
int *  outfpw 
)
std::unique_ptr< Reward > cherrypi::protectCiviliansReward ( )
std::unique_ptr< Reward > cherrypi::proximityToEnemyReward ( )
std::unique_ptr< Reward > cherrypi::proximityToReward ( int  y,
int  x 
)
int cherrypi::rangeOn ( int  minInclusive,
int  maxInclusive 
)
std::string cherrypi::readData ( int  fd)
ssize_t cherrypi::readFull ( int  fd,
void *  buf,
size_t  count 
)
int cherrypi::recvfd ( int  socket)
cherrypi::REGISTER_SUBCLASS_0 ( Module  ,
TopModule   
)
cherrypi::REGISTER_SUBCLASS_0 ( Module  ,
CreateGatherAttackModule   
)
cherrypi::REGISTER_SUBCLASS_0 ( Module  ,
StaticDefenceFocusFireModule   
)
cherrypi::REGISTER_SUBCLASS_0 ( Module  ,
HarassModule   
)
cherrypi::REGISTER_SUBCLASS_0 ( Module  ,
CombatMicroModule   
)
cherrypi::REGISTER_SUBCLASS_0 ( Module  ,
UPCToCommandModule   
)
cherrypi::REGISTER_SUBCLASS_0 ( Module  ,
GenericAutoBuildModule   
)
cherrypi::REGISTER_SUBCLASS_0 ( Module  ,
BuildingPlacerModule   
)
cherrypi::REGISTER_SUBCLASS_0 ( Module  ,
CombatModule   
)
cherrypi::REGISTER_SUBCLASS_0 ( Module  ,
BuilderModule   
)
cherrypi::REGISTER_SUBCLASS_0 ( Module  ,
GathererModule   
)
cherrypi::REGISTER_SUBCLASS_0 ( Module  ,
SquadCombatModule   
)
cherrypi::REGISTER_SUBCLASS_0 ( Module  ,
ScoutingModule   
)
cherrypi::REGISTER_SUBCLASS_0 ( Module  ,
CherryVisDumperModule   
)
cherrypi::REGISTER_SUBCLASS_0 ( Module  ,
TacticsModule   
)
cherrypi::REGISTER_SUBCLASS_0 ( Module  ,
AutoBuildModule   
)
cherrypi::REGISTER_SUBCLASS_0 ( Module  ,
StrategyModule   
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBO5Pool  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOt5rax  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOdelayed4Pool  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOtvtz2portwraith  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOultras  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOpvzffe5gategoon  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOpve4gate  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBO12HatchHydras  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOpve2gate1012  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOtvpjoyorush  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOzve9poolspeed  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOhydracheese  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOpvpgategateobs  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBO2BaseMutas  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOpvp2gatedt  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOhydras  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOzvtp1hatchlurker  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOzvzoverpoolplus1  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOzvz12poolhydras  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOzvz9gas10pool  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBO9PoolSpeedLingMuta  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOzvz9poolspeed  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOzvp6hatchhydra  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBO3BasePoolLings  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBO10HatchLing  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBO2HatchMuta  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOzvpmutas  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOzvtantimech  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOzvp3hatchhydra  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOzvt3hatchlurker  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOzvzoverpool  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOzvp10hatch  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBO12PoolMuta  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOzvt2basedefiler  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOzvt2baseultra  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOzvt2baseguardian  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOzvtMacro  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOmidmassling  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOzvpohydras  ,
UpcId  ,
State ,
Module  
)
cherrypi::REGISTER_SUBCLASS_3 ( ABBOBase  ,
ABBOzvpomutas  ,
UpcId  ,
State ,
Module  
)
FixedScenarioGroup cherrypi::regroupingScenarios ( )

Scenarios requiring regrouping before fighting.

void cherrypi::saveSnapshot ( const Snapshot snapshot,
const std::string &  path 
)
FeatureData cherrypi::selectFeatures ( FeatureData const &  feat,
std::vector< AnyFeatureType types 
)

Selects a subset of features.

Assumes that types is a subset of the ones the feat. If not, you'll get an exception. Reorders types from feat to be as in types.

void cherrypi::sendData ( int  fd,
std::string const &  data 
)
void cherrypi::sendfd ( int  socket,
int  fd 
)
void cherrypi::setLoggingFrame ( int  frame)

Set a frame number to prefix log messages with.

void cherrypi::setupPlayerFromCli ( Player player)
void cherrypi::shutdown ( bool  logSinkToStderr)
FixedScenarioGroup cherrypi::simpleScenarios ( )

Some easier scenarios.

FixedScenario cherrypi::snapshotToScenario ( const Snapshot snapshot)
Snapshot cherrypi::stateToSnapshot ( torchcraft::State state)
FeatureData cherrypi::subsampleFeature ( FeatureData const &  feat,
SubsampleMethod  method,
int  factor,
int  stride = -1 
)

Applies a spatial subsampling method to a feature.

The scale of the resulting feature will be original scale times the given factor.

std::string cherrypi::supplyToString ( State state)
FixedScenario& cherrypi::symmetric ( FixedScenario scenario,
const std::vector< UnitCount > &  units 
)
FixedScenarioGroup cherrypi::symmetricAirGroundScenarios ( )

Scenarios involving a symmetric fight between mixed air/ground units.

FixedScenarioGroup cherrypi::symmetricBigScenarios ( )

Scenarios involving a symmetric fight between large numbers of units.

FixedScenarioGroup cherrypi::symmetricSingleUnitScenarios ( )

Scenarios involving a symmetric fight between units of a single type.

void cherrypi::to_json ( nlohmann::json &  json,
CherryVisDumperModule::Logger const &  logger 
)
void cherrypi::to_json ( nlohmann::json &  json,
CherryVisDumperModule::Dumpable const &  key 
)
void cherrypi::to_json ( nlohmann::json &  json,
Unit const *  unit 
)
void cherrypi::to_json ( nlohmann::json &  json,
Position const &  p 
)
double cherrypi::UnityScoreHeuristic ( Unit const *  me,
Unit const *  o 
)
inline
void cherrypi::unsetLoggingFrame ( )

Reset the frame number for log messages.

void cherrypi::vlog ( int  level,
Unit worker,
Unit resource,
std::string &&  logTemplate 
)
template<class F , class... Offset>
ssize_t cherrypi::wrapFull ( f,
int  fd,
void *  buf,
size_t  count,
Offset...  offset 
)
ssize_t cherrypi::writeFull ( int  fd,
const void *  buf,
size_t  count 
)

Variable Documentation

auto cherrypi::eachFrameRechargeMyEnergy
Initial value:
= [](State* state) {
for (auto& unit : state->unitsInfo().myUnits()) {
if (unit->unit.energy < unit->type->maxEnergy) {
state->board()->postCommand(
torchcraft::BW::Command::CommandOpenbw,
torchcraft::BW::OpenBWCommandType::SetUnitEnergy,
unit->id,
200),
kRootUpcId);
}
}
}
Definition: client.h:40
char constexpr cherrypi::kAutoBottomModule[] = "UPCToCommand"
char constexpr cherrypi::kAutoTopModule[] = "Top"
constexpr double cherrypi::kChaseDelProbThreshold = 1.0
constexpr int cherrypi::kChaseHpThreshold = 20
constexpr double cherrypi::kChaseLookahead = 4.0
constexpr double cherrypi::kChaseOvershoot = 4.0
char constexpr cherrypi::kDefaultModules[]
Initial value:
=
"CreateGatherAttack,"
"Strategy,"
"GenericAutoBuild,"
"BuildingPlacer,"
"Builder,"
"Tactics,"
"SquadCombat,"
"Scouting,"
"Gatherer,"
"Harass,"
"StaticDefenceFocusFireModule"

The default set of modules.

This is what CherryPi uses in a normal game.

double constexpr cherrypi::kDegPerRad = 180 / M_PI
double constexpr cherrypi::kdEpsilon = std::numeric_limits<double>::epsilon()
double constexpr cherrypi::kdInfty = std::numeric_limits<double>::infinity()
constexpr double cherrypi::kDistanceMining = 4 * 12

How far a resource can be from our base before it's considered long-distance mining.

double constexpr cherrypi::kdLowest = std::numeric_limits<double>::lowest()
double constexpr cherrypi::kdMax = std::numeric_limits<double>::max()
float constexpr cherrypi::kfEpsilon = std::numeric_limits<float>::epsilon()
UpcId constexpr cherrypi::kFilteredUpcId = -2
float constexpr cherrypi::kfInfty = std::numeric_limits<float>::infinity()
float constexpr cherrypi::kfLowest = std::numeric_limits<float>::lowest()
float constexpr cherrypi::kfMax = std::numeric_limits<float>::max()
int constexpr cherrypi::kForever = 24 * 60 * 60 * 24 * 7
constexpr double cherrypi::kInvalid = std::numeric_limits<double>::infinity()
constexpr Position cherrypi::kInvalidPosition {-1, -1}
UpcId constexpr cherrypi::kInvalidUpcId = -1
constexpr double cherrypi::kKiteDelProbThreshold = 0.85
constexpr int cherrypi::kKiteFrameMargin = 3
constexpr int cherrypi::kKiteHpThreshold = 20
constexpr int cherrypi::kKiteRangeMargin = 4
constexpr double cherrypi::kKiteRatioBreathe = 0.5
constexpr double cherrypi::kKiteRatioDefault = 0.25
constexpr double cherrypi::kKiteRatioFallback = 0.5
constexpr double cherrypi::kKiteRatioPunish = 1.0
constexpr int cherrypi::kLarvaFrames = 342
constexpr int cherrypi::kLurkerBurrowFrames = 24
constexpr int cherrypi::kLurkerUnburrowFrames = 12
const double cherrypi::kMapDiagonal
Initial value:
=
2 * sqrt(mapMidpointX * mapMidpointX + mapMidpointY * mapMidpointY)
UpcId constexpr cherrypi::kRootUpcId = 0
constexpr int cherrypi::mapMidpointX = 128
constexpr int cherrypi::mapMidpointY = 128