bot

package
v0.0.0-...-f38aecb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2021 License: MIT Imports: 14 Imported by: 6

Documentation

Index

Constants

View Source
const (
	Miners scl.GroupID = iota + 1
	// MinersRetreat
	Builders
	Repairers
	ScvHealer
	UnitHealers
	WorkerRushDefenders
	Mules
	Scout
	ScoutBase
	ScvReserve
	ProxyBuilders
	Marines
	Marauders
	Reapers
	ReapersRetreat
	Cyclones
	WidowMines
	WidowMinesRetreat
	Hellions
	HellionScout
	Tanks
	TanksOnExps
	Thors
	Medivacs
	ThorEvacs
	Vikings
	Ravens
	Banshees
	Battlecruisers
	MechRetreat
	MechHealing
	UnderConstruction
	Buildings
	MaxGroup
)

Variables

View Source
var StrategyPriority = map[Strategy]float64{
	BruteForce:   0.99,
	CcAfterRax:   0.98,
	Default:      0.97,
	CcBeforeRax:  0.96,
	ProxyReapers: 0.95,
	ProxyMarines: 0.94,
}

Functions

func AlreadyTraining

func AlreadyTraining(abilityID api.AbilityID) int

func ChatSend

func ChatSend(msg string, channel api.ActionChat_Channel)

func DebugGameData

func DebugGameData()

func DefensivePlayCheck

func DefensivePlayCheck()

func DisableDefensivePlay

func DisableDefensivePlay()

func EnableDefensivePlay

func EnableDefensivePlay()

func FindBuildingsPositions

func FindBuildingsPositions()

func FindBunkerPosition

func FindBunkerPosition(ptr point.Pointer)

func FindMainBuildingTypesPositions

func FindMainBuildingTypesPositions(startLoc point.Point) (point.Points, point.Points, point.Points)

func FindTurretPosition

func FindTurretPosition(ptr point.Pointer)

func GGCheck

func GGCheck() bool

func GetEmptyBunker

func GetEmptyBunker(ptr point.Pointer) *scl.Unit

func GetSCV

func GetSCV(ptr point.Pointer, assignGroup scl.GroupID, minHits float64) *scl.Unit

Pass assignGroup = 0 to skip group assignement

func MarkGeysersAsUnbuildable

func MarkGeysersAsUnbuildable()

Mark geysers as unbildable because somehow undiscovered geysers become buildable

func OnUnitCreated

func OnUnitCreated(unit *scl.Unit)

func ParseData

func ParseData()

func RecalcEnemyStartLoc

func RecalcEnemyStartLoc(np point.Point)

func RecoverPanic

func RecoverPanic()

func SaveGameData

func SaveGameData(gd *GameData, strategy Strategy, result string)

func Step

func Step()

OnStep is called each game step (every game update by default)

Types

type Bot

type Bot struct {
	*scl.Bot

	Logic func()

	WorkerRush     bool
	PlayDefensive  bool
	DefensiveRange float64
	BuildTurrets   bool
	VersionPosted  bool
	StrategyPosted bool
	GGPosted       bool
	PanicPosted    bool
	Strategy       Strategy
	ProxyReapers   bool
	ProxyMarines   bool
	BruteForce     bool
	CcAfterRax     bool
	CcBeforeRax    bool

	BuildPos         map[scl.BuildingSize]point.Points
	FirstBarrack     point.Points
	TurretsPos       point.Points
	TurretsMiningPos point.Points
	BunkersPos       point.Points

	DoubleHealers []scl.GroupID
	CycloneLocks  map[api.UnitTag]api.UnitTag

	Stats *GameData

	TestVal float64
}
var B *Bot

func (*Bot) ParseActionErrors

func (b *Bot) ParseActionErrors()

type GameData

type GameData struct {
	Version      string
	History      StrategyResults
	LastResult   string
	LastStrategy Strategy
}

func LoadGameData

func LoadGameData() *GameData

type Strategy

type Strategy int
const (
	Default Strategy = iota
	ProxyReapers
	ProxyMarines
	BruteForce
	CcAfterRax
	CcBeforeRax
	MaxStrategyId
)

func (Strategy) String

func (s Strategy) String() string

type StrategyResults

type StrategyResults map[Strategy]struct {
	Victories int
	Defeats   int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL