Documentation ¶
Index ¶
- type Apple
- type Corpse
- type Snake
- func (s *Snake) Command(cmd string) error
- func (s *Snake) Die()
- func (s *Snake) Dot(i uint16) *playground.Dot
- func (s *Snake) DotCount() uint16
- func (s *Snake) Feed(f int8)
- func (s *Snake) Pack() string
- func (s *Snake) PackChanges() string
- func (s *Snake) Strength() float32
- func (s *Snake) Updated() time.Time
- type Wall
- type Watermelon
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Apple ¶
type Apple struct {
// contains filtered or unexported fields
}
func CreateApple ¶
func CreateApple(pg *playground.Playground) (*Apple, error)
CreateApple creates and locates new apple
func (*Apple) Dot ¶
func (a *Apple) Dot(i uint16) *playground.Dot
Implementing playground.Object interface
func (*Apple) NutritionalValue ¶
func (a *Apple) NutritionalValue(dot *playground.Dot) int8
Implementing logic.Food interface
type Corpse ¶
type Corpse struct {
// contains filtered or unexported fields
}
Snakes can eat corpses
func CreateCorpse ¶
func CreateCorpse(pg *playground.Playground, cxt context.Context, dots playground.DotList) (*Corpse, error)
Corpses are created when a snake dies
func (*Corpse) Dot ¶
func (c *Corpse) Dot(i uint16) *playground.Dot
Implementing playground.Object interface
func (*Corpse) NutritionalValue ¶
func (c *Corpse) NutritionalValue(dot *playground.Dot) int8
Implementing logic.Food interface
func (*Corpse) PackChanges ¶
Implementing playground.Shifting interface
type Snake ¶
type Snake struct {
// contains filtered or unexported fields
}
Snake object
func CreateSnake ¶
func CreateSnake(pg *playground.Playground, cxt context.Context, ) (*Snake, error)
CreateSnake creates new snake
func (*Snake) Dot ¶
func (s *Snake) Dot(i uint16) *playground.Dot
Implementing playground.Object interface
func (*Snake) PackChanges ¶
Implementing playground.Shifting interface
type Wall ¶
type Wall playground.DotList
func CreateLongWall ¶
func CreateLongWall(pg *playground.Playground) (Wall, error)
func CreateWall ¶
func CreateWall(pg *playground.Playground, dots playground.DotList, ) (Wall, error)
type Watermelon ¶
type Watermelon struct {
// contains filtered or unexported fields
}
func CreateWatermelon ¶
func CreateWatermelon(pg *playground.Playground, cxt context.Context, ) (*Watermelon, error)
func (*Watermelon) Dot ¶
func (w *Watermelon) Dot(i uint16) (dot *playground.Dot)
Implementing playground.Object interface
func (*Watermelon) DotCount ¶
func (w *Watermelon) DotCount() (c uint16)
Implementing playground.Object interface
func (*Watermelon) NutritionalValue ¶
func (w *Watermelon) NutritionalValue(dot *playground.Dot) int8
Implementing logic.Food interface
func (*Watermelon) Pack ¶
func (w *Watermelon) Pack() (res string)
Implementing playground.Object interface
func (*Watermelon) PackChanges ¶
func (w *Watermelon) PackChanges() string
Implementing playground.Shifting interface
func (*Watermelon) Updated ¶
func (w *Watermelon) Updated() time.Time
Implementing playground.Shifting interface