engine

package
v0.0.0-...-e8051b5 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("resource not found")

Functions

This section is empty.

Types

type Death

type Death struct {
	Cause string `json:"Cause"`
	Turn  int    `json:"Turn"`
}

type Game

type Game struct {
	ID     string `json:"ID"`
	Status string `json:"Status"`
	Width  int    `json:"Width"`
	Height int    `json:"Height"`
}

func GetGame

func GetGame(gameID, host string) (*Game, error)

GetGame is commented

type GameFrame

type GameFrame struct {
	Turn    int     `json:"Turn"`
	Food    []Point `json:"Food"`
	Snakes  []Snake `json:"Snakes"`
	Hazards []Point `json:"Hazards"`
}

func GetGameFrame

func GetGameFrame(gameID, host string, frameNum int) (*GameFrame, error)

GetGameFrame is commented

func GetGameFrames

func GetGameFrames(gameID, host string, offset int, limit int) ([]*GameFrame, error)

GetGameFrames is commented

type Point

type Point struct {
	X int `json:"X"`
	Y int `json:"Y"`
}

type Snake

type Snake struct {
	ID     string  `json:"ID"`
	Name   string  `json:"Name"`
	Body   []Point `json:"Body"`
	Health int     `json:"Health"`

	Death *Death `json:"Death"`

	Color string `json:"Color"`    // Hex Code
	Head  string `json:"HeadType"` // https://github.com/BattlesnakeOfficial/board/tree/master/public/images/snake/head
	Tail  string `json:"TailType"` // https://github.com/BattlesnakeOfficial/board/tree/master/public/images/snake/tail
}

Jump to

Keyboard shortcuts

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