commands

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: May 31, 2022 License: AGPL-3.0 Imports: 20 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TERM_RESET = "\033[0m"

	TERM_BG_GRAY  = "\033[48;2;127;127;127m"
	TERM_BG_WHITE = "\033[107m"

	TERM_FG_GRAY      = "\033[38;2;127;127;127m"
	TERM_FG_LIGHTGRAY = "\033[38;2;200;200;200m"
	TERM_FG_FOOD      = "\033[38;2;255;92;117m"
	TERM_FG_RGB       = "\033[38;2;%d;%d;%dm"
)

ANSI escape codes to be used in the color output of the board view

Variables

This section is empty.

Functions

func Execute

func Execute()

func NewPlayCommand added in v1.1.4

func NewPlayCommand() *cobra.Command

Types

type GameExporter added in v1.0.24

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

func (*GameExporter) AddSnakeRequest added in v1.0.24

func (ge *GameExporter) AddSnakeRequest(snakeRequest client.SnakeRequest)

func (*GameExporter) ConvertToJSON added in v1.0.24

func (ge *GameExporter) ConvertToJSON() ([]string, error)

func (*GameExporter) FlushToFile added in v1.0.24

func (ge *GameExporter) FlushToFile(filepath string, format string) error

type GameState added in v1.1.4

type GameState struct {
	// Options
	Width               int
	Height              int
	Names               []string
	URLs                []string
	Timeout             int
	TurnDuration        int
	Sequential          bool
	GameType            string
	MapName             string
	ViewMap             bool
	UseColor            bool
	Seed                int64
	TurnDelay           int
	DebugRequests       bool
	Output              string
	FoodSpawnChance     int
	MinimumFood         int
	HazardDamagePerTurn int
	ShrinkEveryNTurns   int
	// contains filtered or unexported fields
}

func (*GameState) Run added in v1.1.4

func (gameState *GameState) Run()

Setup and run a full game.

type SnakeState added in v1.0.23

type SnakeState struct {
	URL       string
	Name      string
	ID        string
	LastMove  string
	Character rune
	Color     string
	Head      string
	Tail      string
}

Used to store state for each SnakeState while running a local game

Jump to

Keyboard shortcuts

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