utils

package
v0.0.0-...-a3ece0b Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitGrid

func InitGrid(Width int, Height int, CellSize int) [][]*Cell

Make a new blank grid

Types

type Cell

type Cell struct {
	Alive    bool
	Position Vec2
	Color    color.RGBA
}

type Game

type Game struct {
	Width        int
	Height       int
	CellSize     int
	InitCellSize int
	Grid         Grid
	NextGrid     Grid
}

func (*Game) Draw

func (g *Game) Draw()

func (*Game) GetCell

func (g *Game) GetCell(x, y int) *Cell

func (*Game) GetNeighbor

func (g *Game) GetNeighbor(c *Cell, x int, y int) *Cell

func (*Game) GetNumberAliveNeighbors

func (g *Game) GetNumberAliveNeighbors(c *Cell) int

func (*Game) Next

func (g *Game) Next(x, y int) bool

What to do in the next iteration with cell x, y?

func (*Game) Update

func (g *Game) Update()

Next iteration of the world

type Grid

type Grid struct {
	Width  int
	Height int
	Cells  [][]*Cell
}

type Vec2

type Vec2 struct {
	X, Y int
}

func NewVec2

func NewVec2(x, y int) Vec2

Jump to

Keyboard shortcuts

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