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.

v1 source pure

Package rubrica is an asemic-script engine: every token invents an alphabet of nine to sixteen glyphs (strokes on a 3...

Overview

Package rubrica is an asemic-script engine: every token invents an alphabet of nine to sixteen glyphs (strokes on a 3x4 node grid) and writes one page with it — a ruled manuscript, an inscribed stele, a scroll or a glossed page — with red rubrics (initials, first lines) marking where a reader should begin.

It is a stateless p/ package implementing engine/v1. Pure integer maths (FNV-1a + splitmix64 stream, truncating division, a 256-step cosine table), so the TypeScript twin (frontend/src/engines/rubrica.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.

Glyphs are defined once in <defs> and placed with <use>; each line is one translate and each glyph only an x. A hard glyph budget keeps every page small (see GlyphBudget).

Constants 3

const GlyphBudget, GlossBudget

1const (
2	GlyphBudget = 560
3	GlossBudget = 440
4)
source

GlyphBudget and GlossBudget cap the glyphs placed on one page: the size (and gas) knob of the engine. A full Fine-hand page holds ~520 glyphs; the glossed page's small gloss would hold ~700, so it gets a tighter cap that is shared out evenly over its five blocks.

const MaxSVGBytes

1const MaxSVGBytes = 28672
source

MaxSVGBytes: measured max is ~19.5 KB over thousands of seeds and every forced layout; the glyph budget bounds the worst case well below this.

const ParamsSchema

1const ParamsSchema = `{"type":"object","properties":{` +
2	`"script":{"type":"string","title":"Script","enum":["Any","Uncial","Lapidary","Cursive","Runic","Hanging"],"default":"Any"},` +
3	`"layout":{"type":"string","title":"Layout","enum":["Any","Single Column","Two Columns","Stele","Scroll","Glossed"],"default":"Any"},` +
4	`"vellum":{"type":"string","title":"Vellum","enum":["Any","Calfskin","Goatskin","Rag Paper","Purple"],"default":"Any"},` +
5	`"damage":{"type":"boolean","title":"Damage","default":true}}}`
source

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

Functions 9

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.

func SVG

1func SVG(seed, params string) string
source

SVG renders the page for a seed and params string as a standalone SVG.

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 nine 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	Script, Layout, Vellum string
3	Damage                 bool
4}
source

Params are the decoded collection params. "Any" keeps the seeded draw.

type TraitSet

struct
 1type TraitSet struct {
 2	Script, Layout, Hand, Rubrication string
 3	Vellum, Ink, Damage               string // as shown (Stone, Incised, Chrysography)
 4	Alphabet                          int
 5	Score                             int
 6	Rarity                            string
 7
 8	ruling    string
 9	glyphH    int
10	vellumRaw string // colour sources
11	inkRaw    string
12}
source

TraitSet is the decoded token. The SVG and the trait list both read it.

Dependencies

Source Files 2