Skip to main content

Module deck

Module deck 

Source
Available on crate feature raster only.
Expand description

mulberry32 deck RNG port + buildWorld fixture + o(C) organization degree (topology-deck.html:120-121, 129-179, 196-208). Task 6.

mulberry32 is a fixture-only RNG that never enters the general layout/community API (Pcg64Mcg remains the crate’s canonical generator) — see the plan’s CRITICAL REFERENCE CORRECTION on mulberry32 vs Pcg64Mcg.

Structs§

Agent
One of the 28 seeded agents (topology-deck.html:129-134).
Community
An organizing community: a member set plus internal cohesion links (topology-deck.html:135-143).
DeckWorld
The instrument input bundle — everything instruments::build reads to render a scene. build_world(seed) (below) is the seeded deck fixture producer (topology-deck.html:151-179’s buildWorld return value); raster::ingest::to_world (Phase I) is the real-graph producer for an arbitrary Hypergraph. Both paths converge on this one struct so the frozen render path (instruments::build → rasterize / render_pixels) never has to know which producer built its input — this is the adapter-into-struct design (plans/phase-I-topology-ingest.md CRITICAL DESIGN RULING), chosen over a WorldSource trait so the golden path is edited by neither producer, ever.
Extraction
A multilateral extraction hyperedge: deduped periphery tails -> one capital head (topology-deck.html:145-149).
Mulberry32
Byte-exact Rust port of the deck’s mulberry32(a) closure (topology-deck.html:120-121). State is a wrapping u32; next() reproduces the JS Math.imul/>>>/|0 arithmetic bit-for-bit (pure wrapping-integer arithmetic — no float-tolerance concern, user CLAUDE.md §4).

Functions§

build_world
Port buildWorld(seed) (topology-deck.html:129-179): 28 agents in 3 blocs, 4 organizing communities (capital δ fully cohesive, the rest atomized with 1 link), 4 extraction hyperedges, and the 13-industry table.
deck_hypergraph
The shared DeckWorld -> &Hypergraph adapter (Finding 6): 28 agents become nodes keyed by their id. The single bridge from DeckWorld to the shipped &Hypergraph APIs (subhypergraph, connected_components, Task 7’s normalized_laplacian), none of which take DeckWorld directly.
do_tick
Port of doTick() (topology-deck.html:243-252, Task 10). Order verbatim (Finding 1): (1) wealth extraction over world.extraction — take = mass·0.12; each tail loses take/|tails| under a Math.max(0.2, …) floor; the head gains take·0.8; every bloc-1 (core-labor) agent gains take·0.2/9; THEN (2) c-accumulation — each industry’s c ×= 1.035 if lane>=2 else ×= 1.015 (v,e untouched). Does not itself call transform — callers compute readouts from the mutated world.industries afterward (the crate’s transform is a pure fn with no Industry-side effects to “re-run”, unlike the deck’s closure-captured W.industries). Bounded: world.extraction.len() * (max tails + agents.len()) + world.industries.len().
global_pi0
Global Π₀: union all community links and all extraction tails→head over the full 28-agent population (topology-deck.html:196-204’s globalPi0), hand-rolled (not algorithms::connected_components, which walks a &Hypergraph — DeckWorld’s extraction hyperedges are directed tails→head, not the crate’s undirected membership shape).
org_degree
Organization degree o(C) = 1 if |C|<2 else 1 - (|Π₀(C)|-1)/(|C|-1) (topology-deck.html:206-208). Built as an isolated per-community graph (own members as nodes, own links as edges) rather than a slice of the shared deck_hypergraph: the deck’s orgOf walks only c.links, and the periphery communities draw from an overlapping pool (cell α/cell β both shuffle the full 14-agent bloc), so filtering a shared multi- community graph by node membership alone (subhypergraph) could admit another community’s edge whose endpoints happen to fall inside this community’s member set — this isolated construction is immune to that and reproduces orgOf exactly. Reuses connected_components (algorithms::connected) for |Π₀(C)|, per Task 6.
periphery_mean_wealth
Mean wealth of the bloc-2 (periphery) agents, in agents order (topology-deck.html:439-440’s pw). Pure arithmetic — byte-exact.
psa
psa = sigmoid(pw − per[0].subsistence) (topology-deck.html:443) — the periphery’s assimilation survival probability. Tolerance-bounded golden (routes through sigmoid’s exp, Finding 3), NOT byte-exact.
psr
psr = min(1, (org(cell α)+org(cell β))/2 / (repression/2.6·0.9)) (topology-deck.html:444) — the deck’s calibrated rupture-survival form; diverges from the textbook P(S|R)=Org/Repression (see OPEN DECISION D-R7). Pure division — byte-exact. communities[0]/[1] are cell α/cell β by build_world’s push order.
sigmoid
sigmoid(x) = 1/(1+e^-x) (topology-deck.html:122). Routes through exp — not byte-exact across libm implementations (Finding 3, user CLAUDE.md §4); callers golden-test it tolerance-bounded (< 1e-12).