game

package
v0.0.0-...-f923df5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Settings

type Settings struct {
	// The countdown before the game begins.
	ReadyTime time.Duration

	// The game time.
	GameTime time.Duration
}

type Tokener

type Tokener interface {
	Line(length int) []string
}

type TypoGame

type TypoGame struct {
	Settings
	// contains filtered or unexported fields
}

func NewTypoGame

func NewTypoGame(tokener Tokener, settings Settings) *TypoGame

func (*TypoGame) Highlight

func (g *TypoGame) Highlight(bv *gocui.View)

func (*TypoGame) Move

func (g *TypoGame) Move() bool

Moves to the next token. If it returns true NewTokens should be called.

func (*TypoGame) NewTokens

func (g *TypoGame) NewTokens(bv *gocui.View)

func (*TypoGame) Paint

func (g *TypoGame) Paint(bv *gocui.View, token string)

func (*TypoGame) ShowResult

func (g *TypoGame) ShowResult(ev *gocui.View)

func (*TypoGame) Test

func (g *TypoGame) Test(input string)

Tests user input against current token.

type WordTokener

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

func NewWordTokener

func NewWordTokener(wordList []string) *WordTokener

Returns a reference to a new WordTokener User must supply some words of length one and two so that Line method could return a complete line

func (*WordTokener) Line

func (t *WordTokener) Line(length int) []string

Jump to

Keyboard shortcuts

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