board

package
v0.0.0-...-02e2d4b Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Board

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

func New

func New(rows, cols int) (*Board, error)

func NewFromData

func NewFromData(rows int, data *bitmap.BitMap) (*Board, error)

func (*Board) Clone

func (b *Board) Clone() *Board

func (*Board) Columns

func (b *Board) Columns() int

func (*Board) Data

func (b *Board) Data() *bitmap.BitMap

func (*Board) IsAlive

func (b *Board) IsAlive(p Point) (bool, error)

func (*Board) IsAliveNextCycle

func (b *Board) IsAliveNextCycle(p Point) (bool, error)

func (*Board) IsDead

func (b *Board) IsDead(p Point) (bool, error)

func (*Board) IsDeadNextCycle

func (b *Board) IsDeadNextCycle(p Point) (bool, error)

func (*Board) NextBoard

func (b *Board) NextBoard() (*Board, error)

func (*Board) Points

func (b *Board) Points() iter.Seq[Point]

func (*Board) Rows

func (b *Board) Rows() int

func (*Board) Set

func (b *Board) Set(p Point, isAlive bool) error

type InvalidPointError

type InvalidPointError struct {
	Rows, Columns int
	Point         Point
	Origin        error
}

func (InvalidPointError) Error

func (e InvalidPointError) Error() string

func (InvalidPointError) Unwrap

func (e InvalidPointError) Unwrap() error

type NewBoardError

type NewBoardError struct {
	Origin error
}

func (NewBoardError) Error

func (e NewBoardError) Error() string

type Point

type Point struct {
	Row, Column int
}

func (Point) GoString

func (p Point) GoString() string

func (Point) Neighbours

func (p Point) Neighbours() [8]Point

Neighbours returns the list of possible neighboring points. Some of the might be invalid in the game board.

func (Point) String

func (p Point) String() string

Jump to

Keyboard shortcuts

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