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 kilim (v2, "Niyet") is a Sinopia engine: a flat-woven rug that says something. The seed first chooses an inte...

Overview

Package kilim (v2, "Niyet") is a Sinopia engine: a flat-woven rug that says something. The seed first chooses an intent (Protection, Abundance, Wish, Strength), then a main motif and two companions from fourteen Anatolian motif families, each with its traditional meaning (Elibelinde, Koçboynuzu, Bereket, Nazarlık, ...). The motifs are woven cell by cell on a 49 x 75 loom grid into one of five layouts inside one of five borders, and the token number is woven into the bottom frame as a 14-bit band (the "künye"). The meanings reach collectors through the traits (Main Motif, Companions and Border carry them) and the SVG's <title>/<desc>.

It is the successor of Kilim v1 (p/.../art/kilim/v1, which stays untouched): the same loom, the same FNV-1a + splitmix64 streams (seed+"|traits" and seed+"|art"), the same run-length SVG encoding, a richer field. frontend/src/engines/kilimv2.ts is a byte-identical TypeScript twin; kilim_test.gno pins golden vectors that the twin asserts too.

Unlike v1 the art reads Input.TokenID (the künye). It never reads heights or moves, so the engine is not living. Pure integer maths: no floats, no time, no block data.

Constants 3

const DefaultParams

1const DefaultParams = `{"intent":"Seeded","layout":"Seeded","dyes":"Seeded"}`
source

DefaultParams is the canonical form of the defaults; it renders exactly like "".

const MaxSVGBytes

1const MaxSVGBytes = 28672
source

MaxSVGBytes: the largest output over 10,000 default seeds is about 14.6 KB (docs/engines/kilim-v2.md); about 2x margin, within the 28 KB budget.

const ParamsSchema

1const ParamsSchema = `{"type":"object","properties":{` +
2	`"intent":{"type":"string","title":"Intent","enum":["Seeded","Protection","Abundance","Wish","Strength"],"default":"Seeded"},` +
3	`"layout":{"type":"string","title":"Layout","enum":["Seeded","Three Göls","Great Göl","Lattice","Bands","Mihrab"],"default":"Seeded"},` +
4	`"dyes":{"type":"string","title":"Dyes","enum":["Seeded","Madder & Indigo","Buckthorn Gold","Walnut & Fleece",` +
5	`"Pomegranate","Night Indigo","Highland Green","Sinopia Earth","Saffron & Plum"],"default":"Seeded"}}}`
source

ParamsSchema is the Studio form. Studio sends JSON.stringify of the values in this property order; ValidateParams accepts exactly that or "".

Functions 11

func KunyeNumber

1func KunyeNumber(tokenID string) int
source

KunyeNumber is Input.TokenID read as a decimal, modulo 2^14 (the band has 14 bits; core's supply cap is 10,000). Anything but ASCII digits is 0.

func Manifest

1func Manifest() engine.Manifest
source

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

func MotifCount

1func MotifCount() int
source

MotifCount is the number of motif families.

func MotifMeaning

1func MotifMeaning(i int) (name, gloss, meaning string)
source

MotifMeaning returns the name, one-word gloss and meaning of motif i (0..13), the dictionary collectors see in the traits.

func Render

1func Render(in engine.Input) string
source

Render returns the raw SVG for in.Seed, in.Params and in.TokenID.

func SVG

1func SVG(seed string, cfg Config, tokenID string) string
source

SVG renders the artwork for a seed under cfg, with the token number tokenID woven into the künye band.

func Traits

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

Traits returns the eight traits of in.Seed in TraitTypes order. It never renders: eleven draws and a score.

func ValidateParams

1func ValidateParams(params string) error
source

ValidateParams accepts "" (the showcase defaults) and the canonical JSON.

func Defaults

1func Defaults() Config
source

Defaults is the showcase look (params "").

func ParseParams

1func ParseParams(params string) (Config, error)
source

ParseParams accepts "" or the canonical JSON Studio produces, nothing else.

func TraitsOf

1func TraitsOf(seed string, cfg Config) TraitSet
source

TraitsOf returns the decoded traits for a seed.

Types 2

type Config

struct
1type Config struct {
2	Intent, Layout, Dyes int
3}
source

Config is a parsed params string; -1 means drawn from the seed.

type TraitSet

struct
1type TraitSet struct {
2	Intent, MainMotif, Companions, Layout, Border, Dyes, Mark string
3	Score                                                     int
4	Rarity                                                    string
5}
source

TraitSet is the decoded properties of a seed under a config.

Dependencies

Source Files 2