Search Apps Documentation Source Content File Folder Download Copy Actions Download

life 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 "https://rpc.test13.testnets.gno.land" -data "gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/life.LoadPreset()"

Result

MultiStep

func MultiStep(n int)

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

Param

Command

gnokey query vm/qeval -remote "https://rpc.test13.testnets.gno.land" -data "gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/life.MultiStep()"

Result

Render

func Render(path string) string

Render returns a Markdown snapshot of the current board.

Param

Command

gnokey query vm/qeval -remote "https://rpc.test13.testnets.gno.land" -data "gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/life.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 "https://rpc.test13.testnets.gno.land" -data "gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/life.Reset(,)"

Result

SetCell

func SetCell(x, y int, live bool)

SetCell sets or clears a specific cell.

Params

Command

gnokey query vm/qeval -remote "https://rpc.test13.testnets.gno.land" -data "gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/life.SetCell(,,)"

Result

Step

func Step()

Step advances the simulation by exactly one generation.

Command

gnokey query vm/qeval -remote "https://rpc.test13.testnets.gno.land" -data "gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/life.Step()"

Result