objects

package
v0.0.0-...-aabedf8 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Board

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

func CreateBoard

func CreateBoard(height, width int, emtpyCellSymbol string) Board

CreateBoard creates a 2d array used to display the field of the snake game

func (*Board) Render

func (board *Board) Render(objects ...renderableOnBoard)

type Food

type Food struct {
	Symbol string
	// contains filtered or unexported fields
}

func CreateFood

func CreateFood(x, y int, foodSymbol string) Food

type Snake

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

func CreateSnake

func CreateSnake(headSymbol string, bodySymbol string, x, y int, movement string) Snake

func (*Snake) GetSnakeLength

func (snake *Snake) GetSnakeLength() int

func (*Snake) Move

func (snake *Snake) Move(board *Board, food *Food) bool

Move returns true if the move made was valid, false otherwise

func (*Snake) SetDirection

func (snake *Snake) SetDirection(direction string)

Jump to

Keyboard shortcuts

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