feat(lifecycle): rules 13 behaviour-weighted mutation offers in the owner
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 4s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 4m34s
Foundation / postgres-tools (push) Successful in 22s
Foundation / server-image (push) Successful in 4m16s
Foundation / image (push) Successful in 4m47s

Phase 3 of the cellular revamp build plan (ADR-0179), server half.

- Every owned, active rules-13 life gathers its activity each tick from every
  phase (thrust and drift, brake presses, feeding and the collection limits,
  matter burned by channel, energy by use, contact with larger cells, engulf
  outcomes, growth blocked by a channel, buds made, refused or lost young, the
  reserve against the body) and advances its 98 triggers and 49 affinity scores.
- Active play earns an offer every interval: eligible catalog mutations of the
  life's plan, weighted by affinity, drawn with the floored and capped chances
  and a seeded systematic draw (a retry draws the same offer). Wildlife,
  newborns and frozen cells earn nothing; a plan without schema-7 traits has no
  catalog.
- A choice must name the life's own pending offer. It edits the offspring plan
  (phase 4 turns this into the split), pays the mutation's tuned cost from the
  reserve (matter may stand in for its energy, excluded channels excepted) and
  reclaims it as seeded random bubbles, merging into the farthest deposit at the
  deposit limit. Unaffordable choices keep the offer; declines clear it.
- Offspring inherit affinity scores and lineage progress. Growth speed scales
  the growth step with a carried fraction.
- Format 11 persists the offer tunables and each life's mutation state; the
  revamp tuning file gains the offer keys and optional per-mutation overrides
  (mutation.<key>.<field>), defaulting to the catalog with zero costs.

Tests cover per-mutation overrides and refusals, the collection-limit flags,
offers from active play, founder-5 plans never offered, exact restore of a
pending offer, a choice editing only the plan and reclaiming its cost with
closure, unaffordable choices, declines, foreign choices, and thrust moving
affinity. Refreshes the DEV session window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-22 18:58:32 -04:00
co-authored by Claude Opus 5.5
parent 732d008aa1
commit 7e5775b6f7
14 changed files with 1137 additions and 38 deletions
@@ -1,7 +1,9 @@
#pragma once
#include "evo/biology/cellular_catalog.hpp"
#include "evo/biology/cellular_tuning.hpp"
#include <array>
#include <compare>
#include <cstddef>
#include <cstdint>
@@ -23,6 +25,8 @@ struct CellularRevampTuning {
std::int64_t body_essential_upkeep_per_mille{};
// Body: share of reserve matter carried as load on handling and thrust costs.
std::int64_t body_reserve_load_per_mille{};
// Body: growth per tick at growth speed 100, in hundredths of a per mille.
std::int64_t body_growth_per_tick_centi_mille{};
// Energy: picojoules 1,000 fg of each matter channel stand in for (burn efficiency 100).
std::int64_t energy_burn_carbon_pj_per_kfg{}, energy_burn_nitrogen_pj_per_kfg{},
energy_burn_phosphorus_pj_per_kfg{}, energy_burn_other_pj_per_kfg{};
@@ -33,8 +37,24 @@ struct CellularRevampTuning {
predation_kill_bubble_per_mille{};
// The spent pool's drip back into the region.
std::int64_t spent_drip_interval_ticks{}, spent_drip_bubble_pj{}, spent_drip_bubble_fg{};
// Mutation offers (Cellular_mutation_plan.md section 3).
std::int64_t mutation_options{}, mutation_floor_ppm{}, mutation_cap_ppm{};
std::int64_t mutation_score_min{}, mutation_score_max{};
std::int64_t mutation_max_multiplier_per_mille{}, mutation_min_multiplier_per_mille{};
std::int64_t mutation_offer_interval_ticks{};
std::int64_t mutation_min_points{}, mutation_max_points{}, mutation_recipe_min_share{};
std::int64_t mutation_max_offspring{}, mutation_carbon_for_light_fg{},
mutation_buds_for_adhesion{};
// Each catalog mutation's tunables, in catalog order. Optional keys
// `mutation.<key>.<field>` override the defaults from its spec.
std::array<CellularMutationTuning, cellular_catalog_size> mutations{};
auto operator<=>(const CellularRevampTuning&) const = default;
};
// A mutation's tunables as the file names them.
inline constexpr std::array<std::string_view, 15> cellular_mutation_tuning_fields{
"enabled", "base_weight", "increase_points", "decrease_points", "primary_step",
"paired_step", "spread_step", "increase_ticks", "decrease_ticks", "cost_e_pj",
"cost_c_fg", "cost_n_fg", "cost_p_fg", "cost_o_fg", "cost_scale_percent"};
[[nodiscard]] std::expected<CellularRevampTuning, CellularTuningError>
parse_cellular_revamp_tuning(std::string_view text);
+2
View File
@@ -61,6 +61,8 @@ struct CellularStepCandidate {
// Rules 13 (ADR-0179): reserve matter burned in place of energy, for the region's spent
// pool. Costs paid this way add no heat.
accounting::Inventory spent{};
// Rules 13: a collection limit held matter (or energy) back while food was left.
bool matter_limited{}, energy_limited{};
auto operator<=>(const CellularStepCandidate&) const = default;
};
// Rules 12: liquid-relative motion inputs for one life (Cellular_Region_Movement_Plan.md).