core

package
v0.0.0-...-ce9d6f3 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2021 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EqualCoord

func EqualCoord(a, b Coord) bool

Types

type Coord

type Coord struct {
	X, Y int
}

type Direction

type Direction int
const (
	Up Direction = iota
	Right
	Down
	Left
)

type FoodEaten

type FoodEaten struct {
	FoodID int
}

type GameOver

type GameOver struct {
	Successful bool // did game finish without errors or not
	Winner     int  // SnakeID of winner player
}

type NewFood

type NewFood struct {
	FoodID int
	Pos    Coord
}

type PeerError

type PeerError struct {
	Peer peer.ID
	Err  error
}

func (*PeerError) Error

func (e *PeerError) Error() string

func (*PeerError) Unwrap

func (e *PeerError) Unwrap() error

type PlayerDied

type PlayerDied struct {
	SnakeID peer.ID // SnakeID of player who died
}

type PlayerMoves

type PlayerMoves struct {
	Moves map[peer.ID]Direction // map from player's SnakeID to direction of it's move
}

type PlayerStarts

type PlayerStarts struct {
	Players map[peer.ID]Coord // map from player's SnakeID to its start coordinates
}

type PushSegment

type PushSegment struct {
	SnakeID peer.ID
	Pos     Coord // coordinates of a cell to add to a snake
}

type Tick

type Tick struct{}

Jump to

Keyboard shortcuts

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