Documentation ¶
Index ¶
- Constants
- type Algo
- func (a *Algo) CaptureCellData(celluleID int, index int) (ok bool, err error)
- func (a *Algo) CaptureCellEnergy(celluleID int, index int) (ok bool, err error)
- func (a *Algo) CaptureTargetData(celluleID int, targetID string) (ok bool, err error)
- func (a *Algo) CaptureTargetEnergy(celluleID int, targetID string) (ok bool, err error)
- func (a *Algo) Delete() (ok bool, err error)
- func (a *Algo) Destroy(celluleID int, targetID string, energy int) (ok bool, res []byte, err error)
- func (a *Algo) DestroyZone(celluleID int, energy int) (ok bool, res []byte, err error)
- func (a *Algo) Equilibrium() (ok bool, err error)
- func (a *Algo) EstimateMove(secteurID string, zoneID string) (data structure.MoveEstimateData, err error)
- func (a *Algo) ExplorationStop() (ok bool, err error)
- func (a *Algo) Explore(celluleID int) (ok bool, res []byte, err error)
- func (a *Algo) GetInfosProgramme() (ok bool, err error)
- func (a *Algo) GetProgramme() (ok bool, programmes []string)
- func (a *Algo) GetStatusGrid() (err error)
- func (a *Algo) GetZoneinfos() (ok bool, zoneInfos structure.ZoneInfos)
- func (a *Algo) Move(secteurID string, zoneID string) (ok bool, err error)
- func (a *Algo) NavigationStop() (ok bool, err error)
- func (a *Algo) PrintInfo(printGrid bool)
- func (a *Algo) PushFlag() (ok bool, err error)
- func (a *Algo) Rebuild(celluleID int, targetID string, energy int) (ok bool, res []byte, err error)
- func (a *Algo) Scan() (ok bool, res []byte, err error)
- func (a *Algo) SearchEnergy(cellules []structure.CelluleInfos) (index int)
- func (a *Algo) SearchFlag(cellules []structure.CelluleInfos) (flagFound bool)
- func (a *Algo) StopMove() (ok bool, err error)
- func (a *Algo) Unset()
Constants ¶
View Source
const ( TIME_MILLISECONDE = 5000 ENERGY_MAX_ATTACK = 10 MAX_CELLULES = 9 MAX_VALEUR = 100 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Algo ¶
type Algo struct { Name string ID string Pc structure.ProgrammeContainer InfosGrid structure.GridInfos Psi structure.ProgrammeStatusInfos StatusCode int }
func (*Algo) CaptureCellData ¶
func (*Algo) CaptureCellEnergy ¶
func (*Algo) CaptureTargetData ¶
func (*Algo) CaptureTargetEnergy ¶
func (*Algo) DestroyZone ¶
func (*Algo) Equilibrium ¶
func (*Algo) EstimateMove ¶
func (*Algo) ExplorationStop ¶
func (*Algo) GetInfosProgramme ¶
func (*Algo) GetProgramme ¶
func (*Algo) GetStatusGrid ¶
func (*Algo) NavigationStop ¶
func (*Algo) SearchEnergy ¶
func (a *Algo) SearchEnergy(cellules []structure.CelluleInfos) (index int)
func (*Algo) SearchFlag ¶
func (a *Algo) SearchFlag(cellules []structure.CelluleInfos) (flagFound bool)
func (a *Algo) Attack(celluleID int, targetID string) { for j := 0; j < ENERGY_MAX_ATTACK; j++ { if ok, res, _ := a.Destroy(celluleID, targetID); !ok { jsonPretty, _ := tools.PrettyString(res) fmt.Println(jsonPretty) tools.Fail("erreur attack") return } } }
func (a *Algo) Defense(celluleID int, targetID string) { for j := 0; j < ENERGY_MAX_ATTACK; j++ { if ok, resBuild, _ := a.Rebuild(celluleID, targetID); !ok { jsonPretty, _ := tools.PrettyString(resBuild) fmt.Println(jsonPretty) tools.Fail("erreur rebuild") break } } }
func (a *Algo) CheckAttack(printInfo bool) { maxValeur := a.Psi.Programme.Level * MAX_VALEUR for _, cellule := range a.Psi.Programme.Cellules { if cellule.CurrentAccesLog.ReceiveDestroy { title := aurora.BgYellow("xxx Receveive destroy from") tools.Title(fmt.Sprintf( "\t%s >>> [%s] cellule [%d]", title, aurora.Cyan(cellule.CurrentAccesLog.PID), cellule.ID, )) } if cellule.Valeur < maxValeur && cellule.Energy > 0 { if ok, resBuild, _ := a.Rebuild(cellule.ID, a.ID); !ok { jsonPretty, _ := tools.PrettyString(resBuild) fmt.Println(jsonPretty) tools.Fail("erreur rebuild") } if cellule.CurrentAccesLog.ReceiveDestroy { if ok, res, _ := a.Destroy(cellule.ID, cellule.CurrentAccesLog.PID); !ok { jsonPretty, _ := tools.PrettyString(res) fmt.Println(jsonPretty) tools.Fail("erreur attack") } } if printInfo { a.PrintInfo(false) } } } return }
Click to show internal directories.
Click to hide internal directories.