snakes

package
v0.0.0-...-bf9d846 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Nothing   = 1
	Risky     = 7
	SnakeBody = 9
	Edge      = 40
)

Tile cost constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Erratic

type Erratic struct{}

Erratic is a particularly terrible AI.

func (Erratic) End

End ends a game.

func (Erratic) Move

Move twitches around.

func (Erratic) Ping

func (Erratic) Ping() (*api.PingResponse, error)

func (Erratic) Start

func (Erratic) Start(ctx context.Context, gs api.SnakeRequest) error

Start starts a game.

type Garen

type Garen struct{}

Garen spins to win.

func (Garen) End

func (Garen) End(ctx context.Context, sr api.SnakeRequest) error

End ends a game.

func (Garen) Move

Move spins to win.

func (Garen) Ping

func (Garen) Ping() (*api.PingResponse, error)

func (Garen) Start

func (Garen) Start(ctx context.Context, sr api.SnakeRequest) error

Start kicks off a game.

type Greedy

type Greedy struct{}

Greedy is a greedy snake AI. It will try to get as long as it can as fast as it can.

func (Greedy) End

func (Greedy) End(ctx context.Context, sr api.SnakeRequest) error

End ends a game.

func (Greedy) Move

func (g Greedy) Move(ctx context.Context, decoded api.SnakeRequest) (*api.MoveResponse, error)

Move responds with the snake's movements for a given Turn.

func (Greedy) Ping

func (Greedy) Ping() (*api.PingResponse, error)

func (Greedy) Start

func (Greedy) Start(ctx context.Context, gs api.SnakeRequest) error

Start starts a game.

type Pyra

type Pyra struct {
	MinLength int
	// contains filtered or unexported fields
}

Pyra is a slightly smarter version of Greedy.

Struct memebers are configuration flags for the snake behavior.

func (*Pyra) End

func (p *Pyra) End(ctx context.Context, sr api.SnakeRequest) error

End ends a game.

func (*Pyra) Move

func (p *Pyra) Move(ctx context.Context, decoded api.SnakeRequest) (*api.MoveResponse, error)

Move responds with the snake's movements for a given Turn.

func (Pyra) Ping

func (Pyra) Ping() (*api.PingResponse, error)

func (*Pyra) Start

func (p *Pyra) Start(ctx context.Context, gs api.SnakeRequest) error

Start starts a game.

type SpaceContents

type SpaceContents int

SpaceContents is the contents of a single space on the map.

type Sunset

type Sunset struct{}

Sunset is a snake AI based off of the rantings of Ahroo in Discord DM.

func (Sunset) End

func (Sunset) End(ctx context.Context, sr api.SnakeRequest) error

End ends a game.

func (Sunset) Move

func (Sunset) Move(ctx context.Context, decoded api.SnakeRequest) (*api.MoveResponse, error)

Move selects a target and goes for it.

func (Sunset) Ping

func (Sunset) Ping() (*api.PingResponse, error)

func (Sunset) Start

func (Sunset) Start(ctx context.Context, sr api.SnakeRequest) error

Start kicks off a game.

Jump to

Keyboard shortcuts

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