game

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Map0 = `` /* 399-byte string literal not displayed */

	Map1 = `` /* 359-byte string literal not displayed */

	Map2 = `` /* 195-byte string literal not displayed */

	Map3 = `` /* 539-byte string literal not displayed */

	Map4 = `` /* 1159-byte string literal not displayed */

	Map5 = `` /* 390-byte string literal not displayed */

	Map6 = `` /* 791-byte string literal not displayed */

	Map7 = `` /* 272-byte string literal not displayed */

	Map8 = `` /* 1103-byte string literal not displayed */

	Map9 = `` /* 151-byte string literal not displayed */

)

Variables

View Source
var (
	GlobMaze Maze
	Player   *Avatar
	Ghost1   *Ghost

	MoveOrNot bool

	WonGame     int // 0-init, -1-lost, 1-win
	TotalPoints int
)
View Source
var MapIndex map[int]string

Functions

func CanMove

func CanMove() bool

func CharAt

func CharAt(a, b int) rune

func GetPlayerPosition

func GetPlayerPosition() (int, int)

func InitGame added in v0.0.6

func InitGame()

func IsValid

func IsValid(a, b int) bool

func WriteAt

func WriteAt(a, b int, curChar rune)

func WriteAtWithColor

func WriteAtWithColor(a, b int, curChar rune, color int)

Types

type Avatar

type Avatar struct {
	X           int
	Y           int
	LetterUnder rune
	ColorUnder  int
	IsPlayer    bool
	Points      int
	Portrait    rune
	Lives       int64
	Color       int
}

func Born

func Born() *Avatar

func (*Avatar) MoveDown

func (t *Avatar) MoveDown() bool

func (*Avatar) MoveLeft

func (t *Avatar) MoveLeft() bool

func (*Avatar) MoveRight

func (t *Avatar) MoveRight() bool

func (*Avatar) MoveTo

func (t *Avatar) MoveTo(a, b int) bool

func (*Avatar) MoveUp

func (t *Avatar) MoveUp() bool

func (*Avatar) ParseToBeginning added in v0.0.3

func (t *Avatar) ParseToBeginning() bool

ParseToBeginning for 0

func (*Avatar) ParseToDowning added in v0.0.4

func (t *Avatar) ParseToDowning() bool

func (*Avatar) ParseToEnd added in v0.0.3

func (t *Avatar) ParseToEnd() bool

ParseToEnd for $

func (*Avatar) ParseToUpping added in v0.0.4

func (t *Avatar) ParseToUpping() bool

func (*Avatar) ParseWordBackward added in v0.0.3

func (t *Avatar) ParseWordBackward() bool

ParseWordBackward for b

func (*Avatar) ParseWordEnd added in v0.0.3

func (t *Avatar) ParseWordEnd() bool

ParseWordEnd for e

func (*Avatar) ParseWordForward added in v0.0.3

func (t *Avatar) ParseWordForward() bool

ParseWordForward for w

type Cell added in v0.0.5

type Cell struct {
	Char  rune
	Color int
	Point int
}

type Ghost

type Ghost struct {
	Avatar
	CanMove bool
}

func SpawnGhost

func SpawnGhost() *Ghost

func (*Ghost) Think

func (g *Ghost) Think()

type Maze

type Maze struct {
	Graph [][]*Cell
	// contains filtered or unexported fields
}

func (*Maze) InitMaze added in v0.0.5

func (m *Maze) InitMaze(str string)

Jump to

Keyboard shortcuts

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