Documentation
¶
Overview ¶
This file uses material from the Wikipedia article <a href="https://en.wikipedia.org/wiki/List_of_snakes_by_common_name">"List of snakes by common name"</a>, which is released under the <a href="https://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share-Alike License 3.0</a>.
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 GenerateSnakeName ¶ added in v1.1.18
func GenerateSnakeName() string
Generate a random unique snake name, or return a UUID if there are no more names available.
func NewMapCommand ¶ added in v1.1.15
func NewMapInfoCommand ¶ added in v1.1.15
func NewMapListCommand ¶ added in v1.1.15
func NewPlayCommand ¶ added in v1.1.4
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(outputFile io.Writer) (int, 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
OutputPath string
ViewInBrowser bool
BoardURL string
FoodSpawnChance int
MinimumFood int
HazardDamagePerTurn int
ShrinkEveryNTurns int
// contains filtered or unexported fields
}
func (*GameState) Initialize ¶ added in v1.2.0
Setup a GameState once all the fields have been parsed from the command-line.
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
Author string
Version string
Error error
StatusCode int
Latency time.Duration
}
Used to store state for each SnakeState while running a local game
Click to show internal directories.
Click to hide internal directories.