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 strata is a Sinopia engine: cross-sections of an invented earth. Sediment beds are folded by a two-term integ...

Overview

Package strata is a Sinopia engine: cross-sections of an invented earth. Sediment beds are folded by a two-term integer sine field and cut by faults (each fault block shows the same bed drawing shifted by its throw inside a clip polygon), crossed by dikes and sills, sometimes truncated by an angular unconformity. Beds are drawn top to bottom and each is filled from its top surface down, so a bed costs one curve.

The RNG stream, tables, draw order and geometry are the prototype's (koleksiyon-fikirleri/strata/strata.py) for empty params; the only output change is that curves are written with relative steps (same points, ~20% fewer bytes, so less render and allowlist gas). The pre-change port was checked byte for byte against the prototype on 2,011 seeds. Pure integer maths: no floats, no time, no block data.

Constants 2

const MaxSVGBytes

1const MaxSVGBytes = 24576
source

MaxSVGBytes: the largest output measured is 17,083 B (3,000 seeds x the heaviest params; 15,657 B over 3,000 default seeds, docs/engines/strata.md); this leaves ~1.4x.

const ParamsSchema

1const ParamsSchema = `{"type":"object","properties":{` +
2	`"era":{"type":"string","title":"Era (palette)","enum":["Any","Sinopia Redbeds","Ochre Coast","Painted Desert","Chalk Cliff","Terra Verde","Basalt Coast","Lapis Vein"],"default":"Any"},` +
3	`"section":{"type":"string","title":"Section","enum":["Any","Cliff","Outcrop","Cores"],"default":"Any"},` +
4	`"bedding":{"type":"string","title":"Bedding","enum":["Any","Massive","Bedded","Laminated"],"default":"Any"},` +
5	`"folding":{"type":"string","title":"Folding","enum":["Any","Flat","Gentle","Folded","Contorted"],"default":"Any"}}}`
source

ParamsSchema is the Studio form. "Any" (the default) leaves the trait to the seed; any other value fixes it for the whole collection. Params are the canonical JSON Studio sends (all four keys, schema order), or "".

Functions 9

func Manifest

1func Manifest() engine.Manifest
source

Manifest describes the engine. Author and FeeBps are set by the adapter realm that registers it.

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 string) string
source

SVG renders a seed under default params.

func SVGWith

1func SVGWith(seed, ps string) string
source

SVGWith renders a seed under params; it panics on params ValidateParams rejects.

func TraitString

1func TraitString(seed, ps 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 params JSON only.

func TraitsOf

1func TraitsOf(seed string) TraitSet
source

TraitsOf returns the traits of a seed under default params.

func TraitsWith

1func TraitsWith(seed, ps string) TraitSet
source

TraitsWith returns the traits of a seed under params; it panics on params ValidateParams rejects.

Types 1

type TraitSet

struct
 1type TraitSet struct {
 2	Era          string
 3	Section      string
 4	Folding      string
 5	Faults       string
 6	Intrusion    string
 7	Bedding      string
 8	Unconformity string
 9	Fossil       string
10	Score        int
11	Rarity       string
12}
source

TraitSet is the decoded properties of a seed. The SVG builder and the trait list both read it, so picture and metadata cannot disagree.

Dependencies

Source Files 2