# ASCII Art Generator
> ⚠️ **Experimental — generated with no human supervision** by the daily MCP pipeline to exercise gno tooling. Not audited. See [r/moul/x/daily](https://github.com/moul/gno-contracts/blob/main/r/moul/x/daily/README.md).
---
An on-chain ASCII art generator that draws patterns (diamond, pyramid, Sierpinski triangle, checkerboard) from short deterministic formulas instead of a hand-authored font table -- the Sierpinski gasket is just `row & col == 0`. Call Generate(pattern, size) to render a piece and add it to a public gallery; browse the gallery or a specific piece via Render. It's a neat, self-contained example of generative art as pure on-chain logic.
Built for sapphire (gno 0.9). Live demo (agent address): https://sapphire.testnets.gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/asciiart
## What changed in v1
Two ports against [`v0`](https://github.com/moul/gno-contracts/tree/4f2df83869b80470eb81c48a82fdbe82256b8113/r/moul/x/daily/asciiart), which stays live and untouched.
### Rendering
Identical behaviour to [`v0`](https://github.com/moul/gno-contracts/tree/4f2df83869b80470eb81c48a82fdbe82256b8113/r/moul/x/daily/asciiart) apart from rendering, which now goes
through [`p/moul/kit/ui`](/p/moul/kit/ui/v0) instead of the local `escapeInline` helper.
**Real escaping.** The local helper replaced a handful of markdown metacharacters. `ui.Inline` and `ui.Cell` delegate to [`p/nt/markdown/sanitize`](/p/nt/markdown/sanitize/v0), which also strips bidi and zero-width characters and folds newlines, so user text cannot reorder or escape the line it sits on.
### Storage
State moved from a hand-rolled `avl.Tree` + `nextID` + zero-padding helper to
[`p/moul/kit/store`](/p/moul/kit/store/v0), which keys entries by
[`seqid`](/p/nt/seqid/v0) instead of a fixed-width decimal string.
`v0` padded ids to width 6. Past that width the padding stops and the tree
orders `"1000000000000"` before `"999999999999"`, so every list this realm
renders would be wrong from that entry on. `store` keys are 8 big-endian bytes
whose order is numeric for every `uint64`, so there is no width left to outgrow.
`piece` loses its `ID` field, which the store now owns. The gallery page also
gets simpler: `v0` reverse-iterated the whole tree with a `shown` counter to
stop at eight, where `PageReverse(1, 8)` asks the store for exactly that window.
A non-numeric or zero path is now rejected by `ParseID` rather than by
`strconv.Atoi` plus a range check.
Ids stay plain integers and the rendered output of the storage port is
unchanged. Each port changes something `v0` promised, one the rendered output
and one the storage layout, so under this repo's versioning rule each is a
compatibility change and neither could be an edit to `v0` in place.
They land in the **same** new version because `v1` was never published. A
version number is a tag on something that exists on a chain, and until it does
there is nothing for a second number to avoid disturbing, so the right move is
to keep editing the version you have. `gnopm unbump` is what folded the second
port back down into this one.
<!-- BEGIN GNOCONTRACTS FOOTER (generated by `make readmes`; do not edit below) -->
---
Part of **[moul/gno-contracts](https://github.com/moul/gno-contracts)** — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.
**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](https://github.com/moul/gno-contracts/blob/main/DISCLAIMER.md).
<!-- END GNOCONTRACTS FOOTER -->
Generate(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, pattern string, size int) string
Render(path string) string
RenderChecker(n int) string
RenderDiamond(n int) string
RenderPyramid(n int) string
RenderSierpinski(n int) string
Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.
vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.