Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

life/v0 package

Overview

Conway's Game of Life on Gno — the entire board lives on-chain. Anyone can call Step() to tick the simulation forward, load classic patterns, or sculpt cells one by one.

Functions

LoadPreset

func LoadPreset(name string)

LoadPreset loads a classic Game of Life pattern onto the current board. Names: glider, blinker, toad, beacon, block, pulsar.

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/moul/x/daily/life/v0.LoadPreset()"

Result

MultiStep

func MultiStep(n int)

MultiStep advances the simulation by n generations (capped at 100).

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/moul/x/daily/life/v0.MultiStep()"

Result

Render

func Render(path string) string

Render returns a Markdown snapshot of the current board.

Param

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/moul/x/daily/life/v0.Render()"

Result

Reset

func Reset(w, h int)

Reset clears the board and resizes it to w×h.

Params

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/moul/x/daily/life/v0.Reset(,)"

Result

SetCell

func SetCell(x, y int, live bool)

SetCell sets or clears a specific cell.

Params

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/moul/x/daily/life/v0.SetCell(,,)"

Result

Step

func Step()

Step advances the simulation by exactly one generation.

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/moul/x/daily/life/v0.Step()"

Result