#pragma once #include "evo/accounting/ledger.hpp" #include "evo/biology/development.hpp" namespace evo::biology { // Shares in thousandths over the ledger's C/N/P/other channels, summing to 1000. // The last channel absorbs the rounding remainder, so a split conserves mass. using Composition = std::array; // Chosen constants, selected by the same development version as ADR-0031 and // reviewable as a unit. Declared model parameters, not balance. struct MetabolicRules { Composition structure; Composition membrane; // Picojoules per tick per 1000 femtograms at 1000 micrometres per tick. std::uint64_t movement_per_kilogram; // Picojoules of intake capacity per 1000 femtograms of it. std::uint64_t intake_energy_per_kilogram; }; // Every budget a phenotype implies. Each is derived from a different phenotype // quantity, so one genome parameter moves some and not others: none of this is a // multiplier applied to a total. struct MetabolicBudget { Phenotype phenotype; accounting::Inventory body; // matter only; a body is not energy accounting::Picojoules maintenance; // per tick accounting::Picojoules movement; // per tick at full speed, a capacity accounting::Picojoules demand; // maintenance plus movement accounting::Inventory construction; // what the next growth step would take accounting::Inventory intake_limit; // per tick // Zero without the reproduction capability, rather than a default. accounting::Inventory reproduction_investment; std::uint16_t assimilation_per_thousand{}; auto operator<=>(const MetabolicBudget&) const = default; }; [[nodiscard]] std::expected metabolic_rules_for(std::uint32_t development_version); // The single place the genome's description of capability becomes ledger // quantities. The genome record itself stays free of accounting types. [[nodiscard]] std::expected metabolic_budget(const Genome& genome, GrowthState growth, EnvironmentState environment); } // namespace evo::biology