From 3a1b8c79237dc6652fdb4a8fb59c9fdb387541ef Mon Sep 17 00:00:00 2001 From: dingo Date: Mon, 19 Oct 2026 12:35:18 -0400 Subject: [PATCH] test(ecology): qualify unscripted maturing wildlife generations --- CMakeLists.txt | 5 + README.md | 7 + .../region/dev-session-route/listener.yaml | 2 +- docs/ROADMAP.md | 6 + docs/STATUS.md | 17 ++ ...bounded-unscripted-wildlife-generations.md | 52 ++++ docs/adr/README.md | 2 + docs/engineering/M12_DELIVERY_PLAN.md | 4 +- .../M12_ENVIRONMENT_OWNERSHIP_RESOLUTION.md | 119 +++++++++ docs/engineering/M12_REMAINING_GATES.md | 16 +- .../engineering/M12_UNSCRIPTED_GENERATIONS.md | 109 ++++++++ docs/engineering/VALIDATION.md | 51 ++++ .../m12-unscripted-generations-gcc14.jsonl | 23 ++ .../m12-unscripted-generations-msvc1944.jsonl | 23 ++ .../resolution/cellular_generations.cpp | 246 ++++++++++++++++++ 15 files changed, 677 insertions(+), 5 deletions(-) create mode 100644 docs/adr/0162-bounded-unscripted-wildlife-generations.md create mode 100644 docs/engineering/M12_ENVIRONMENT_OWNERSHIP_RESOLUTION.md create mode 100644 docs/engineering/M12_UNSCRIPTED_GENERATIONS.md create mode 100644 docs/engineering/results/m12-unscripted-generations-gcc14.jsonl create mode 100644 docs/engineering/results/m12-unscripted-generations-msvc1944.jsonl create mode 100644 experiments/resolution/cellular_generations.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e56937..91be1df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -659,9 +659,14 @@ endif() add_executable(evo-cellular-reference experiments/resolution/cellular_reference.cpp) target_link_libraries(evo-cellular-reference PRIVATE evo::lifecycle) evo_owned_target(evo-cellular-reference) +add_executable(evo-cellular-generations experiments/resolution/cellular_generations.cpp) +target_link_libraries(evo-cellular-generations PRIVATE evo::lifecycle) +evo_owned_target(evo-cellular-generations) if(BUILD_TESTING) add_test(NAME cellular-population-reference COMMAND evo-cellular-reference --verify) set_tests_properties(cellular-population-reference PROPERTIES TIMEOUT 180) + add_test(NAME cellular-unscripted-generations COMMAND evo-cellular-generations --verify) + set_tests_properties(cellular-unscripted-generations PROPERTIES TIMEOUT 180) endif() add_executable(evo-cellular-cohorts experiments/resolution/cellular_cohorts.cpp) diff --git a/README.md b/README.md index bb650b1..fb99b02 100644 --- a/README.md +++ b/README.md @@ -196,6 +196,13 @@ checks rules-8 encoded replay and offline closure. `evo-cellular-reference --ver runs the short CTest matrix; without arguments it runs the full research matrix with local cost observations. This is an exact control, not production aggregation. +[Unscripted generations](docs/engineering/M12_UNSCRIPTED_GENERATIONS.md) uses real +funded player-origin offspring under the unchanged controller. Build +`evo-cellular-generations`; `--verify` runs the short CTest contract and `--qualify` +runs the declared 80,000-tick development/hold-out matrix with raw/cohort equality, +whole-genome conversions, restores and resource controls. This is bounded ecology +evidence, not actual-days or product acceptance. + M5.1 local voxel/address API and scope: [local voxel contract](docs/world/LOCAL_VOXEL_CONTRACT.md). M5.8 process restart proof and measured costs: [world proof](docs/engineering/WORLD_PROOF.md). diff --git a/deploy/kubernetes/region/dev-session-route/listener.yaml b/deploy/kubernetes/region/dev-session-route/listener.yaml index 1ace09c..89656e9 100644 --- a/deploy/kubernetes/region/dev-session-route/listener.yaml +++ b/deploy/kubernetes/region/dev-session-route/listener.yaml @@ -12,7 +12,7 @@ spec: env: - {name: REGION_SESSION, value: "dev"} - {name: REGION_SESSION_LISTEN, value: "0.0.0.0:7400"} - - {name: REGION_SESSION_WINDOW, value: "dev-20261019T155548-13dfba50:1792439748"} + - {name: REGION_SESSION_WINDOW, value: "dev-20261019T163247-193bdb60:1792441967"} - {name: REGION_M10_MAX_GRANT_LIFETIME, value: "14400"} ports: # QUIC (ADR-0090): UDP only; nothing listens on TCP 7400. diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 4d0dd65..3b002f0 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -647,6 +647,12 @@ the later multicellular idea are not ratified game rules. ## M12 - Persistent ecology +2026-10-19: [bounded unscripted generations](engineering/M12_UNSCRIPTED_GENERATIONS.md) +qualify four wildlife generations in the declared finite rich four-founder +matrix, including hold-outs, with exact raw/cohort biology, conservation, +predation/twins and restores. This supplies ecological evidence for M12; joint +environmental budgets, target-host costs, actual-days and product gates remain open. + 2026-10-17: [12.2c rules-8 reference](engineering/M12_CELLULAR_REFERENCE.md) validates 65,536 individual ticks and 70,656 encoded replay boundaries on MSVC/GCC, with mutation, birth/death and offline-state coverage. This is the active control; diff --git a/docs/STATUS.md b/docs/STATUS.md index b9e6640..40b0c03 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -1,5 +1,22 @@ # Project status and next steps +## Bounded unscripted wildlife generations - 2026-10-19 + +[ADR-0162](adr/0162-bounded-unscripted-wildlife-generations.md) measures actual +funded player-origin wildlife under the unchanged controller. All players freeze +after the first bud. Four declared rich four-founder cases, including two +hold-outs, reach four wildlife generations with 97–102 births and 31–33 living +wildlife after 80,000 ticks. Complete raw/cohort biology and reports, conservation, +whole-genome conversions and periodic restores agree. Actual predation and twins +are observed; rules-8 and scarce controls retain their different outcomes. + +Native Release passes **82/82**; the short ASan/UBSan contract, analysis and format +checks pass. [Results and reproduction](engineering/M12_UNSCRIPTED_GENERATIONS.md) +retain the weaker exploratory one-founder outcomes and exact scope. This is +4,000 simulated seconds per case, not actual days or sustainable producer ecology. +M12 remains in progress; environmental coupling, target-host/multi-host evidence, +global reconciliation and returning-player/product gates remain open. + ## Durable migration of maturing wildlife - 2026-10-19 [ADR-0161](adr/0161-durable-maturing-wildlife-transfer.md)/schema 54 admits exact diff --git a/docs/adr/0162-bounded-unscripted-wildlife-generations.md b/docs/adr/0162-bounded-unscripted-wildlife-generations.md new file mode 100644 index 0000000..25afe6e --- /dev/null +++ b/docs/adr/0162-bounded-unscripted-wildlife-generations.md @@ -0,0 +1,52 @@ +# ADR-0162: Bounded unscripted wildlife generation qualification + +## Status + +Accepted for an offline M12 ecological qualification instrument, 2026-10-19. +Extends ADR-0125/0133/0139/0157. No biological, controller, persistence or default +deployment behavior changes. Thresholds below are experiment criteria, not game +rules or a product acceptance decision. + +## Decision + +Use the existing finite cellular ecology fixture, with real funded player +founders. Founders request budding every 100 ticks until the first successful +bud; thereafter every player is frozen. All wildlife decisions then come from +the unmodified production controller. No reserve grants, injected organisms, +manual wildlife actions, mutation selections or replenishment are permitted. +Generation is the actual retained parent chain, not genetic divergence. + +Before measuring previously untested seeds 2 and 3, declare the following matrix: +rules 9, rich finite opening, four founders, 80,000 ticks, development seeds 0/1 +and hold-outs 2/3. Each must retain living wildlife, reach at least generation 3, +and produce wildlife births in the final quarter. Every tick must conserve all +five channels and have identical complete canonical biology and action/growth +reports in raw and cohort execution. Whole-genome conversions alternate every +257 ticks; both representations restore every 4,096 ticks. Check that restores +retain bytes and controller intentions. Require actual conversions and restores. + +Report all outcomes, including failure, and per-founder ancestry. Existing +80,000-tick exploratory seeds 0/1/7/19 with one and four founders are development +evidence, not unseen hold-outs. Include rules-8 and scarce-resource controls; +neither is required to sustain generations. Add a short NDEBUG-safe executable +contract exercising real birth, growth, conversion and recovery on both rules. + +## Alternatives and consequences + +Scripted parent/offspring actions establish funding correctness but not autonomous +reproduction. Rewriting the controller before measuring its longer trajectory +would conflate a new biological behavior with qualification. Retain both existing +contracts and measure the unchanged controller instead. The instrument costs a +separate bounded executable and full canonical comparisons; it supplies stronger +reproducible evidence without a runtime dependency or a production speed claim. + +## Limits + +80,000 ticks are 4,000 simulated seconds. This finite, resource-rich opening +does not establish perpetual sustainability, varied-world balance, useful +compression, target-host cost, environmental coupling or actual elapsed days. +Inherited genomes are unchanged; automatic mutation and evolving behavior remain +deferred under ADR-0133. A seed with two generations remains a measured outcome, +not grounds for silently changing the controller or weakening the declared +four-founder qualification. Automatic population tiers stay disabled. No live +world, database migration, extinction judgment or World0 operation is authorized. diff --git a/docs/adr/README.md b/docs/adr/README.md index 84fa301..e6995e0 100644 --- a/docs/adr/README.md +++ b/docs/adr/README.md @@ -1,5 +1,7 @@ # Architecture decision records +- [ADR-0162: Bounded unscripted wildlife generations](0162-bounded-unscripted-wildlife-generations.md) - a predeclared finite player-origin raw/cohort measurement with production controller, hold-outs and controls; no biological or deployment change. + - [ADR-0156: Census pending migration evidence](0156-census-pending-migration-evidence.md) - schema 52 captures active handoff pointers with registered heads and fully verifies retained capsules/ghosts; source owns stock and ghosts add none, including across settlement races. - [ADR-0155: Database history domains](0155-database-history-domain.md) - schema 51 binds registered census evidence to a database namespace; supported quarantined restores retain parent domains and exact fork cuts before readmission. Cross-domain clone provenance and accepted extinction remain open. diff --git a/docs/engineering/M12_DELIVERY_PLAN.md b/docs/engineering/M12_DELIVERY_PLAN.md index c6cdfc1..560fdbd 100644 --- a/docs/engineering/M12_DELIVERY_PLAN.md +++ b/docs/engineering/M12_DELIVERY_PLAN.md @@ -4,7 +4,7 @@ Requested scope: ecological identity, population qualification, durable automati tier transitions, unattended scheduling/migration and environmental coupling. Commit and push each validated scoped segment separately. -## Gate status (2026-10-18) +## Gate status (2026-10-19) | Subset | State | Evidence or condition for completion | |---|---|---| @@ -15,7 +15,7 @@ Commit and push each validated scoped segment separately. | 12.5 | Blocked on 12.2-12.4 | Finite M6 process fixtures do not qualify coupled persistent cellular/cohort atmosphere/water budgets. | | 12.6 | Regional queries, replayed history, scoped multi-region queries and consistent database head snapshots implemented (12.6a-d) | ADR-0150–0153; short read-only snapshot capture prevents atomic pairs from straddling declared head sets, with exact immutable replay. Durable world/branch coverage, outside transfer/viability reconciliation, target-host query/index costs and client path remain required. | | 12.7 | Evidence policy, registered coverage, history domains and verified pending handoff evidence implemented (12.7a-c) | ADR-0154–0156/schema 52 captures namespace/registry/heads/pending handoffs together, with exact capsule/ghost replay and supported restore forks. Cross-domain clone provenance, other viable-store coverage and durable accepted global reconciliation/freshness remain required. | -| 12.8 | Not qualified | Actual multi-day integrated ecology/restart/clone evidence remains required. | +| 12.8 | Bounded unscripted generation evidence; actual-days gate not qualified | ADR-0162 measures four real wildlife generations with exact raw/cohort recovery, predation and twins. Actual multi-day integrated ecology/restart/clone evidence remains required. | | 12.9 | Not accepted | Returning-player product evidence and expansion review remain required; World0 stays separately blocked. | The [remaining-gate audit](M12_REMAINING_GATES.md) identifies the exact publication diff --git a/docs/engineering/M12_ENVIRONMENT_OWNERSHIP_RESOLUTION.md b/docs/engineering/M12_ENVIRONMENT_OWNERSHIP_RESOLUTION.md new file mode 100644 index 0000000..d22dae1 --- /dev/null +++ b/docs/engineering/M12_ENVIRONMENT_OWNERSHIP_RESOLUTION.md @@ -0,0 +1,119 @@ +# Cellular/environment ownership resolution + +2026-10-19 engineering design review for M12.5. This document proposes the next +implementation boundary; it does not declare a new biological rule, accepted +producer chemistry, working adapter or completed gate. + +## Concrete conflict + +`CellularLives` exclusively owns its finite habitat, nursery, living bodies and +reserves, corpses, heat, archive and boundary ledger. Its complete restore checks +five-channel closure against the opening and retained boundary flows. A habitat +configuration copied from environmental fields would create a second spendable +stock. `EnvironmentalCommunity` already owns its source, environment and exactly +two configured resource actors, with its own atomic history and checkpoint. +Advancing those two owners separately cannot publish one conserved biological tick. + +The M6 ten-channel basis distinguishes water, dissolved N/P, organic energy and +C/N/P/other, incident energy and heat. Cellular `other` has no water or gas tag. +An elemental sum can therefore close while an invalid adapter turns water into +food or heat into usable energy. No current API authorizes that conversion. + +These are implementation conflicts with ADR-0050/0055/0101/0144 and the +engineering constitution, not a request to reopen M11.9. Stop expanding the +affected integration until the following boundary has its own scoped contract. + +## Proposed resolution + +1. Introduce a distinct composite ecological owner and checkpoint profile. It + consumes exclusive ownership of cellular biology and tagged environmental + stocks, exposes read-only views, and prepares a complete detached tick. Keep + the existing M6 two-actor synthetic process unchanged as a reference fixture; + it is not the cellular producer implementation. +2. Initially support one explicitly declared axis-aligned habitat within one + environmental voxel, using the existing checked micrometre geometry. Persist + world/frame/region, source identity, origin, area and positive effective depth. + Reject overlapping authorizations, cross-voxel mappings and missing fields. + Camera dimensions and organism count never determine depth or supply. +3. Adopt a versioned compartment map. Only owned organic energy/C/N/P/other can + enter the existing edible deposit/reserve basis. Water remains separately + tagged even inside organisms; incident energy, heat and dissolved nutrients + cannot be credited as edible material through a generic retag operation. + An actual conversion requires an explicitly versioned process with all debit, + credit, work, waste and residual terms. Atmospheric species need their own + tagged elemental composition and storage contract; absent support is an error, + not zero, unlimited oxygen or an implicit photosynthesis recipe. +4. Give each source one persisted entitlement over a declared area and interval. + Capture and nutrient inflow need explicit finite source debit or an audited + external import, never both. Disjoint shares or one arbiter resolve contention. + Retain rate denominators, fractional residuals, interval watermarks and skipped + outcomes. Restart, retries and habitat refinement cannot reset entitlements. +5. Keep old cellular format 7/rules 8 and 9, population envelopes and durable + bundles 10/11 exact. Add separately identified composite format/rules/profile + only when the entire codec and replay contract exist. Do not attach new fields + to an old bundle or allow a bare nested cellular snapshot to publish a joint + result. Historical census and migration must either understand the whole joint + owner or refuse it explicitly. +6. Publish source debit, deposits, growth/maintenance, death/recycling, heat, + residuals and the complete nested biological result atomically at one fixed + quantum. No independently acknowledged environmental or cellular prefix. + Cross-worker sources require owned escrow and paired durable settlement before + activation; a timeout grants no release or second spending right. + +## Delivery segments and acceptance evidence + +Worked conservation examples below are integer accounting fixtures, not proposed +metabolic rates or a physical photosynthesis model: + +| Step | Incident energy | Environmental organic energy | Cell reserve energy | Heat | Total pJ | +|---|---:|---:|---:|---:|---:| +| Opening | 100 | 30 | 10 | 0 | 140 | +| Funded capture of 20, retaining 15 | 80 | 45 | 10 | 5 | 140 | +| Cell maintenance spends 4 | 80 | 45 | 6 | 9 | 140 | +| Contact transfers 10 organic energy | 80 | 35 | 16 | 9 | 140 | +| Explicit external import of 7 | 87 | 35 | 16 | 9 | 147 | + +The final row additionally retains exactly 7 pJ of cumulative external imports; +the closed rows retain zero. Neither heat nor source entitlement is an extra +spendable balance. Replaying the import must retain 147, not credit another 7. +Source-off executes no capture, but may spend already retained reserves. + +For the `other` basis, water 100 fg + environmental organic other 20 fg + cell +organic other 6 fg totals 126 fg. Moving 2 fg of organic other into the cell gives +100 + 18 + 8 = 126. Moving water into the existing untagged food reserve must be +refused even though 98 + 20 + 8 also sums to 126. This is why elemental closure +alone cannot validate the adapter. Dissolved N/P incorporation and atmospheric +conversion likewise need actual typed reaction contracts, not a matching sum. + +For geometry, 1,000 × 2,000 × 10 micrometres gives 20,000,000 cubic micrometres. +Doubling depth changes the declared sampling volume; it does not double any +owned water, nutrient or source stock. Source-area entitlement cannot double +merely because another cell overlaps the same illuminated area. + +| Segment | Concrete deliverable | Required proof before commit | +|---|---|---| +| 12.5a | Accepted compartment/geometry/source and producer-process contracts, complete format declaration | Worked closed and open balances; water/heat/atmosphere refusals; no ambiguous ownership or unversioned coefficient | +| 12.5b | Portable composite owner and full codec from its first advancing operation | Real player-origin raw/cohort trajectories, atomic failed ticks, malformed/old formats, exact retry/restore/process continuation, closed-box and resource exhaustion comparisons | +| 12.5c | Dedicated durable profile, trace, explicit upgrade and complete recovery | Source/head/fence and representation races, uncertain replies, process kills, object failures, old bundle refusal and exact history | +| 12.5d | Worker/census/migration/client integration and source regimes | Registered complete-stock audits, no offline capture/growth, preserved lineage and escrow, useful source-off/open/nutrient-limited comparisons | +| 12.5e | Target-host and integrated-world qualification | Publication and contention tail costs, recovery faults, actual-days varied worlds and returning-player review | + +The first segment must specify producer costs and atmosphere/water semantics +before implementation. The proposed infall/photosynthesis sections of ADR-0136 +are design input, not authority to silently supply missing chemistry or free +matter. Trial coefficients must be clearly revisable and distinguish capture of +external energy from nutrient acquisition and body construction. + +## Alternatives and consequences + +A copied environmental view duplicates supply. Reusing M6's configured producer +as a cellular ancestor invents player-origin biology and treats synthetic growth +units as developed body mass. Independently committing two existing checkpoints +creates torn cuts. Adding a generic inventory setter bypasses source authority. +All four alternatives are rejected as implementation shortcuts. + +A dedicated owner costs another complete format, replay path, durable admission +and integration matrix. It avoids changing historical biological bytes and makes +unsupported physical states explicit. Existing maturation, migration, census and +bounded generation qualification can proceed independently. No environmental +runtime, live upgrade, World0 operation or M12.5 completion is claimed here. diff --git a/docs/engineering/M12_REMAINING_GATES.md b/docs/engineering/M12_REMAINING_GATES.md index cdd08d2..6789859 100644 --- a/docs/engineering/M12_REMAINING_GATES.md +++ b/docs/engineering/M12_REMAINING_GATES.md @@ -23,13 +23,13 @@ or authorize production enablement. | Gate | Existing useful basis | Work/evidence still required | |---|---|---| -| 12.2 | Exact cellular model and paired matrix; local samples through 256 lives | Deployment-host tail costs including publication; larger wildlife cohorts, predation/twins and contention coverage; useful compression remains unimplemented. | +| 12.2 | Exact cellular model and paired matrix; local samples through 256 lives; bounded four-generation rules-9 predation/twin matrix | Deployment-host tail costs including publication; larger wildlife cohorts and fuller contention coverage; useful compression remains unimplemented. | | 12.3 | Dedicated population profile/trace/store/owning host; exact recovery and private PostgreSQL fault tests | Population-specific executable/network fault drills and target-host publication/capacity qualification. | | 12.4 | Owned intervals; exact transfer/accounting; durable atomic pair/recovery; independent loopback TLS path loss and owner expiry/replacement/heal; local object sync/read-failure matrix | Multi-host/kernel-network, storage-host and orchestrator drills, linked-boundary contracts and integrated ownership/stock audits at scale. | | 12.5 | Finite cellular contact feeding/decay and separate M6 producer/consumer resource owner | One jointly owned cellular/environment budget, explicit effective depth and source entitlements, versioned water/atmosphere species mapping and producer coefficients, plus closed/open and nutrient-exhaustion comparisons. | | 12.6 | Retained archive, regional census/lineage queries, replayed history, scoped multi-region queries and consistent database head snapshots (12.6a-d); registered coverage/history domains follow in 12.7a-b | Cross-domain clone provenance, retained historical coverage/other viable stores, target-host query/index qualification and client permission/presentation; no account power or invented precise statistical ancestry. | | 12.7 | Viability/unknown policy; consistent cuts, registered coverage, history domains/restore forks and verified pending handoff evidence (12.7a-c/schema 52) | Cross-domain clone provenance, other viable-store coverage and durable accepted global evidence records/freshness. Missing/stale/unsupported owners must prevent terminal extinction. | -| 12.8 | Deterministic seed/regime drivers and separate-process exact continuation | Reproducible integrated worlds running for actual days, real restarts/clone comparisons and retained accounting/diversity/cost audits. Accelerated tests cannot supply elapsed days. | +| 12.8 | Deterministic seed/regime drivers, separate-process exact continuation and bounded unscripted generations | Reproducible integrated worlds running for actual days, real restarts/clone comparisons and retained accounting/diversity/cost audits. Accelerated tests cannot supply elapsed days. | | 12.9 | M11 feedback and current UI review retained | Returning-player samples on the integrated ecology and explicit product/3D readiness decision after soak evidence. No M12 product acceptance or World0 promotion is inferred. | Do not couple the current cellular habitat to a copied M6 stock view: two owners @@ -39,6 +39,11 @@ finite deposits. Their geometry, ownership and chemical units need a versioned mapping, not a renamed fixture. ADR-0136 step A is implemented; proposed infall and photosynthesis steps B/C do not silently become accepted M12 mechanics. +The [ownership resolution proposal](M12_ENVIRONMENT_OWNERSHIP_RESOLUTION.md) +records the actual public-API conflict, a composite-owner/checkpoint direction, +typed compartment and source requirements, worked balances and delivery segments. +It is a concrete design for review, not an implemented adapter or completed 12.5. + The engineering constitution requires stopping expansion at this architectural boundary and documenting the resolution. That does not prevent the independent worker scheduling correction or the dedicated exact population adapter above. @@ -192,6 +197,13 @@ add none. Prepare/stage/abort/commit races preserve the selected view. Unavailab or false evidence fails the whole query. Other viable stores, external clone provenance and accepted durable global reconciliation/freshness remain open. +ADR-0162's [bounded unscripted generations](M12_UNSCRIPTED_GENERATIONS.md) +qualify unchanged-controller rules-9 reproduction through four wildlife generations +in the declared finite rich four-founder matrix, with raw/cohort equality, +conservation, actual predation/twins and periodic exact restores. Scarce and rules-8 +controls retain their different outcomes. These are 4,000 simulated seconds per +case, not sustainable producer ecology or actual elapsed days. + Current expansion readiness: **no-go for M13 integration or World0 promotion** while these M12 integration/evidence gates remain open. This records the present engineering evidence, not a substitute for the later maintainer product review. diff --git a/docs/engineering/M12_UNSCRIPTED_GENERATIONS.md b/docs/engineering/M12_UNSCRIPTED_GENERATIONS.md new file mode 100644 index 0000000..5439070 --- /dev/null +++ b/docs/engineering/M12_UNSCRIPTED_GENERATIONS.md @@ -0,0 +1,109 @@ +# Bounded unscripted wildlife generations + +Authority: [ADR-0162](../adr/0162-bounded-unscripted-wildlife-generations.md). +This offline instrument measures real funded player-origin organisms under the +existing controller and rules 9. No controller, biology, persistence, default +opening or live region behavior changes. + +## Protocol + +The shared finite ecology fixture supplies the entire opening. Player founders +request a bud every 100 ticks until a real funded bud succeeds. All players then +freeze for the rest of the run; their biology is checked unchanged. Wildlife uses +only the production controller. There are no scripted wildlife actions, mutation +selections, injected adults, reserve grants or replenishment. Ancestry follows +actual retained parent IDs, including actual twins; it is not genotype diversity. + +The predeclared matrix uses four founders, rich finite resources and 80,000 ticks +on development seeds 0/1 and previously unmeasured hold-outs 2/3. Each case must +reach generation 3, retain living wildlife and produce births in its last quarter. +Raw and cohort execution compare complete canonical biology and bud, mutation and +growth reports every tick, with zero error permitted. Every tick checks complete +energy and C/N/P/other closure in both representations. Whole-genome conversion +alternates every 257 ticks. Both owners restore every 4,096 ticks, preserving +canonical bytes and the controller's next intentions. Controlled cells never enter +cohorts. The instrument reports conversion counts, member-ticks and ancestry by +founder. Rules-8 and resource-scarce controls run separately. + +## Exploratory baseline + +Before declaring the hold-outs, 80,000-tick raw rules-9 runs measured: + +| Seed | Founders | Wildlife births | Deepest generation | Peak wildlife | Final wildlife | +|---|---:|---:|---:|---:|---:| +| 0 | 1 | 12 | 2 | 7 | 5 | +| 1 | 1 | 21 | 3 | 9 | 8 | +| 7 | 1 | 30 | 4 | 10 | 9 | +| 19 | 1 | 28 | 3 | 11 | 8 | +| 0 | 4 | 102 | 4 | 37 | 32 | +| 1 | 4 | 97 | 4 | 39 | 31 | +| 7 | 4 | 94 | 4 | 35 | 28 | +| 19 | 4 | 124 | 4 | 39 | 36 | + +The first funded bud was tick 6,100 in every case. A rules-8 seed-7/one-founder +control had one birth, generation 1 and zero growth. The weaker single-founder +seed 0 is retained; no general all-opening or minimum-survival claim follows. + +## Declared matrix results + +The complete GCC 14.2 and MSVC 19.44 Release matrices pass with exact raw/cohort +biology, complete step/bud/mutation/growth reports and closure on every tick. +Their complete JSONL outputs match after newline normalization. Retained outputs: +[GCC](results/m12-unscripted-generations-gcc14.jsonl) and +[MSVC](results/m12-unscripted-generations-msvc1944.jsonl). + +| Seed | Role | Births | Generation | Final wildlife | Final-quarter births | Engulfments | Twin events | Funded growth steps | +|---|---|---:|---:|---:|---:|---:|---:|---:| +| 0 | Development | 102 | 4 | 32 | 42 | 70 | 26 | 17,860 | +| 1 | Development | 97 | 4 | 31 | 37 | 66 | 20 | 16,796 | +| 2 | Hold-out | 102 | 4 | 33 | 35 | 69 | 19 | 17,718 | +| 3 | Hold-out | 100 | 4 | 33 | 37 | 67 | 17 | 19,468 | + +Every founding ancestry produces wildlife: total births by root 100/101/102/103 +are 12/27/36/27, 25/12/26/34, 20/30/27/25 and 23/25/29/23 respectively. +The rich runs contain no starvation deaths; their 272 deaths are actual +engulfments. The 82 twin events count actual same-parent newborn pairs, including +any founder twins. These measurements qualify those interactions in this matrix; +they do not establish balance or all contention states. No failed spatial bud +placement was observed, so the run does not qualify that refusal path. + +Including controls, each full matrix covers **480,000 paired ticks**, 23,292 member +conversions, 2,993,603 cohort member-ticks and 114 paired restore checks (228 owner +restores). The rules-8 control retains one generation and zero growth. The scarce +control produces no buds or wildlife; its four active founders starve through the +normal biology. This is not a terminal-extinction acceptance record. + +Native MSVC 19.44 Release CTest passes **82/82, 19.29 s**, including the short +12,000-tick rules-8/rules-9 contract. The same short contract passes Clang 19.1 +ASan/UBSan. clang-tidy 19 and repository clang-format 19 pass. The first standalone +tidy invocation lacked the new target's compiler module map; building that analysis +target generated it and the final analysis passed. No production implementation +changed, so the already-qualified private persistence matrix was not repeated. + +## Reproduction + +After configuring the repository's Release preset and compiler environment: + +```text +cmake --build --preset release --target evo-cellular-generations +ctest --preset release -R cellular-unscripted-generations +build/release/evo-cellular-generations --qualify +build/release/evo-cellular-generations --seed 7 --founders 1 --ticks 80000 --rules 9 --rich 1 --paired 1 +``` + +On Windows the executable has the `.exe` suffix. `--verify` is the short CTest +contract: rules 8 and 9 each run 12,000 ticks with real funded birth, alternating +conversions and two restores. Rules 9 must grow; rules 8 must not. Failure is a +nonzero exit under NDEBUG as well as debug. Options and work are strictly bounded. +`--qualify` runs all four declared cases and both controls, retaining all case +results before reporting a failed ecological threshold. + +## Limits + +80,000 ticks equal 4,000 simulated seconds, not elapsed days. Rich finite contact +food does not establish sustainable producers, a complete nutrient cycle or a +joint cellular/environment owner. The inherited genome and production controller +are unchanged. This does not qualify automatic mutation, useful compression, +target-host costs, multi-host recovery, actual-days soak, terminal extinction, +returning-player enjoyment or M12 completion. No live/default upgrade or World0 +operation follows from this instrument. diff --git a/docs/engineering/VALIDATION.md b/docs/engineering/VALIDATION.md index da44866..4a74071 100644 --- a/docs/engineering/VALIDATION.md +++ b/docs/engineering/VALIDATION.md @@ -1,5 +1,56 @@ # Validation report +## 2026-10-19 - Bounded unscripted wildlife generations + +[ADR-0162](../adr/0162-bounded-unscripted-wildlife-generations.md) adds an offline +measurement executable and bounded CTest contract. Real funded player founders +bud; all players then freeze and unchanged production wildlife intentions drive +the rest. No biological, controller, persistence, default-opening or live-world +change. Full protocol, outputs, controls and limits are in +[the report](M12_UNSCRIPTED_GENERATIONS.md). + +Executed locally: + +- MSVC 19.44 Release full CTest **82/82 passed, 19.29 s**, with NDEBUG. The new + contract runs 12,000 ticks each on rules 8 and 9 with actual birth, growth, + conversions and periodic recovery. +- GCC 14.2 and MSVC 19.44 Release complete declared matrices passed **exit 0** + with identical full JSONL after newline normalization: six 80,000-tick + raw/cohort cases, including development seeds 0/1, hold-outs 2/3, rules-8 and + scarce controls. All rich cases reach generation 4, retain 31–33 wildlife and + produce 35–42 births in their final quarter. Their actual deaths include 272 + engulfments, and actual same-parent births include 82 twin events. +- All **480,000 paired ticks** compare complete canonical biology and full step, + bud, mutation and growth reports with zero error. Both owners conserve every + channel every tick; 23,292 conversions and 114 paired restore checks retain + exact biology, presence, history and next controller intentions. Player biology + remains unchanged after freezing. The final frozen GCC executable hash verifies; + both full runs used separately frozen executables. +- Clang 19.1 ASan/UBSan passes the same short rules-8/rules-9 contract, without + sanitizer reports. clang-tidy 19 and repository clang-format 19 pass. The first + direct tidy invocation lacked the new target's compiler module map; building + the target generated it, then final analysis passed. + +The weaker exploratory one-founder seed-0 outcome (generation 2) remains in the +report. No failed bud placement occurred in the declared rich matrix; that case +is not claimed covered. The scarce control has zero wildlife and four normal +founder starvation deaths, not accepted global extinction. The rich finite source +fixture demonstrates bounded reproduction, not self-sustaining producers or +actual elapsed days. Genomes and controller remain unchanged. No production +persistence code changed, so its previously passing full private matrix was not +repeated for this instrument. + +The same scope records the M12.5 environmental public-API/ownership conflict and +[a concrete resolution proposal](M12_ENVIRONMENT_OWNERSHIP_RESOLUTION.md), with +closed/open and water/food accounting examples. This is design review, not an +accepted chemistry implementation or a completed environmental gate. + +The DEV listener window is refreshed in the same commit to an absolute four-hour +deadline, **2026-10-19 20:32:47 UTC**. No live cluster action or World0 operation. +Offline rendered deployment policy passes: 75 objects in 74 files, 138 rendered +objects in 17 overlays, zero failures. Policy code is unchanged; the existing +46-case policy self-test result was not rerun for this value-only refresh. + ## 2026-10-19 - Durable migration of maturing wildlife [ADR-0161](../adr/0161-durable-maturing-wildlife-transfer.md)/schema 54 admits diff --git a/docs/engineering/results/m12-unscripted-generations-gcc14.jsonl b/docs/engineering/results/m12-unscripted-generations-gcc14.jsonl new file mode 100644 index 0000000..2d16b20 --- /dev/null +++ b/docs/engineering/results/m12-unscripted-generations-gcc14.jsonl @@ -0,0 +1,23 @@ +{"kind":"generations","seed":0,"rules":9,"founders":4,"ticks":80000,"first_bud":6100,"births":102,"deepest":4,"peak":37,"living":32,"adults":13,"growth":17860,"blocked_buds":0,"engulfed":70,"starved":0,"twin_events":26,"rich":true,"paired":true,"late_births":42,"conversions":5627,"cohort_member_ticks":723294,"restores":19} +{"kind":"ancestry","root":100,"births":12} +{"kind":"ancestry","root":101,"births":27} +{"kind":"ancestry","root":102,"births":36} +{"kind":"ancestry","root":103,"births":27} +{"kind":"generations","seed":1,"rules":9,"founders":4,"ticks":80000,"first_bud":6100,"births":97,"deepest":4,"peak":39,"living":31,"adults":12,"growth":16796,"blocked_buds":0,"engulfed":66,"starved":0,"twin_events":20,"rich":true,"paired":true,"late_births":37,"conversions":5528,"cohort_member_ticks":709956,"restores":19} +{"kind":"ancestry","root":100,"births":25} +{"kind":"ancestry","root":101,"births":12} +{"kind":"ancestry","root":102,"births":26} +{"kind":"ancestry","root":103,"births":34} +{"kind":"generations","seed":2,"rules":9,"founders":4,"ticks":80000,"first_bud":6100,"births":102,"deepest":4,"peak":39,"living":33,"adults":11,"growth":17718,"blocked_buds":0,"engulfed":69,"starved":0,"twin_events":19,"rich":true,"paired":true,"late_births":35,"conversions":5873,"cohort_member_ticks":754582,"restores":19} +{"kind":"ancestry","root":100,"births":20} +{"kind":"ancestry","root":101,"births":30} +{"kind":"ancestry","root":102,"births":27} +{"kind":"ancestry","root":103,"births":25} +{"kind":"generations","seed":3,"rules":9,"founders":4,"ticks":80000,"first_bud":6100,"births":100,"deepest":4,"peak":39,"living":33,"adults":14,"growth":19468,"blocked_buds":0,"engulfed":67,"starved":0,"twin_events":17,"rich":true,"paired":true,"late_births":37,"conversions":5976,"cohort_member_ticks":768763,"restores":19} +{"kind":"ancestry","root":100,"births":23} +{"kind":"ancestry","root":101,"births":25} +{"kind":"ancestry","root":102,"births":29} +{"kind":"ancestry","root":103,"births":23} +{"kind":"generations","seed":7,"rules":8,"founders":1,"ticks":80000,"first_bud":6100,"births":1,"deepest":1,"peak":1,"living":1,"adults":0,"growth":0,"blocked_buds":0,"engulfed":0,"starved":0,"twin_events":0,"rich":true,"paired":true,"late_births":0,"conversions":288,"cohort_member_ticks":37008,"restores":19} +{"kind":"ancestry","root":100,"births":1} +{"kind":"generations","seed":0,"rules":9,"founders":4,"ticks":80000,"first_bud":0,"births":0,"deepest":0,"peak":0,"living":0,"adults":0,"growth":0,"blocked_buds":0,"engulfed":0,"starved":4,"twin_events":0,"rich":false,"paired":true,"late_births":0,"conversions":0,"cohort_member_ticks":0,"restores":19} diff --git a/docs/engineering/results/m12-unscripted-generations-msvc1944.jsonl b/docs/engineering/results/m12-unscripted-generations-msvc1944.jsonl new file mode 100644 index 0000000..2d16b20 --- /dev/null +++ b/docs/engineering/results/m12-unscripted-generations-msvc1944.jsonl @@ -0,0 +1,23 @@ +{"kind":"generations","seed":0,"rules":9,"founders":4,"ticks":80000,"first_bud":6100,"births":102,"deepest":4,"peak":37,"living":32,"adults":13,"growth":17860,"blocked_buds":0,"engulfed":70,"starved":0,"twin_events":26,"rich":true,"paired":true,"late_births":42,"conversions":5627,"cohort_member_ticks":723294,"restores":19} +{"kind":"ancestry","root":100,"births":12} +{"kind":"ancestry","root":101,"births":27} +{"kind":"ancestry","root":102,"births":36} +{"kind":"ancestry","root":103,"births":27} +{"kind":"generations","seed":1,"rules":9,"founders":4,"ticks":80000,"first_bud":6100,"births":97,"deepest":4,"peak":39,"living":31,"adults":12,"growth":16796,"blocked_buds":0,"engulfed":66,"starved":0,"twin_events":20,"rich":true,"paired":true,"late_births":37,"conversions":5528,"cohort_member_ticks":709956,"restores":19} +{"kind":"ancestry","root":100,"births":25} +{"kind":"ancestry","root":101,"births":12} +{"kind":"ancestry","root":102,"births":26} +{"kind":"ancestry","root":103,"births":34} +{"kind":"generations","seed":2,"rules":9,"founders":4,"ticks":80000,"first_bud":6100,"births":102,"deepest":4,"peak":39,"living":33,"adults":11,"growth":17718,"blocked_buds":0,"engulfed":69,"starved":0,"twin_events":19,"rich":true,"paired":true,"late_births":35,"conversions":5873,"cohort_member_ticks":754582,"restores":19} +{"kind":"ancestry","root":100,"births":20} +{"kind":"ancestry","root":101,"births":30} +{"kind":"ancestry","root":102,"births":27} +{"kind":"ancestry","root":103,"births":25} +{"kind":"generations","seed":3,"rules":9,"founders":4,"ticks":80000,"first_bud":6100,"births":100,"deepest":4,"peak":39,"living":33,"adults":14,"growth":19468,"blocked_buds":0,"engulfed":67,"starved":0,"twin_events":17,"rich":true,"paired":true,"late_births":37,"conversions":5976,"cohort_member_ticks":768763,"restores":19} +{"kind":"ancestry","root":100,"births":23} +{"kind":"ancestry","root":101,"births":25} +{"kind":"ancestry","root":102,"births":29} +{"kind":"ancestry","root":103,"births":23} +{"kind":"generations","seed":7,"rules":8,"founders":1,"ticks":80000,"first_bud":6100,"births":1,"deepest":1,"peak":1,"living":1,"adults":0,"growth":0,"blocked_buds":0,"engulfed":0,"starved":0,"twin_events":0,"rich":true,"paired":true,"late_births":0,"conversions":288,"cohort_member_ticks":37008,"restores":19} +{"kind":"ancestry","root":100,"births":1} +{"kind":"generations","seed":0,"rules":9,"founders":4,"ticks":80000,"first_bud":0,"births":0,"deepest":0,"peak":0,"living":0,"adults":0,"growth":0,"blocked_buds":0,"engulfed":0,"starved":4,"twin_events":0,"rich":false,"paired":true,"late_births":0,"conversions":0,"cohort_member_ticks":0,"restores":19} diff --git a/experiments/resolution/cellular_generations.cpp b/experiments/resolution/cellular_generations.cpp new file mode 100644 index 0000000..2b5d136 --- /dev/null +++ b/experiments/resolution/cellular_generations.cpp @@ -0,0 +1,246 @@ +// ADR-0162: bounded real player-origin generations, not a game rule. +#include "../../tests/fixtures/cellular_ecology.hpp" +#include "evo/server/lifecycle/cellular_population.hpp" + +#include +#include + +namespace { +using namespace evo; +using namespace evo::server; +using namespace evo::fixture; +std::uint64_t number(std::string_view text) { + std::uint64_t value{}; + const auto parsed = std::from_chars(text.data(), text.data() + text.size(), value); + require(parsed.ec == std::errc{} && parsed.ptr == text.data() + text.size(), "invalid number"); + return value; +} +struct Result { + std::uint64_t births{}, late_births{}, living{}, growth{}, conversions{}, restores{}; + unsigned deepest{}; +}; +Result run(std::uint64_t seed, std::uint64_t ticks, std::uint32_t founders, bool maturing, + bool rich, bool paired) { + auto state = opening(seed, rich, founders); + if (maturing) { + state = checked(state->migration_upgrade_candidate(), "generation boundary upgrade"); + state = checked(state->maturation_upgrade_candidate(), "generation maturation upgrade"); + } + auto population = + paired ? checked(CellularPopulation::create(restore(*state)), "generation population") + : nullptr; + Result result; + std::map generations; + std::map roots, root_births; + for (const auto& life : state->lives()) { + generations.emplace(life.identity.life, 0); + roots.emplace(life.identity.life, life.identity.life); + } + std::uint64_t first_bud = 0, blocked_buds = 0, peak = 0, cohort_ticks = 0; + std::uint64_t engulfed = 0, starved = 0, twin_events = 0; + std::vector frozen_players; + // Once the first real funded bud succeeds, all controlled cells stay frozen. + // No wildlife intention, mutation, birth or resource is injected by this driver. + for (std::uint64_t index = 0; index < ticks; ++index) { + if (population && index % 257 == 0) { + std::set genomes; + for (const auto& life : state->lives()) + if (life.account == LifeAccount{}) + genomes.insert(life.identity.genome); + for (const auto genome : genomes) { + if ((index / 257) % 2 == 0) + result.conversions += + checked(population->collapse(genome), "generation collapse"); + else if (std::ranges::any_of(population->members(), [genome](const auto& member) { + return member.genome == genome; + })) + result.conversions += + checked(population->materialize(genome), "generation materialize"); + } + require(population->state().snapshot() == state->snapshot(), + "generation conversion changed biology"); + } + auto intents = checked(wildlife_intents(*state, state->tick() + 1), "generation wildlife"); + std::vector players; + for (const auto& life : state->lives()) { + if (life.account == LifeAccount{}) + continue; + CellularLifeIntent controlled{life.identity.life, {}}; + controlled.intent.frozen = first_bud != 0; + controlled.intent.bud = first_bud == 0 && (state->tick() + 1) % 100 == 0; + intents.push_back(controlled); + players.push_back(controlled); + if (population) + require(!population->in_cohort(life.identity.life), "player entered cohort"); + } + std::ranges::sort(intents, {}, &CellularLifeIntent::life_id); + const auto executed = + checked(state->advance_tick_with_mutations(intents, {}), "generation biology"); + if (population) { + const auto candidate = + checked(population->advance_tick(players), "generation paired tick"); + require(candidate.step == executed.step && candidate.buds == executed.buds && + candidate.mutations == executed.mutations && + candidate.growth == executed.growth, + "generation paired events diverged"); + require(population->state().snapshot() == state->snapshot(), + "generation paired biology diverged"); + require(population->state().current_total() == population->state().opening_total(), + "generation paired stock did not close"); + cohort_ticks += population->members().size(); + } + result.growth += executed.growth.size(); + for (const auto& bud : executed.buds) + blocked_buds += bud.result == CellularBudResult::no_placement; + for (const auto& corpse : executed.step.starved) { + engulfed += corpse.cause == biology::CellularDeathCause::engulfed; + starved += corpse.cause == biology::CellularDeathCause::starved; + } + std::map parent_births; + std::uint64_t living = 0; + for (const auto& life : state->lives()) { + if (life.account != LifeAccount{}) + continue; + ++living; + if (generations.contains(life.identity.life)) + continue; + const auto parent = generations.find(life.parent_life); + require(parent != generations.end(), "wildlife lacks retained player-origin parent"); + const auto generation = parent->second + 1; + generations.emplace(life.identity.life, generation); + const auto root = roots.at(life.parent_life); + roots.emplace(life.identity.life, root); + ++root_births[root]; + result.deepest = std::max(result.deepest, generation); + ++result.births; + ++parent_births[life.parent_life]; + result.late_births += index >= ticks * 3 / 4; + if (first_bud == 0) + first_bud = state->tick(); + } + for (const auto& [parent, count] : parent_births) { + static_cast(parent); + twin_events += count == 2; + } + peak = std::max(peak, living); + require(state->current_total() == state->opening_total(), "generation stock did not close"); + // Presence may change during disconnection. Frozen biology must not. + for (const auto& before : frozen_players) { + const auto after = + std::ranges::find(state->lives(), before.identity.life, + [](const auto& life) { return life.identity.life; }); + require(after != state->lives().end() && after->identity == before.identity && + after->growth == before.growth && after->position == before.position && + after->body == before.body && after->reserve == before.reserve && + after->mutation == before.mutation, + "frozen player biology changed"); + } + if (first_bud != 0 && frozen_players.empty()) + for (const auto& life : state->lives()) + if (life.account != LifeAccount{}) + frozen_players.push_back(life); + if (index % 4096 == 4095) { + const auto bytes = state->snapshot(); + const auto input = + checked(wildlife_intents(*state, state->tick() + 1), "before restore"); + state = restore(*state); + require(state->snapshot() == bytes && + checked(wildlife_intents(*state, state->tick() + 1), "after restore") == + input, + "generation raw restore changed bytes or controller"); + if (population) { + const auto envelope = population->snapshot(); + population = + checked(CellularPopulation::restore(envelope, state->world(), state->region(), + state->frame(), state->tick()), + "generation population restore"); + require(population->snapshot() == envelope && + population->state().snapshot() == bytes && + checked(wildlife_intents(population->state(), state->tick() + 1), + "population restored controller") == input, + "generation population restore diverged"); + } + ++result.restores; + } + } + std::uint64_t adults = 0; + for (const auto& life : state->lives()) + if (life.account == LifeAccount{}) { + ++result.living; + adults += life.growth.realized_per_thousand == 1000; + } + std::cout << "{\"kind\":\"generations\",\"seed\":" << seed + << ",\"rules\":" << state->rules_version() << ",\"founders\":" << founders + << ",\"ticks\":" << ticks << ",\"first_bud\":" << first_bud + << ",\"births\":" << result.births << ",\"deepest\":" << result.deepest + << ",\"peak\":" << peak << ",\"living\":" << result.living << ",\"adults\":" << adults + << ",\"growth\":" << result.growth << ",\"blocked_buds\":" << blocked_buds + << ",\"engulfed\":" << engulfed << ",\"starved\":" << starved + << ",\"twin_events\":" << twin_events << ",\"rich\":" << (rich ? "true" : "false") + << ",\"paired\":" << (paired ? "true" : "false") + << ",\"late_births\":" << result.late_births + << ",\"conversions\":" << result.conversions + << ",\"cohort_member_ticks\":" << cohort_ticks << ",\"restores\":" << result.restores + << "}\n"; + for (const auto& [root, count] : root_births) + std::cout << "{\"kind\":\"ancestry\",\"root\":" << root << ",\"births\":" << count << "}\n"; + std::cout.flush(); + return result; +} +} // namespace +int main(int argc, char** argv) try { + if (argc == 2 && std::string_view{argv[1]} == "--qualify") { + bool passed = true; + for (std::uint64_t seed = 0; seed < 4; ++seed) { + const auto result = run(seed, 80'000, 4, true, true, true); + passed = passed && result.deepest >= 3 && result.living > 0 && result.late_births > 0 && + result.conversions > 0 && result.restores > 0; + } + const auto legacy = run(7, 80'000, 1, false, true, true); + require(legacy.births > 0 && legacy.deepest == 1 && legacy.growth == 0, + "legacy generation control changed"); + const auto scarce = run(0, 80'000, 4, true, false, true); + require(scarce.births == 0 && scarce.living == 0, + "scarce opening unexpectedly funded wildlife"); + require(passed, "declared rich generation qualification failed; retain all results"); + return 0; + } + if (argc == 2 && std::string_view{argv[1]} == "--verify") { + for (const bool maturing : {false, true}) { + const auto result = run(7, 12'000, 1, maturing, true, true); + require(result.births > 0 && result.conversions > 0 && result.restores > 0, + "generation contract missed funded births/conversions/restores"); + require(maturing ? result.growth > 0 : (result.growth == 0 && result.deepest == 1), + "generation rule control failed"); + } + return 0; + } + std::uint64_t seed = 7, ticks = 40'000, founders = 1, rules = 9; + bool rich = true, paired = false; + require(argc % 2 == 1, "expected option/value pairs"); + for (int index = 1; index < argc; index += 2) { + const std::string_view option{argv[index]}; + const auto value = number(argv[index + 1]); + if (option == "--seed") + seed = value; + else if (option == "--ticks") + ticks = value; + else if (option == "--founders") + founders = value; + else if (option == "--rules") + rules = value; + else if (option == "--rich" || option == "--paired") { + require(value <= 1, "expected boolean zero or one"); + (option == "--rich" ? rich : paired) = value != 0; + } else + throw std::runtime_error("unknown generation option"); + } + require(seed <= 1'000'000 && ticks > 0 && ticks <= 1'000'000 && founders > 0 && + founders <= 16 && (rules == 8 || rules == 9), + "generation work bound"); + run(seed, ticks, static_cast(founders), rules == 9, rich, paired); + return 0; +} catch (const std::exception& error) { + std::cerr << error.what() << '\n'; + return 1; +}