model

package
v0.0.0-...-1458061 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Left = 1 + iota
	Right
	Up
	Down
)
View Source
const (
	HELP     = "\n\nuse arrow keys, wasd or hjkl to move the snake.\n"
	GAMEOVER = "\n\nGAME OVER\n"
	QUIT     = "press 'q' or 'ctrl + c' to quit.\n"
)
View Source
const INTERVAL = 100

Variables

This section is empty.

Functions

func RenderArena

func RenderArena(m *Model)

func RenderFood

func RenderFood(m *Model)

func RenderGameOver

func RenderGameOver() string

func RenderHelp

func RenderHelp(h string) string

func RenderQuitcommand

func RenderQuitcommand() string

func RenderScore

func RenderScore(score int) string

func RenderSnake

func RenderSnake(m *Model)

func RenderTitle

func RenderTitle() string

Types

type Model

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

func InitialModel

func InitialModel() Model

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Model) View

func (m Model) View() string

type TickMsg

type TickMsg time.Time

Jump to

Keyboard shortcuts

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