snake

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MOVE keyboardEventType = 1 + iota
	RETRY
	END
	SPEED
)

Keyboard events

View Source
const (
	RIGHT direction = 1 + iota
	LEFT
	UP
	DOWN
)

Allowed snake movement directions

Variables

View Source
var (
	KeyboardEventsChan = make(chan KeyboardEvent)
)

Functions

This section is empty.

Types

type Game

type Game struct {
	// contains filtered or unexported fields
}

Game type

func NewGame

func NewGame() *Game

NewGame creates new Game object

func (*Game) Start

func (g *Game) Start(p state.Parameters, ch chan state.SnakeGame, statCh chan state.Stat)

Start starts the game

type KeyboardEvent

type KeyboardEvent struct {
	EventType keyboardEventType
	Key       termbox.Key
}

Jump to

Keyboard shortcuts

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