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

v0 source realm

Package pixelcanvas is a shared 16x16 pixel canvas: anyone can paint one cell at a time from a fixed 9-colour palette...

Readme View source

Pixel Canvas

⚠️ Experimental — generated with no human supervision by the daily MCP pipeline to exercise gno tooling. Not audited. See r/moul/x/daily.


A shared 16x16 canvas. Anyone can paint one cell at a time from a fixed 9-colour palette, and the board renders in gnoweb as a grid of coloured blocks.

Painting is last-write-wins — that's the point of a shared canvas. Both strokes still count toward the painter tallies, so overwriting someone doesn't erase their contribution from the leaderboard.

Paint(x, y, colour)   → colours a cell, returns the total stroke count
At(x, y)              → the colour name of a cell ("white" when untouched)
PainterAt(x, y)       → who last painted it ("" when untouched)
Strokes()             → total paints ever
Palette()             → the accepted colour names

/r/moul/x/daily/pixelcanvas/v0        → the canvas, palette and top painters
/r/moul/x/daily/pixelcanvas/v0:4,9    → who painted that cell, and what colour

Coordinates are 0-based with (0,0) at the top-left, and are x (column) then y (row) — so (3,7) is column 3 of row 7. Colour names are matched case- and space-insensitively.

Palette: white, red, orange, yellow, green, blue, purple, brown, black.

The grid is a fixed [Size*Size]int of palette indices rather than a tree: every cell exists from the start and the whole grid is walked on each render, so an array is both simpler and cheaper than a sparse structure.

Only an EOA can paint (IsUserCall), so another realm can't spray the canvas on a user's behalf.

Built for gno 0.9. Live on both testnets (agent address):

  • sapphire — https://sapphire.testnets.gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/pixelcanvas
  • pearl — https://pearl.testnets.gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/pixelcanvas

Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.

Dependency graph:

gno.land/r/moul/x/daily/pixelcanvas/v0 dependency graph

🧪 Highly experimental — potentially vibe-coded. Not audited; may break, change, or be removed at any time. Do not use with anything of value. Full disclaimer: DISCLAIMER.

Overview

Package pixelcanvas is a shared 16x16 pixel canvas: anyone can paint one cell at a time from a fixed 9-colour palette, and the canvas renders in gnoweb as a grid of coloured blocks.

The canvas is a flat [Size*Size]int of palette indices held in realm state — a fixed-size array rather than a tree, because every cell exists from the start and the grid is walked in full on every render. Painting is last-write-wins; the realm keeps who painted each cell and a per-address tally, so the board doubles as a contribution leaderboard.

A stateful app with nothing reusable to extract, so it ships as a lone realm rather than a p/ library + demo pair.

Constants 1

const Size

1const Size = 16
source

Size is the canvas edge length; the canvas is Size x Size cells.

Functions 6

func At

Action
1func At(x, y int) string
source

At returns the palette name of the cell at (x, y), or "" when out of bounds.

func Paint

crossing Action
1func Paint(cur realm, x, y int, colour string) int
source

Paint colours the cell at (x, y) and returns the total number of strokes.

Coordinates are 0-based with (0,0) at the top-left. Colour is a palette name ("red", "blue", …) — see Palette. Painting over an existing cell is allowed: the canvas is last-write-wins, which is the whole point of a shared board.

func PainterAt

Action
1func PainterAt(x, y int) string
source

PainterAt returns the address that last painted (x, y), or "" if untouched.

func Palette

Action
1func Palette() string
source

Palette returns the accepted colour names, comma-separated.

func Render

1func Render(path string) string
source

Render renders the canvas for gnoweb.

Example
1Render("")        / Render("/") -> the canvas, palette and leaderboard
2Render("/<x>,<y>")              -> who painted that cell, and what colour

Imports 6

Source Files 3