Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeSnakeRequest ¶
func DecodeSnakeRequest(req *http.Request, decoded *SnakeRequest) error
Types ¶
type AI ¶
type AI interface { Ping() (*PingResponse, error) Start(ctx context.Context, sr SnakeRequest) error Move(ctx context.Context, sr SnakeRequest) (*MoveResponse, error) End(ctx context.Context, sr SnakeRequest) error }
AI is an individual snake AI.
type Board ¶
type Board struct { Height int `json:"height"` Width int `json:"width"` Food []Coord `json:"food"` Snakes []Snake `json:"snakes"` }
Board is the game board.
func (Board) DeadlyAdjacent ¶
DeadlyAdjacent returns all of the adjacent deadly coordinates from this one.
type Coord ¶
Coord is an X,Y coordinate pair.
type MoveResponse ¶
type MoveResponse struct {
Move string `json:"move"`
}
func (MoveResponse) F ¶
func (m MoveResponse) F() ln.F
type PingResponse ¶
type PingResponse struct { APIVersion string `json:"apiversion,omitempty"` Color string `json:"color,omitempty"` HeadType string `json:"head,omitempty"` TailType string `json:"tail,omitempty"` }
func (PingResponse) F ¶
func (s PingResponse) F() ln.F
Click to show internal directories.
Click to hide internal directories.