Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

v2 source pure

Package rubrica (v2, "Living Language") is a Sinopia engine: every token invents a language and writes one manuscript...

Overview

Package rubrica (v2, "Living Language") is a Sinopia engine: every token invents a language and writes one manuscript leaf in it.

The language is an alphabet of 12-20 glyphs (strokes on a 3x4 node grid in one of five hands) and a lexicon of 22-40 words built from it. Glyph use and word use both follow a Zipf law and the most frequent words are the shortest, so the text reads like writing rather than noise. The leaf is laid out like a real codex page: justified lines, paragraphs closed by a punctus, ink that fades until the scribe dips the pen again, a great initial, lombards, rubrics and line fillers, a vine border or a full frame, a marginal drawing, a running head, a catchword and the folio number, which is the token number written in medieval numerals (f. xiiij v).

A stateless p/ package implementing engine/v2. Pure integer maths (FNV-1a + splitmix64 streams, truncating and floor division), so the TypeScript twin (frontend/src/engines/rubricav2.ts) renders the same bytes. Traits come from their own cheap stream (seed+"|traits") and never render; the art uses seed+"|art", so art draws never shift traits. Words are defined once in <defs> and placed with <use>; a word budget caps every leaf.

The render depends on Input.TokenID (the folio number) and on nothing else outside Seed and Params; it is not a living engine.

Constants 3

const MaxSVGBytes

1const MaxSVGBytes = 28672
source

MaxSVGBytes: the measured maximum is 25,666 B over ~100,000 renders with every forced hand/layout set (docs/engines/rubrica-v2.md); WordBudget bounds the text.

const ParamsSchema

1const ParamsSchema = `{"type":"object","properties":{` +
2	`"hand":{"type":"string","title":"Hand","enum":["Any","Angular","Round","Hooked","Dotted","Slanted"],"default":"Any"},` +
3	`"layout":{"type":"string","title":"Layout","enum":["Any","Single Column","Two Columns","Glossed"],"default":"Any"},` +
4	`"vellum":{"type":"string","title":"Vellum","enum":["Any","Calfskin","Goatskin","Rag Paper","Purple"],"default":"Any"},` +
5	`"damage":{"type":"boolean","title":"Wear and damage","default":true}}}`
source

ParamsSchema is the Studio form: three optional overrides and a wear switch. Studio sends JSON.stringify of the values in this order.

const WordBudget

1const WordBudget = 500
source

WordBudget caps the words placed on one leaf (text, gloss, palimpsest): the size and gas knob. It binds only on the densest glossed leaves, whose last gloss (or palimpsest) lines then stay short.

Functions 11

func FolioNumber

1func FolioNumber(tokenID string) int
source

FolioNumber reads Input.TokenID: 1..99999, else 0 (sample, Studio).

func Manifest

1func Manifest() engine.Manifest
source

Manifest describes the engine. Author and FeeBps are set by the adapter.

func Render

1func Render(in engine.Input) string
source

Render returns the raw SVG for in.Seed under in.Params; in.TokenID is the folio number.

func RomanFolio

1func RomanFolio(n int) string
source

RomanFolio writes n in medieval lower-case roman numerals; a final i is written j (iij, viij).

func SVG

1func SVG(seed, params, tokenID string) string
source

SVG renders the leaf for a seed, params string and token id ("" or "0": the folio number is drawn from the seed).

func TraitString

1func TraitString(seed, params string) string
source

TraitString is "Type=Value;…" in TraitTypes order (golden vectors).

func Traits

1func Traits(in engine.Input) []engine.Trait
source

Traits returns the eight traits of in.Seed under in.Params, in TraitTypes order. It never renders.

func ValidateParams

1func ValidateParams(params string) error
source

ValidateParams accepts "" and the canonical JSON only.

func ParseParams

1func ParseParams(s string) (Params, error)
source

ParseParams decodes "" or the canonical JSON and refuses anything else (other key order, spaces, unknown keys or values, "{}").

func TraitsOf

1func TraitsOf(seed, params string) TraitSet
source

TraitsOf returns the decoded traits for a seed and params string; it panics on invalid params (core validates them at CreateCollection).

Types 2

type Params

struct
1type Params struct {
2	Hand, Layout, Vellum string
3	Damage               bool
4}
source

Params are the decoded collection params. "Any" keeps the seeded draw; Damage false makes every leaf Fine.

type TraitSet

struct
1type TraitSet struct {
2	Hand, Layout, Decoration, Vellum, Ink, Marginalia, Condition int
3	Alphabet, Lexicon                                            int
4	Score                                                        int
5	Rarity                                                       string
6}
source

TraitSet is the decoded token: indexes into the tables above. The SVG and the trait list both read it.

Dependencies

Source Files 2