domain

package
v0.0.0-...-7787783 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Up    = baseDirections[0]
	Left  = baseDirections[1]
	Down  = baseDirections[2]
	Right = baseDirections[3]
)

Functions

This section is empty.

Types

type BaseDirection

type BaseDirection struct {
	Dir  Pair
	Name string
}

func ParseBaseDirection

func ParseBaseDirection(str string) (BaseDirection, bool)

type Cell

type Cell struct {
	ID   ObjectID
	Food int
}

type CellType

type CellType string
var (
	FreeCell   CellType = "free"
	FoodCell   CellType = "food"
	PlayerCell CellType = "player"
	BlockCell  CellType = "block"
)

type CellWithLocation

type CellWithLocation struct {
	Location Pair
	Cell     *Cell
}

type Color

type Color string
var (
	ClearColor   Color = "#FFFFFF"
	BlockColor   Color = "#000000"
	RandomColors       = []Color{"#4183D7", "#446CB3", "#59ABE3", "#1F3A93", "#D64541", "#CF000F", "#EF4836", "#DB0A5B",
		"#D2527F", "#9A12B3", "#8E44AD", "#1BBC9B", "#26A65B", "#03C9A9", "#019875", "#1E824C", "#F7CA18", "#F89406",
		"#E87E04", "#F9690E", "#F9BF3B"}
)

func GenerateColor

func GenerateColor() Color

type FieldSize

type FieldSize struct {
	SizeX int
	SizeY int
}

func (FieldSize) Fit

func (f FieldSize) Fit(loc Pair) Pair

func (FieldSize) IsInside

func (f FieldSize) IsInside(loc Pair) bool

func (FieldSize) Move

func (f FieldSize) Move(loc, dir Pair) Pair

type ObjectID

type ObjectID string

ObjectID represents id of an object inside a cell.

type Pair

type Pair struct {
	X int
	Y int
}

func (Pair) Add

func (a Pair) Add(b Pair) Pair

func (Pair) Negate

func (a Pair) Negate() Pair

func (Pair) Sub

func (a Pair) Sub(b Pair) Pair

Jump to

Keyboard shortcuts

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