Game

package
v0.0.0-...-b3ec842 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ROWS            = 4
	COLUMNS         = 4
	CLRSCR          = "\033[H\033[2J"
	COMBINEDCHANCES = 100
	TWOSCHANCE      = 80
)

Variables

View Source
var DebugLogLevel bool
View Source
var EndGame = errors.New("GameOver")

Functions

func GetRandomElement

func GetRandomElement() (int, int)

func ReverseRow

func ReverseRow(arr []int) []int

func SlideMatrix

func SlideMatrix(elems []int) []int

Types

type Board

type Board interface {
	AddNewElementAtBoard()
	Input()
	GameScore() (int, int)
	GameShow()
	GameOver() bool
}

func CreateNewBoard

func CreateNewBoard() Board

type Direction

type Direction int
const (
	UP Direction = iota
	DOWN
	LEFT
	RIGHT
	CANCEL
)

func GetKeyboardInput

func GetKeyboardInput() (Direction, error)

Jump to

Keyboard shortcuts

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