commands

package
v1.0.18-0...-db82f67 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2021 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

Types

type Battlesnake

type Battlesnake struct {
	URL       string
	Name      string
	ID        string
	API       string
	LastMove  string
	Squad     string
	Character rune
}

type BoardResponse

type BoardResponse struct {
	Height  int32           `json:"height"`
	Width   int32           `json:"width"`
	Food    []Coord         `json:"food"`
	Hazards []Coord         `json:"hazards"`
	Snakes  []SnakeResponse `json:"snakes"`
}

type Coord

type Coord struct {
	X int32 `json:"x"`
	Y int32 `json:"y"`
}

type GameResponse

type GameResponse struct {
	Id      string `json:"id"`
	Timeout int32  `json:"timeout"`
}

type InfoResponse

type InfoResponse struct {
	Author string      `json:"author"`
	Color  string      `json:"color"`
	Head   string      `json:"head"`
	Tail   string      `json:"tail"`
	Meta   interface{} `json:"meta"`
}

type Options

type Options struct {
	GameId       string
	Turn         int32
	Battlesnakes map[string]Battlesnake
	HttpClient   http.Client
	Width        int32
	Height       int32
	Names        []string
	URLs         []string
	Squads       []string
	Timeout      int32
	Sequential   bool
	GameType     string
	ViewMap      bool
	Seed         int64
	Log          func(string, ...interface{})
}

type PingResponse

type PingResponse struct {
	APIVersion string `json:"apiversion"`
	Author     string `json:"author"`
	Color      string `json:"color"`
	Head       string `json:"head"`
	Tail       string `json:"tail"`
	Version    string `json:"version"`
}

type PlayerResponse

type PlayerResponse struct {
	Move  string `json:"move"`
	Shout string `json:"shout"`
}

type ResponsePayload

type ResponsePayload struct {
	Game  GameResponse  `json:"game"`
	Turn  int32         `json:"turn"`
	Board BoardResponse `json:"board"`
	You   SnakeResponse `json:"you"`
}

type Result

type Result struct {
	Turn   int32
	Winner string
	Board  *rules.BoardState
	Infos  map[string]InfoResponse
}

func Run

func Run(o *Options) Result

type SnakeResponse

type SnakeResponse struct {
	Id      string  `json:"id"`
	Name    string  `json:"name"`
	Health  int32   `json:"health"`
	Body    []Coord `json:"body"`
	Latency string  `json:"latency"`
	Head    Coord   `json:"head"`
	Length  int32   `json:"length"`
	Shout   string  `json:"shout"`
	Squad   string  `json:"squad"`
}

Jump to

Keyboard shortcuts

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