Documentation
¶
Index ¶
- Constants
- Variables
- func BresenhamsLineDrawable(p0, p1 point.Point, grid *grid.Grid) bool
- func CmpAirDPS(unit *Unit) float64
- func CmpAirRange(unit *Unit) float64
- func CmpAirScore(unit *Unit) float64
- func CmpFood(unit *Unit) float64
- func CmpGroundDPS(unit *Unit) float64
- func CmpGroundDamage(unit *Unit) float64
- func CmpGroundRange(unit *Unit) float64
- func CmpGroundScore(unit *Unit) float64
- func CmpHits(unit *Unit) float64
- func CmpTags(unit *Unit) float64
- func CmpTotalScore(unit *Unit) float64
- func DefaultAttackFunc(u *Unit, priority int, targets Units) bool
- func DefaultMoveFunc(u *Unit, target *Unit)
- func DpsGt5(u *Unit) bool
- func Flying(u *Unit) bool
- func Gathering(u *Unit) bool
- func Ground(u *Unit) bool
- func HasReactor(u *Unit) bool
- func HasTechlab(u *Unit) bool
- func Hidden(u *Unit) bool
- func Idle(u *Unit) bool
- func MaxInt(a, b int) int
- func Mechanical(u *Unit) bool
- func MinInt(a, b int) int
- func Mineral(u *Unit) bool
- func NavPath(grid *grid.Grid, wpm WaypointsMap, fromPtr, toPtr point.Pointer) (point.Points, float64)
- func NoAddon(u *Unit) bool
- func NotReady(u *Unit) bool
- func NotStructure(u *Unit) bool
- func NotWorker(u *Unit) bool
- func PosVisible(u *Unit) bool
- func Ready(u *Unit) bool
- func SortByOther(mainSlice []point.Point, otherSlice []float64) []point.Point
- func Structure(u *Unit) bool
- func TimeToLoop(minutes, seconds int) int
- func Unused(u *Unit) bool
- func Visible(u *Unit) bool
- type Aliases
- type AttackDelays
- type AttackFunc
- type Bot
- func (b *Bot) AddToCluster(enemy *Unit, c *Cluster)
- func (b *Bot) CalculateExpansionLocations() []UnitCluster
- func (b *Bot) CanBuild(aid api.AbilityID, limit, active int) bool
- func (b *Bot) CanBuy(ability api.AbilityID) bool
- func (b *Bot) CheckPoints(ps point.Points, check CheckMap) bool
- func (b *Bot) Debug2x2Buildings(ps ...point.Point)
- func (b *Bot) Debug3x3Buildings(ps ...point.Point)
- func (b *Bot) Debug5x3Buildings(ps ...point.Point)
- func (b *Bot) DebugAdd(cmd *api.DebugCommand)
- func (b *Bot) DebugAddBoxes(boxes []*api.DebugBox)
- func (b *Bot) DebugAddLines(lines []*api.DebugLine)
- func (b *Bot) DebugAddSpheres(spheres []*api.DebugSphere)
- func (b *Bot) DebugAddUnits(unitType api.UnitTypeID, owner api.PlayerID, pos point.Point, qty uint32)
- func (b *Bot) DebugCircles(cs ...point.Circle)
- func (b *Bot) DebugClusters()
- func (b *Bot) DebugEnemyUnits()
- func (b *Bot) DebugKillUnits(tags ...api.UnitTag)
- func (b *Bot) DebugLines(lines point.Lines, color api.Color)
- func (b *Bot) DebugMap()
- func (b *Bot) DebugOrders()
- func (b *Bot) DebugPath(path point.Points, color api.Color)
- func (b *Bot) DebugPoints(ps ...point.Point)
- func (b *Bot) DebugRamps()
- func (b *Bot) DebugSafeGrid(normal, safe *grid.Grid)
- func (b *Bot) DebugSend()
- func (b *Bot) DebugUnitValue(tag api.UnitTag, value api.DebugSetUnitValue_UnitValue, qty float32)
- func (b *Bot) DebugWayMap(wpm WaypointsMap, showLines bool)
- func (b *Bot) DeductResources(aid api.AbilityID)
- func (b *Bot) DetectEnemyRace()
- func (b *Bot) EffectPoints(effect api.EffectID) point.Points
- func (b *Bot) FillGases(miners *Units, ccs, gases Units)
- func (b *Bot) FillMineralsUpTo2(miners *Units, ccs, allMfs Units)
- func (b *Bot) FillMineralsUpTo3(miners *Units, ccs, allMfs Units)
- func (b *Bot) FindBaseCenter(basePos point.Point) point.Point
- func (b *Bot) FindBaseCluster(p point.Point, cluster *point.Points, basePoints map[point.Point]bool)
- func (b *Bot) FindClosestPathable(grid *grid.Grid, ptr point.Pointer) point.Point
- func (b *Bot) FindClosestPos(ptr point.Pointer, size BuildingSize, aid api.AbilityID, cells PathableCells, ...) point.Point
- func (b *Bot) FindClusterTopPoints(cluster *point.Points) (point.Points, float64)
- func (b *Bot) FindClusters()
- func (b *Bot) FindExpansions()
- func (b *Bot) FindHomeMineralsVector()
- func (b *Bot) FindPaths(grid *grid.Grid, ptr point.Pointer, reaper bool) Steps
- func (b *Bot) FindRamp2x2Positions(ramp Ramp) point.Points
- func (b *Bot) FindRampBarracksPositions(ramp Ramp) point.Points
- func (b *Bot) FindRampCluster(p point.Point, cluster *point.Points, rampPoints map[point.Point]bool)
- func (b *Bot) FindRamps()
- func (b *Bot) FindWaypoints(wpm WaypointsMap, grid *grid.Grid) Waypoints
- func (b *Bot) FindWaypointsMap(grid *grid.Grid) WaypointsMap
- func (b *Bot) GetBuildingPoints(ptr point.Pointer, size BuildingSize) point.Points
- func (b *Bot) GetGasSaturation(gases Units) map[api.UnitTag]int
- func (b *Bot) GetMineralsSaturation(mfs Units) map[api.UnitTag]int
- func (b *Bot) GetPathablePoints(ptr point.Pointer, size BuildingSize, cells PathableCells) point.Points
- func (b *Bot) HandleMiners(miners, ccs, enemies Units, balance float64, safePos point.Pointer, ...)
- func (b *Bot) HandleOversaturation(ccs, allMfs Units)
- func (b *Bot) Init(stop <-chan struct{})
- func (b *Bot) InitCCMinerals(cc *Unit, turrets point.Points)
- func (b *Bot) InitEffects(effectData []*api.EffectData)
- func (b *Bot) InitLocations()
- func (b *Bot) InitMining(turrets point.Points)
- func (b *Bot) InitRamps()
- func (b *Bot) InitUnits(typeData []*api.UnitTypeData)
- func (b *Bot) InitUpgrades(upgradeData []*api.UpgradeData)
- func (b *Bot) IsPosOk(ptr point.Pointer, size BuildingSize, cells PathableCells, flags ...CheckMap) bool
- func (b *Bot) MicroGas(miners, gases, ccs, enemies Units, safePos point.Pointer)
- func (b *Bot) MicroMinerals(miners, ccs, enemies Units, safePos point.Pointer, turrets point.Points)
- func (b *Bot) MyRace() api.Race
- func (b *Bot) NewUnit(unit *api.Unit) (*Unit, bool)
- func (b *Bot) ParseObservation()
- func (b *Bot) ParseOrders()
- func (b *Bot) ParseUnits()
- func (b *Bot) Path(toPtr, fromPtr point.Pointer) (point.Points, float64)
- func (b *Bot) Pending(aid api.AbilityID) int
- func (b *Bot) PendingAliases(aid api.AbilityID) int
- func (b *Bot) RedistributeWorkersToRefineryIfNeeded(ref *Unit, miners Units, limit int)
- func (b *Bot) RenewPaths(stop <-chan struct{})
- func (b *Bot) RequestAvailableAbilities(irr bool, us ...*Unit)
- func (b *Bot) RequestPathing(p1, p2 point.Pointer) float64
- func (b *Bot) RequestPlacement(ability api.AbilityID, pos point.Point, builder *Unit) bool
- func (b *Bot) SaveState()
- func (b *Bot) UnitTargetPos(u *Unit) point.Point
- func (b *Bot) UpdateData()
- func (b *Bot) UpdateInfo()
- func (b *Bot) UpdateObservation()
- type BuildingSize
- type Cell
- type CellsPair
- type CheckMap
- type Cluster
- type CommandsStack
- func (cs *CommandsStack) AddPos(a api.AbilityID, p point.Point, queue bool, u ...*Unit)
- func (cs *CommandsStack) AddSimple(a api.AbilityID, queue bool, u ...*Unit)
- func (cs *CommandsStack) AddTag(a api.AbilityID, t api.UnitTag, queue bool, u ...*Unit)
- func (cs *CommandsStack) Process(actions *actions.Actions)
- func (cs *CommandsStack) ProcessPos(actions *actions.Actions, posList map[api.AbilityID]map[point.Point]Units, ...)
- func (cs *CommandsStack) ProcessSimple(actions *actions.Actions, simple map[api.AbilityID]Units, queue bool)
- func (cs *CommandsStack) ProcessTag(actions *actions.Actions, tagList map[api.AbilityID]map[api.UnitTag]Units, ...)
- type Compare
- type Cost
- type Filter
- type Group
- type GroupID
- type Groups
- func (gs *Groups) Add(group GroupID, units ...*Unit)
- func (gs *Groups) AddN(groupName string, units ...*Unit)
- func (gs *Groups) ClearUnits()
- func (gs *Groups) Fill(unit *Unit)
- func (gs *Groups) Get(group GroupID) Group
- func (gs *Groups) GetN(groupName string) Group
- func (gs *Groups) New(units ...*Unit) GroupID
- type MapAccessor
- type MoveFunc
- type PathableCells
- type Paths
- type Queue
- type Ramp
- type Steps
- type Tags
- type TagsByTypes
- type TagsMap
- type Tile
- type Unit
- func (u *Unit) AirDPS() float64
- func (u *Unit) AirDamage() float64
- func (u *Unit) AirEvade(enemies Units, gap float64, ptr point.Pointer) (point.Point, bool)
- func (u *Unit) AirRange() float64
- func (u *Unit) AssessStrength(attackers Units) (outranged, stronger bool)
- func (u *Unit) Attack(targetsGroups ...Units)
- func (u *Unit) AttackCustom(attackFunc AttackFunc, moveFunc MoveFunc, targetsGroups ...Units)
- func (u *Unit) AttackMove(target *Unit)
- func (u *Unit) CanAttack(us Units, gap float64) Units
- func (u *Unit) Command(ability api.AbilityID)
- func (u *Unit) CommandPos(ability api.AbilityID, target point.Pointer)
- func (u *Unit) CommandPosQueue(ability api.AbilityID, target point.Pointer)
- func (u *Unit) CommandQueue(ability api.AbilityID)
- func (u *Unit) CommandTag(ability api.AbilityID, target api.UnitTag)
- func (u *Unit) CommandTagQueue(ability api.AbilityID, target api.UnitTag)
- func (u *Unit) Dist(ptr point.Pointer) float64
- func (u *Unit) Dist2(ptr point.Pointer) float64
- func (u *Unit) EstimatePositionAfter(frames int) point.Point
- func (u *Unit) EvadeEffects() bool
- func (u *Unit) EvadeEffectsPos(ptr point.Pointer, checkKD8 bool, eids ...api.EffectID) (point.Point, bool)
- func (u *Unit) FindAssignedBuilder(builders Units) *Unit
- func (u *Unit) FindAssignedRepairers(reps Units) Units
- func (u *Unit) FramesToDistantPos(ptr point.Pointer) float64
- func (u *Unit) FramesToPos(ptr point.Pointer) float64
- func (u *Unit) GetEffectsList() []api.EffectID
- func (u *Unit) GetWayMap(safe bool) (*grid.Grid, WaypointsMap)
- func (u *Unit) GroundDPS() float64
- func (u *Unit) GroundDamage() float64
- func (u *Unit) GroundEvade(enemies Units, gap float64, ptr point.Pointer) (point.Point, bool)
- func (u *Unit) GroundFallback(safePos point.Pointer, ignoreAttackAbility bool)
- func (u *Unit) GroundRange() float64
- func (u *Unit) GroundTowards(ptr point.Pointer, offset float64, safe bool) point.Point
- func (u *Unit) HasAbility(a api.AbilityID) bool
- func (u *Unit) HasBuff(b api.BuffID) bool
- func (u *Unit) HasIrrAbility(a api.AbilityID) bool
- func (u *Unit) HasReactor() bool
- func (u *Unit) HasTechlab() bool
- func (u *Unit) InRange(target *Unit, gap float64) bool
- func (u *Unit) InRangeOf(us Units, gap float64) Units
- func (u *Unit) Is(ids ...api.UnitTypeID) bool
- func (u *Unit) IsAlreadyAttackingTargetInRange() bool
- func (u *Unit) IsArmed() bool
- func (u *Unit) IsArmored() bool
- func (u *Unit) IsCloserThan(dist float64, ptr point.Pointer) bool
- func (u *Unit) IsCoolToAttack() bool
- func (u *Unit) IsCoolToMove() bool
- func (u *Unit) IsDefensive() bool
- func (u *Unit) IsFarFrom(ptr point.Pointer) bool
- func (u *Unit) IsFurtherThan(dist float64, ptr point.Pointer) bool
- func (u *Unit) IsGathering() bool
- func (u *Unit) IsGeyser() bool
- func (u *Unit) IsHidden() bool
- func (u *Unit) IsIdle() bool
- func (u *Unit) IsLight() bool
- func (u *Unit) IsMechanical() bool
- func (u *Unit) IsMineral() bool
- func (u *Unit) IsMoving() bool
- func (u *Unit) IsNot(ids ...api.UnitTypeID) bool
- func (u *Unit) IsPosVisible() bool
- func (u *Unit) IsReady() bool
- func (u *Unit) IsReturning() bool
- func (u *Unit) IsSafeToApproach(p point.Pointer) bool
- func (u *Unit) IsStructure() bool
- func (u *Unit) IsUnused() bool
- func (u *Unit) IsVisible() bool
- func (u *Unit) IsWorker() bool
- func (u *Unit) Point() point.Point
- func (u *Unit) RangeDelta(target *Unit, gap float64) float64
- func (u *Unit) SightRange() float64
- func (u *Unit) Speed() float64
- func (u *Unit) SpreadFromSplash(enemies Units, ptr point.Pointer) (point.Point, bool)
- func (u *Unit) TargetAbility() api.AbilityID
- func (u *Unit) TargetPos() point.Point
- func (u *Unit) TargetTag() api.UnitTag
- func (u *Unit) Towards(ptr point.Pointer, offset float64) point.Point
- type UnitCluster
- type UnitOrder
- type UnitTypes
- type Units
- func (us *Units) Add(units ...*Unit)
- func (us Units) Attack(targetsGroups ...Units)
- func (us Units) ByTag(tag api.UnitTag) *Unit
- func (us Units) ByTags(tags Tags) Units
- func (us Units) CanAttack(u *Unit, gap float64) Units
- func (us Units) Center() point.Point
- func (us Units) CloserThan(dist float64, ptr point.Pointer) Units
- func (us Units) ClosestTo(ptr point.Pointer) *Unit
- func (us Units) Command(ability api.AbilityID)
- func (us Units) CommandPos(ability api.AbilityID, target point.Pointer)
- func (us Units) CommandPosQueue(ability api.AbilityID, target point.Pointer)
- func (us Units) CommandQueue(ability api.AbilityID)
- func (us Units) CommandTag(ability api.AbilityID, target api.UnitTag)
- func (us Units) CommandTagQueue(ability api.AbilityID, target api.UnitTag)
- func (us Units) Empty() bool
- func (us Units) Exists() bool
- func (us Units) Filter(filters ...Filter) Units
- func (us Units) First(filters ...Filter) *Unit
- func (us Units) FurtherThan(dist float64, ptr point.Pointer) Units
- func (us Units) FurthestTo(ptr point.Pointer) *Unit
- func (us Units) InRangeOf(u *Unit, gap float64) Units
- func (us Units) Len() int
- func (us Units) Max(comp Compare) *Unit
- func (us Units) Min(comp Compare) *Unit
- func (us Units) OfType(ids ...api.UnitTypeID) Units
- func (us Units) OrderBy(comp Compare, desc bool)
- func (us Units) OrderByDistanceTo(ptr point.Pointer, desc bool)
- func (us *Units) Pop() *Unit
- func (us Units) Rect() point.Points
- func (us *Units) Remove(unit *Unit)
- func (us *Units) RemoveTag(tag api.UnitTag)
- func (us Units) Sum(comp Compare) float64
- func (us Units) Tags() []api.UnitTag
- func (us Units) TagsMap() map[api.UnitTag]bool
- type UnitsByTypes
- type UnitsMap
- type Waypoint
- type Waypoints
- type WaypointsMap
- type Weapon
Constants ¶
const FPS = 22.4
const HitHistoryLoops = 56 // 2.5 sec
const KD8Radius = 1.75
const ResourceSpreadDistance = 9
Variables ¶
var Blue = api.Color{R: 12, G: 51, B: 232}
var DestructibleSize = map[api.UnitTypeID]BuildingSize{ neutral.UnbuildableBricksDestructible: UnbuildableRocks, neutral.UnbuildableBricksSmallUnit: UnbuildableRocks, neutral.UnbuildableBricksUnit: UnbuildableRocks, neutral.UnbuildablePlatesDestructible: UnbuildableRocks, neutral.UnbuildablePlatesSmallUnit: UnbuildableRocks, neutral.UnbuildablePlatesUnit: UnbuildableRocks, neutral.UnbuildableRocksDestructible: UnbuildableRocks, neutral.UnbuildableRocksSmallUnit: UnbuildableRocks, neutral.UnbuildableRocksUnit: UnbuildableRocks, neutral.Rocks2x2NonConjoined: BreakableRocks2x2, neutral.DestructibleCityDebris4x4: BreakableRocks4x4, neutral.DestructibleDebris4x4: BreakableRocks4x4, neutral.DestructibleIce4x4: BreakableRocks4x4, neutral.DestructibleRock4x4: BreakableRocks4x4, neutral.DestructibleRockEx14x4: BreakableRocks4x4, neutral.DestructibleCityDebris2x4Horizontal: BreakableRocks4x2, neutral.DestructibleIce2x4Horizontal: BreakableRocks4x2, neutral.DestructibleRock2x4Horizontal: BreakableRocks4x2, neutral.DestructibleRockEx12x4Horizontal: BreakableRocks4x2, neutral.DestructibleCityDebris2x4Vertical: BreakableRocks2x4, neutral.DestructibleIce2x4Vertical: BreakableRocks2x4, neutral.DestructibleRock2x4Vertical: BreakableRocks2x4, neutral.DestructibleRockEx12x4Vertical: BreakableRocks2x4, neutral.DestructibleCityDebris2x6Horizontal: BreakableRocks6x2, neutral.DestructibleIce2x6Horizontal: BreakableRocks6x2, neutral.DestructibleRock2x6Horizontal: BreakableRocks6x2, neutral.DestructibleRockEx12x6Horizontal: BreakableRocks6x2, neutral.DestructibleCityDebris2x6Vertical: BreakableRocks2x6, neutral.DestructibleIce2x6Vertical: BreakableRocks2x6, neutral.DestructibleRock2x6Vertical: BreakableRocks2x6, neutral.DestructibleRockEx12x6Vertical: BreakableRocks2x6, neutral.DestructibleCityDebris6x6: BreakableRocks6x6, neutral.DestructibleDebris6x6: BreakableRocks6x6, neutral.DestructibleExpeditionGate6x6: BreakableRocks6x6, neutral.DestructibleIce6x6: BreakableRocks6x6, neutral.DestructibleRock6x6: BreakableRocks6x6, neutral.DestructibleRock6x6Weak: BreakableRocks6x6, neutral.DestructibleRockEx16x6: BreakableRocks6x6, neutral.DestructibleCityDebrisHugeDiagonalBLUR: BreakableRocksDiagBLUR, neutral.DestructibleDebrisRampDiagonalHugeBLUR: BreakableRocksDiagBLUR, neutral.DestructibleIceDiagonalHugeBLUR: BreakableRocksDiagBLUR, neutral.DestructibleRampDiagonalHugeBLUR: BreakableRocksDiagBLUR, neutral.DestructibleRockEx1DiagonalHugeBLUR: BreakableRocksDiagBLUR, neutral.DestructibleCityDebrisHugeDiagonalULBR: BreakableRocksDiagULBR, neutral.DestructibleDebrisRampDiagonalHugeULBR: BreakableRocksDiagULBR, neutral.DestructibleIceDiagonalHugeULBR: BreakableRocksDiagULBR, neutral.DestructibleRampDiagonalHugeULBR: BreakableRocksDiagULBR, neutral.DestructibleRockEx1DiagonalHugeULBR: BreakableRocksDiagULBR, neutral.DestructibleIceHorizontalHuge: BreakableHorizontalHuge, neutral.DestructibleRampHorizontalHuge: BreakableHorizontalHuge, neutral.DestructibleRockEx1HorizontalHuge: BreakableHorizontalHuge, neutral.DestructibleIceVerticalHuge: BreakableVerticalHuge, neutral.DestructibleRampVerticalHuge: BreakableVerticalHuge, neutral.DestructibleRockEx1VerticalHuge: BreakableVerticalHuge, }
var GatheringAbilities = map[api.AbilityID]bool{ ability.Harvest_Gather_SCV: true, ability.Harvest_Gather_Mule: true, ability.Harvest_Gather_Drone: true, ability.Harvest_Gather_Probe: true, }
var GeyserTypes = map[api.UnitTypeID]bool{ neutral.ProtossVespeneGeyser: true, neutral.PurifierVespeneGeyser: true, neutral.RichVespeneGeyser: true, neutral.ShakurasVespeneGeyser: true, neutral.SpacePlatformGeyser: true, neutral.VespeneGeyser: true, }
var Green = api.Color{R: 1, G: 255, B: 48}
var MineralTypes = map[api.UnitTypeID]bool{ neutral.MineralField: true, neutral.MineralField750: true, neutral.RichMineralField: true, neutral.RichMineralField750: true, neutral.PurifierMineralField: true, neutral.PurifierMineralField750: true, neutral.PurifierRichMineralField: true, neutral.PurifierRichMineralField750: true, neutral.BattleStationMineralField: true, neutral.BattleStationMineralField750: true, neutral.LabMineralField: true, neutral.LabMineralField750: true, }
var Red = api.Color{R: 255, G: 1, B: 44}
var ReturningAbilities = map[api.AbilityID]bool{ ability.Harvest_Return_SCV: true, ability.Harvest_Return_Mule: true, ability.Harvest_Return_Drone: true, ability.Harvest_Return_Probe: true, }
var White = api.Color{R: 255, G: 255, B: 255}
var Yellow = api.Color{R: 232, G: 177, B: 12}
Functions ¶
func CmpAirRange ¶
func CmpAirScore ¶
func CmpGroundDPS ¶
func CmpGroundDamage ¶
func CmpGroundRange ¶
func CmpGroundScore ¶
func CmpTotalScore ¶
func DefaultMoveFunc ¶
func HasReactor ¶
func HasTechlab ¶
func Mechanical ¶
func NotStructure ¶
func PosVisible ¶
func TimeToLoop ¶
Types ¶
type Aliases ¶
type Aliases map[api.UnitTypeID]UnitTypes
func (Aliases) Add ¶
func (as Aliases) Add(td *api.UnitTypeData)
func (Aliases) Min ¶
func (as Aliases) Min(ut api.UnitTypeID) api.UnitTypeID
type AttackDelays ¶
type AttackDelays map[api.UnitTypeID]int
func (AttackDelays) IsCool ¶
func (ad AttackDelays) IsCool(ut api.UnitTypeID, cooldown float32, frames int) bool
func (AttackDelays) Max ¶
func (ad AttackDelays) Max(ut api.UnitTypeID, frames int) int
func (AttackDelays) UnitIsCool ¶
func (ad AttackDelays) UnitIsCool(u *Unit) bool
type Bot ¶
type Bot struct {
Client *client.Client
Obs *api.Observation
Data *api.ResponseData
Info *api.ResponseGameInfo
Chat []*api.ChatReceived
Result []*api.PlayerResult
Errors []*api.ActionError
Actions actions.Actions
Cmds *CommandsStack
DebugCommands []*api.DebugCommand
RecentEffects [][]*api.Effect // This needed because corrosive biles disappear from effects to early
Locs struct {
MapCenter point.Point
MyStart point.Point
MyStartMinVec point.Point
EnemyStart point.Point
EnemyStarts point.Points
EnemyMainCenter point.Point
MyExps point.Points
EnemyExps point.Points
}
Ramps struct {
All []Ramp
My Ramp
Enemy Ramp
}
Units struct {
My UnitsByTypes
MyAll Units
Enemy UnitsByTypes
AllEnemy UnitsByTypes
Minerals UnitsByTypes
Geysers UnitsByTypes
Neutral UnitsByTypes
ByTag map[api.UnitTag]*Unit
}
Enemies struct {
All Units
AllReady Units
Visible Units
Clusters []*Cluster // Not used yet
}
U struct {
Types []*api.UnitTypeData
GroundAttackCircle map[api.UnitTypeID]point.Points
Upgrades []*api.UpgradeData
Effects []*api.EffectData
UnitCost map[api.UnitTypeID]Cost
AbilityCost map[api.AbilityID]Cost
AbilityUnit map[api.AbilityID]api.UnitTypeID
UnitAbility map[api.UnitTypeID]api.AbilityID
UnitAliases Aliases
UnitsOrders map[api.UnitTag]UnitOrder
Attributes map[api.UnitTypeID]map[api.Attribute]bool
Weapons map[api.UnitTypeID]Weapon
HitsHistory map[api.UnitTag][]int
PrevUnits map[api.UnitTag]*Unit
AfterAttack AttackDelays
LastAttack map[api.UnitTag]int
}
Miners struct {
CCForMiner map[api.UnitTag]api.UnitTag
GasForMiner map[api.UnitTag]api.UnitTag
MineralForMiner map[api.UnitTag]api.UnitTag
TargetForMineral map[api.UnitTag]point.Point
LastSeen map[api.UnitTag]int
}
Grid *grid.Grid
SafeGrid *grid.Grid
ReaperGrid *grid.Grid
ReaperSafeGrid *grid.Grid
// HomePaths Steps
// HomeReaperPaths Steps
// ExpPaths []Steps
WayMap WaypointsMap
SafeWayMap WaypointsMap
ReaperExists bool
ReaperWayMap WaypointsMap
ReaperSafeWayMap WaypointsMap
EnemyRace api.Race
EnemyProduction TagsByTypes
Orders map[api.AbilityID]int
FramesPerOrder int
Groups *Groups
MaxGroup GroupID
Upgrades map[api.AbilityID]bool
Loop int
LastLoop int
Minerals int
MineralsPerFrame float64
Vespene int
VespenePerFrame float64
FoodCap int
FoodUsed int
FoodLeft int
UnitCreatedCallback func(unit *Unit)
}
var B *Bot // Pointer to the last created bot. It should be the only global here
func (*Bot) AddToCluster ¶
func (*Bot) CalculateExpansionLocations ¶
func (b *Bot) CalculateExpansionLocations() []UnitCluster
CalculateExpansionLocations groups resources into clusters and determines the best town hall location for each cluster. The Center() point of each cluster is the optimal town hall location. If debug is true then the results will also be visualized in-game (until new debug info is drawn).
func (*Bot) Debug2x2Buildings ¶
func (*Bot) Debug3x3Buildings ¶
func (*Bot) Debug5x3Buildings ¶
func (*Bot) DebugAdd ¶
func (b *Bot) DebugAdd(cmd *api.DebugCommand)
func (*Bot) DebugAddBoxes ¶
func (*Bot) DebugAddLines ¶
func (*Bot) DebugAddSpheres ¶
func (b *Bot) DebugAddSpheres(spheres []*api.DebugSphere)
func (*Bot) DebugAddUnits ¶
func (*Bot) DebugCircles ¶
func (*Bot) DebugClusters ¶
func (b *Bot) DebugClusters()
func (*Bot) DebugEnemyUnits ¶
func (b *Bot) DebugEnemyUnits()
func (*Bot) DebugKillUnits ¶
func (*Bot) DebugOrders ¶
func (b *Bot) DebugOrders()
func (*Bot) DebugPoints ¶
func (*Bot) DebugRamps ¶
func (b *Bot) DebugRamps()
func (*Bot) DebugSafeGrid ¶
func (*Bot) DebugUnitValue ¶
func (*Bot) DebugWayMap ¶
func (b *Bot) DebugWayMap(wpm WaypointsMap, showLines bool)
func (*Bot) DeductResources ¶
func (*Bot) DetectEnemyRace ¶
func (b *Bot) DetectEnemyRace()
func (*Bot) FillMineralsUpTo2 ¶
func (*Bot) FillMineralsUpTo3 ¶
func (*Bot) FindBaseCluster ¶
func (*Bot) FindClosestPathable ¶
func (*Bot) FindClosestPos ¶
func (b *Bot) FindClosestPos(ptr point.Pointer, size BuildingSize, aid api.AbilityID, cells PathableCells, maxOffset, step int, flags ...CheckMap) point.Point
Return 0 if not found
func (*Bot) FindClusterTopPoints ¶
func (*Bot) FindClusters ¶
func (b *Bot) FindClusters()
func (*Bot) FindExpansions ¶
func (b *Bot) FindExpansions()
func (*Bot) FindHomeMineralsVector ¶
func (b *Bot) FindHomeMineralsVector()
func (*Bot) FindRampBarracksPositions ¶
First position is for initial building, second is for addon
func (*Bot) FindRampCluster ¶
func (*Bot) FindWaypoints ¶
func (b *Bot) FindWaypoints(wpm WaypointsMap, grid *grid.Grid) Waypoints
func (*Bot) FindWaypointsMap ¶
func (b *Bot) FindWaypointsMap(grid *grid.Grid) WaypointsMap
func (*Bot) GetBuildingPoints ¶
func (*Bot) GetMineralsSaturation ¶
func (*Bot) GetPathablePoints ¶
func (b *Bot) GetPathablePoints(ptr point.Pointer, size BuildingSize, cells PathableCells) point.Points
func (*Bot) HandleMiners ¶
func (b *Bot) HandleMiners(miners, ccs, enemies Units, balance float64, safePos point.Pointer, turrets point.Points)
balance - minerals to gas gather ratio, ex: 2 => gather more vespene if it is less than minerals * 2
func (*Bot) HandleOversaturation ¶
func (*Bot) InitEffects ¶
func (b *Bot) InitEffects(effectData []*api.EffectData)
func (*Bot) InitLocations ¶
func (b *Bot) InitLocations()
func (*Bot) InitMining ¶
func (*Bot) InitUnits ¶
func (b *Bot) InitUnits(typeData []*api.UnitTypeData)
func (*Bot) InitUpgrades ¶
func (b *Bot) InitUpgrades(upgradeData []*api.UpgradeData)
func (*Bot) IsPosOk ¶
func (b *Bot) IsPosOk(ptr point.Pointer, size BuildingSize, cells PathableCells, flags ...CheckMap) bool
func (*Bot) MicroMinerals ¶
func (*Bot) ParseObservation ¶
func (b *Bot) ParseObservation()
func (*Bot) ParseOrders ¶
func (b *Bot) ParseOrders()
func (*Bot) ParseUnits ¶
func (b *Bot) ParseUnits()
func (*Bot) RedistributeWorkersToRefineryIfNeeded ¶
func (*Bot) RenewPaths ¶
func (b *Bot) RenewPaths(stop <-chan struct{})
func (*Bot) RequestAvailableAbilities ¶
func (*Bot) RequestPlacement ¶
func (*Bot) UpdateData ¶
func (b *Bot) UpdateData()
func (*Bot) UpdateInfo ¶
func (b *Bot) UpdateInfo()
func (*Bot) UpdateObservation ¶
func (b *Bot) UpdateObservation()
type BuildingSize ¶
type BuildingSize int
const ( S2x1 BuildingSize = iota + 1 S2x2 S3x3 S5x3 S5x5 UnbuildableRocks BreakableRocks2x2 BreakableRocks4x4 BreakableRocks4x2 BreakableRocks2x4 BreakableRocks6x2 BreakableRocks2x6 BreakableRocks6x6 BreakableRocksDiagBLUR BreakableRocksDiagULBR BreakableHorizontalHuge BreakableVerticalHuge )
type CommandsStack ¶
type CommandsStack struct {
Simple map[api.AbilityID]Units
SimpleQueue map[api.AbilityID]Units
Pos map[api.AbilityID]map[point.Point]Units
PosQueue map[api.AbilityID]map[point.Point]Units
Tag map[api.AbilityID]map[api.UnitTag]Units
TagQueue map[api.AbilityID]map[api.UnitTag]Units
}
func (*CommandsStack) AddSimple ¶
func (cs *CommandsStack) AddSimple(a api.AbilityID, queue bool, u ...*Unit)
func (*CommandsStack) Process ¶
func (cs *CommandsStack) Process(actions *actions.Actions)
func (*CommandsStack) ProcessPos ¶
func (*CommandsStack) ProcessSimple ¶
type Groups ¶
type Groups struct {
MaxGroup GroupID
// contains filtered or unexported fields
}
func (*Groups) ClearUnits ¶
func (gs *Groups) ClearUnits()
type MapAccessor ¶
type Paths ¶
type Paths struct {
Steps Steps
Queue Queue
B MapAccessor
}
type TagsByTypes ¶
type TagsByTypes map[api.UnitTypeID]TagsMap
func (*TagsByTypes) Add ¶
func (tt *TagsByTypes) Add(ut api.UnitTypeID, tag api.UnitTag)
func (TagsByTypes) Len ¶
func (tt TagsByTypes) Len(ut api.UnitTypeID) int
func (TagsByTypes) Score ¶
func (tt TagsByTypes) Score(uts ...api.UnitTypeID) int
type Tile ¶
type Tile struct {
// X and Y are the coordinates of the tile.
X, Y float64
// B is a reference to the Bot
B MapAccessor
// Tiles storage
M map[float64]map[float64]*Tile
}
A Tile is a tile in a grid which implements Pather.
func (*Tile) PathNeighborCost ¶
PathNeighborCost returns the movement cost of the directly neighboring tile.
func (*Tile) PathNeighbors ¶
PathNeighbors returns the neighbors of the tile, excluding blockers and tiles off the edge of the board.
type Unit ¶
type Unit struct {
api.Unit
SpamCmds bool
CmdSet bool
HPS float64
Hits float64
HitsMax float64
HitsLost float64
Abilities []api.AbilityID
IrrAbilities []api.AbilityID
PosDelta point.Point
Neighbours Units
Cluster *Cluster
}
func (*Unit) AirEvade ¶
these two functions are bad because they consider only one unit to evade. Todo: rewrite
func (*Unit) AssessStrength ¶
func (*Unit) AttackCustom ¶
func (u *Unit) AttackCustom(attackFunc AttackFunc, moveFunc MoveFunc, targetsGroups ...Units)
func (*Unit) AttackMove ¶
func (*Unit) CommandPosQueue ¶
func (*Unit) CommandQueue ¶
func (*Unit) CommandTagQueue ¶
func (*Unit) EvadeEffects ¶
func (*Unit) EvadeEffectsPos ¶
func (*Unit) FindAssignedBuilder ¶
func (*Unit) FindAssignedRepairers ¶
func (*Unit) GetEffectsList ¶
func (*Unit) GroundDamage ¶
func (*Unit) GroundEvade ¶
func (*Unit) GroundFallback ¶
func (*Unit) GroundRange ¶
func (*Unit) GroundTowards ¶
func (*Unit) HasReactor ¶
func (*Unit) HasTechlab ¶
func (*Unit) IsAlreadyAttackingTargetInRange ¶
Used to prevent switches between targets with same priority without actually attacking anything
func (*Unit) IsCoolToAttack ¶
Тут нужно определять способен ли юнит нанести удар развернувшись без дополнительной задержки Но так же надо следить, успеют ли укусить рипера или другой отступающий юнит Пока что надёжнее дожидаться u.WeaponCooldown == 0, тогда Рипер убегая от лингов или зилота атакует реже и тем самым может сохранять дистанцию Used to check if unit is ready to attack right away
func (*Unit) IsCoolToMove ¶
Used to check if it is ok to issue next _move_ order without interrupting current attack action
func (*Unit) IsDefensive ¶
func (*Unit) IsGathering ¶
func (*Unit) IsMechanical ¶
func (*Unit) IsPosVisible ¶
func (*Unit) IsReturning ¶
func (*Unit) IsStructure ¶
func (*Unit) SightRange ¶
func (*Unit) SpreadFromSplash ¶
func (*Unit) TargetAbility ¶
type UnitCluster ¶
type UnitCluster struct {
// contains filtered or unexported fields
}
UnitCluster is a cluster of units and the associated center of mass.
func MakeCluster ¶
func MakeCluster(units Units, distance float64) []UnitCluster
Taken from Chippydip's lib Cluster breaks a list of units into clusters based on the given clustering distance.
func (*UnitCluster) Add ¶
func (c *UnitCluster) Add(u *Unit)
Add adds a new unit to the cluster and updates the center of mass.
func (*UnitCluster) Center ¶
func (c *UnitCluster) Center() point.Point
Center is the center of mass of the cluster.
func (*UnitCluster) Count ¶
func (c *UnitCluster) Count() int
Count returns the number of units in the cluster.
func (*UnitCluster) Units ¶
func (c *UnitCluster) Units() *Units
Units is the list of units in the cluster.
type UnitTypes ¶
type UnitTypes []api.UnitTypeID
func (*UnitTypes) Add ¶
func (ut *UnitTypes) Add(ids ...api.UnitTypeID)
type Units ¶
type Units []*Unit
func (Units) CommandPosQueue ¶
func (Units) CommandQueue ¶
func (Units) CommandTagQueue ¶
type UnitsByTypes ¶
type UnitsByTypes map[api.UnitTypeID]Units
func (UnitsByTypes) Add ¶
func (ut UnitsByTypes) Add(utype api.UnitTypeID, unit *Unit)
func (UnitsByTypes) All ¶
func (ut UnitsByTypes) All() Units
func (UnitsByTypes) Empty ¶
func (ut UnitsByTypes) Empty() bool
func (UnitsByTypes) Exists ¶
func (ut UnitsByTypes) Exists() bool
func (UnitsByTypes) OfType ¶
func (ut UnitsByTypes) OfType(ids ...api.UnitTypeID) Units
type Waypoint ¶
type Waypoint struct {
point.Point
M WaypointsMap
}
func (*Waypoint) PathNeighborCost ¶
PathNeighborCost returns the movement cost of the directly neighboring tile.
func (*Waypoint) PathNeighbors ¶
PathNeighbors returns the neighbors of the tile, excluding blockers and tiles off the edge of the board.
type WaypointsMap ¶
func (WaypointsMap) NewWaypoint ¶
func (wpm WaypointsMap) NewWaypoint(p point.Point) *Waypoint