Documentation
¶
Index ¶
Constants ¶
View Source
const ( Initializing = iota InProgress Ended )
Variables ¶
View Source
var ( ErrInProgress = errors.New("game is already in progress") ErrMaxPlayers = errors.New("cannot add more than 4 players") )
Functions ¶
Types ¶
type ChangeDirection ¶
type Coordinate ¶
type Field ¶
type Field struct {
ID string
Height, Width int
Needed int //number of players needed to start the game
Gophers []*Gopher
Board [][]bool
Change chan ChangeDirection
Remove chan int
State int
// contains filtered or unexported fields
}
func (*Field) PreGameRemove ¶
To be used when the game hasn't started yet
func (*Field) PrintBoard ¶
func (f *Field) PrintBoard()
type Gopher ¶
type Gopher struct {
// Current direction
Direction Direction
X, Y int
Path []Coordinate
Score int
Paths chan map[string]GopherInfo
Notify chan string
Close chan bool
}
type GopherInfo ¶
type GopherInfo struct {
Coordinate []Coordinate `json:"coordinate"`
Color string `json:"color"`
}
Click to show internal directories.
Click to hide internal directories.