Size
untyped bigintSize is the canvas edge length; the canvas is Size x Size cells.
Value
(16 <untyped> bigint)
palette
[]stringpalette maps a colour index to the block rendered for it. Index 0 is the blank canvas. Kept parallel to paletteNames.
- OID
- 09a813…f098:4
palette details
paletteNames
[]stringpaletteNames are the names Paint accepts, in palette order.
- OID
- 09a813…f098:6
paletteNames details
cells
[256]int// palette index per cell, row-major
- OID
- 09a813…f098:8
cells details
painters
[256]stringPackage-level persistent state.
- OID
- 09a813…f098:10
painters details
tally
*v0.Tree// address string -> \*int paint count
- OID
- 09a813…f098:12
tally details
strokes
int// total paints ever
Value
0
lastAt
int64// height of the most recent paint
Value
0
Paint
func(x int, y int, colour string) intPaint 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.
- OID
- 09a813…f098:16
Paint details
colourIndex
func(name string) intcolourIndex resolves a palette name to its index, or -1.
- OID
- 09a813…f098:18
colourIndex details
bump
func(addr string)bump increments an address's paint tally.
- OID
- 09a813…f098:19
bump details
At
func(x int, y int) stringAt returns the palette name of the cell at (x, y), or "" when out of bounds.
- OID
- 09a813…f098:20
At details
PainterAt
func(x int, y int) stringPainterAt returns the address that last painted (x, y), or "" if untouched.
- OID
- 09a813…f098:21
PainterAt details
Strokes
func() intStrokes returns how many paints the canvas has taken.
- OID
- 09a813…f098:22
Strokes details
Palette
func() stringPalette returns the accepted colour names, comma-separated.
- OID
- 09a813…f098:23
Palette details
scorer
typescorer is one row of the contribution leaderboard.
Value
v0.scorer
byCount
typebyCount ranks painters by strokes descending, ties broken on address so the board is deterministic.
Value
v0.byCount
Render
func(path string) stringRender renders the canvas for gnoweb. Render("") / Render("/") -> the canvas, palette and leaderboard Render("/<x>,<y>") -> who painted that cell, and what colour
- OID
- 09a813…f098:24
Render details
grid
func() stringgrid renders the canvas as rows of coloured blocks.
- OID
- 09a813…f098:25
grid details
leaderboard
func() stringleaderboard renders the top painters, or "" when nobody has painted.
- OID
- 09a813…f098:26
leaderboard details
renderCell
func(q string) stringrenderCell renders a single "x,y" lookup.
- OID
- 09a813…f098:27
renderCell details
parseArg
func(path string) stringparseArg extracts the first path segment.
- OID
- 09a813…f098:28
parseArg details
parseCoord
func(s string) (int, int, bool)parseCoord parses "x,y" and reports whether it is in bounds.
- OID
- 09a813…f098:29