Foundation / checks (client) (push) Successful in 5s
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m32s
Foundation / postgres-tools (push) Successful in 21s
Foundation / server-image (push) Successful in 4m12s
Foundation / image (push) Successful in 4m52s
Adhesion turns a cell into a two-member organism: one life with a member count, one genome and one reserve, developed as its genome with the target size times its members. The single cell ends as an empty merged corpse. An organism expresses accepted mutations as a whole, paid from its reserve; its buds add internal members (wildlife stops one short of the threshold); the extra members' mass loads its thrust. At the emergence threshold the Emerge intent exports the body and reserve through the boundary ledger and ends the life as emerged. Records the maintainer's 2026-10-23 decisions in ADR-0179 and the project vision (whole-organism mutations; the playtest form of Emerge). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
84 lines
5.1 KiB
C++
84 lines
5.1 KiB
C++
#pragma once
|
|
|
|
#include "evo/biology/metabolism.hpp"
|
|
|
|
#include <cstdint>
|
|
#include <expected>
|
|
#include <optional>
|
|
#include <utility>
|
|
|
|
// M11.5 budding (ADR-0098 decision 1, ADR-0125): a funded proposal, detached from any
|
|
// owner. The parent pays its ADR-0032 reproduction investment and a starting provision
|
|
// from its reserve; nothing is drawn from its body.
|
|
namespace evo::biology {
|
|
// Seconds of the bud's full demand (maintenance plus full-speed movement) the parent
|
|
// provides as starting reserve energy: the founder's reserve rule (ADR-0100). Trial.
|
|
inline constexpr std::uint64_t bud_provision_seconds = 30;
|
|
|
|
struct BudTransition {
|
|
GrowthState growth{}; // the bud's, the largest the investment matter builds
|
|
accounting::Inventory body{}; // the bud's developed body
|
|
accounting::Inventory reserve; // the bud's: leftover matter and the provision
|
|
accounting::Inventory parent_reserve; // the parent's reserve after paying
|
|
accounting::Picojoules heat{}; // the investment's construction energy
|
|
auto operator<=>(const BudTransition&) const = default;
|
|
};
|
|
enum class BuddingError : std::uint8_t {
|
|
no_capability, // The genome cannot reproduce.
|
|
not_grown, // The parent is not fully realized, or is damaged.
|
|
insufficient_funding, // Some channel of investment plus provision is missing.
|
|
development, // The genome's rules cannot develop it.
|
|
incompatible_genome // Distinct schema/development laws, or conflicting same-ID contents.
|
|
};
|
|
|
|
// Pure and deterministic. On every channel the parent's reserve before equals its reserve
|
|
// after plus the bud's body and reserve, plus heat in energy. A refusal spends nothing.
|
|
// `share` > 1 (ADR-0137 twins) funds one of that many buds from the same investment: each
|
|
// gets the investment divided by `share`, so twins are smaller, not extra.
|
|
[[nodiscard]] std::expected<BudTransition, BuddingError>
|
|
fund_bud(const Genome& genome, GrowthState parent_growth,
|
|
const accounting::Inventory& parent_reserve, std::uint32_t temperature_millikelvin,
|
|
std::uint32_t share = 1);
|
|
// ADR-0164: the expressed parent pays its own investment; the distinct inherited
|
|
// genome determines the newborn body/growth and its own provision. Both records
|
|
// must use the same schema/development versions. Inputs and parent anatomy are
|
|
// unchanged. This proposal confers no identity, placement, ancestry or control authority.
|
|
[[nodiscard]] std::expected<BudTransition, BuddingError>
|
|
fund_offspring(const Genome& parent, const Genome& offspring, GrowthState parent_growth,
|
|
const accounting::Inventory& parent_reserve, std::uint32_t temperature_millikelvin,
|
|
std::uint32_t share = 1);
|
|
// Exact charge for that pair and share from a full-grown, undamaged parent.
|
|
[[nodiscard]] std::optional<accounting::Inventory>
|
|
offspring_cost(const Genome& parent, const Genome& offspring, std::uint32_t temperature_millikelvin,
|
|
std::uint32_t share = 1);
|
|
// Rules 13 (ADR-0179; Cellular_reproduction_plan.md section 4): a mutation split. The parent's
|
|
// body and reserve divide per channel, the offspring taking `share_per_thousand` (rounded
|
|
// down); each cell then develops the largest growth its own genome builds from its part of the
|
|
// body, and matter beyond that joins its reserve. Nothing is built, burned or lost: on every
|
|
// channel the two bodies and reserves sum to the parent's. Refused, changing nothing, when
|
|
// the parent is below `min_growth` or damaged, or either part builds no cell at all.
|
|
struct SplitTransition {
|
|
GrowthState parent_growth{}, child_growth{};
|
|
accounting::Inventory parent_body{}, parent_reserve{}, child_body{}, child_reserve{};
|
|
auto operator<=>(const SplitTransition&) const = default;
|
|
};
|
|
[[nodiscard]] std::expected<SplitTransition, BuddingError>
|
|
split_cell(const Genome& parent, const Genome& child, GrowthState growth,
|
|
const accounting::Inventory& body, const accounting::Inventory& reserve,
|
|
std::uint32_t temperature_millikelvin, std::uint32_t share_per_thousand,
|
|
std::uint32_t min_growth, const BodyTuning& tuning = default_body_tuning);
|
|
// Rules 13: the largest growth whose body `genome` builds within `matter` on every channel and
|
|
// that body; nothing when even the smallest does not fit.
|
|
[[nodiscard]] std::expected<std::optional<std::pair<GrowthState, accounting::Inventory>>,
|
|
BuddingError>
|
|
largest_growth_within(const Genome& genome, const accounting::Inventory& matter,
|
|
std::uint32_t temperature_millikelvin,
|
|
const BodyTuning& tuning = default_body_tuning);
|
|
// What one bud takes from a fully grown, undamaged parent of this genome at this temperature
|
|
// (ADR-0129 amendment): investment matter per channel, and construction energy plus the
|
|
// bud's provision; exactly what `fund_bud` charges such a parent. Nullopt when the genome
|
|
// cannot bud or cannot build a cell from its investment.
|
|
[[nodiscard]] std::optional<accounting::Inventory> bud_cost(const Genome& genome,
|
|
std::uint32_t temperature_millikelvin);
|
|
} // namespace evo::biology
|