grid

package
v0.0.0-...-a0226e0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cell

type Cell struct {
	Alive bool
	// Color in RGBA
	InnerColor, OuterColor [4]int
	// Postion of the cell within the grid
	X, Y int
}

A Cell

type Grid

type Grid struct {
	Cells []Cell
	X     int
	Y     int
	Step  int
	// contains filtered or unexported fields
}

Grid represent a grid of cells

func NewGrid

func NewGrid(cfg GridConfiguration) *Grid

Return a new grid

func (Grid) CellNeighBoors

func (g Grid) CellNeighBoors(idx int) (nidx []int)

Return a list of index of my neighbors

func (Grid) Draw

func (g Grid) Draw() image.Image

Draw everything

type GridConfiguration

type GridConfiguration struct {
	Palete            [][3]int
	BackGroundColor   [3]int
	X                 int
	Y                 int
	InnerDistribution int
	OuterDistribution int
	CellDistribution  int
	Step              int
}

gridConfiguration is the configuration set by flags

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳