package
Version:
v0.1.0
Opens a new window with list of versions in this module.
Published: Jul 5, 2025
License: MIT
Opens a new window with license information.
Imports: 0
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
type Cell struct {
Alive bool
Value int
}
Cell represents a single cell in the grid
type Grid struct {
Width int
Height int
Cells [][]Cell
}
Grid represents the cellular automaton grid
func NewGrid(width, height int) *Grid
NewGrid creates a new grid with the specified dimensions
Clear resets all cells to empty
Copy creates a deep copy of the grid
CountLiveNeighbors counts the number of live neighbors for a cell
Get returns the cell at the specified coords
IsAlive checks if the cell at the specified coords is alive
Set sets the cell at the specified coords
SetAlive sets the alive status of the cell at the specified coords
String returns a string representation of the grid
Source Files
¶
Click to show internal directories.
Click to hide internal directories.