game

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidSeed = errors.New("seed: seed is invalid")

Functions

This section is empty.

Types

type Coordinate

type Coordinate struct {
	X, Y int
}

func (Coordinate) Neighbors

func (c Coordinate) Neighbors(w, h int) iter.Seq[Coordinate]

func (Coordinate) Valid

func (c Coordinate) Valid(w, h int) bool

type Game

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

func New

func New(w, h int, init ...Initializer) *Game

func (*Game) Iteration added in v0.2.0

func (g *Game) Iteration() int

Iteration returns the current iteration of the game

func (*Game) Seed added in v0.2.0

func (g *Game) Seed() Seed

Seed returns the seed used to generate the game

func (*Game) String

func (g *Game) String() string

func (*Game) Update

func (g *Game) Update() int

Update updates the Game by computing its next state and returns the current cycle length

type Initializer

type Initializer func(w, h int) (map[Coordinate]struct{}, []uint64, Seed)

func Randomized

func Randomized() Initializer

func WithSeed

func WithSeed(seed Seed) Initializer

type Seed

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

func ParseSeed

func ParseSeed(s string) (seed Seed, err error)

func (Seed) String

func (s Seed) String() string

Jump to

Keyboard shortcuts

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