gameoflife

package
v0.0.0-...-b39ae20 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// The game screen size (in pixels)
	ScreenDimension int = 600
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Board

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

The game board

func NewBoard

func NewBoard(dimension int, scale int, initialStateProbability float32) (*Board, error)

NewBoard generates a new Board with giving a size.

func (*Board) Draw

func (b *Board) Draw(boardImage *ebiten.Image)

Draw draws the board to the given boardImage.

func (*Board) Update

func (b *Board) Update() error

Update updates the board state.

type Cell

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

Cell represents a cell on the board in the game of life

func (*Cell) Draw

func (c *Cell) Draw(boardImage *ebiten.Image, scale int)

Draws a cell given its current state

type Game

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

Game represents a game state.

func NewGame

func NewGame() (*Game, error)

NewGame generates a new Game object.

func (*Game) Draw

func (g *Game) Draw(screen *ebiten.Image)

Draws the current game state to the given screen.

func (*Game) Layout

func (g *Game) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int)

Layout implements ebiten.Game's Layout.

func (*Game) Update

func (g *Game) Update(*ebiten.Image) error

Updates the current game state.

Jump to

Keyboard shortcuts

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