Foundation / checks (checks) (push) Successful in 42m33s
Foundation / checks (deploy) (push) Successful in 4m11s
Foundation / checks (ecs) (push) Successful in 2m27s
Foundation / checks (network) (push) Successful in 19m23s
Foundation / checks (postgres) (push) Successful in 44m44s
Foundation / checks (tsan) (push) Successful in 9m53s
Foundation / checks (client) (push) Successful in 16m19s
Foundation / postgres-tools (push) Successful in 30s
Foundation / server-image (push) Successful in 3m14s
Foundation / image (push) Successful in 3m16s
The playtest found mutation offers the arena could never pay for. A mutation's matter cost is the real body difference (ADR-0118), so it cannot be discounted. Rules 6 cut it honestly: - genome schema 3 steps a third as far (1/300 of the range); - development version 3 charges a third of the construction energy (13 instead of 40 pJ per 1000 fg). Founder 2 uses both. The cellular-v5 opening creates rules-6 regions on bundle v7, which schema v41 admits. Existing lineages, regions and committed history are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
91 lines
5.0 KiB
C++
91 lines
5.0 KiB
C++
#pragma once
|
|
|
|
#include "evo/accounting/ledger.hpp"
|
|
#include "evo/biology/genome.hpp"
|
|
|
|
namespace evo::biology {
|
|
// What an organism has actually built and lost. Runtime state, never written
|
|
// back into the genome: heredity must not carry acquired condition.
|
|
struct GrowthState {
|
|
std::uint32_t realized_per_thousand{};
|
|
std::uint32_t damage_per_thousand{};
|
|
auto operator<=>(const GrowthState&) const = default;
|
|
};
|
|
struct EnvironmentState {
|
|
std::uint32_t temperature_millikelvin{};
|
|
// What is there to build from, per ledger channel. A single pool could not
|
|
// say that carbon is plentiful while nitrogen is not, which is the whole
|
|
// question once a body has a composition. Nothing here is spent or reserved.
|
|
accounting::Inventory available{};
|
|
auto operator<=>(const EnvironmentState&) const = default;
|
|
};
|
|
// Development version 1 is defined in ticks of this quantum: its per-tick constants and
|
|
// outputs, and the genome rates it reads (converted from per second, ADR-0099).
|
|
inline constexpr std::uint64_t development_v1_tick_microseconds = 50'000;
|
|
// Development version 2 (ADR-0099, M11.1) is defined per second: its rate constants and
|
|
// its rate outputs (maintenance, movement, ingestion) are per second.
|
|
inline constexpr std::uint64_t development_v2_rate_microseconds = 1'000'000;
|
|
// The period a development version's rates are per (phenotype maintenance, movement and
|
|
// ingestion; budget rates): 50 ms for version 1, one second for version 2; 0 when the
|
|
// version is unknown. Phenotypes are replicated unchanged, so the period is not a field
|
|
// of them: it follows from the genome's development version.
|
|
[[nodiscard]] constexpr std::uint64_t
|
|
development_rate_microseconds(std::uint32_t development_version) noexcept {
|
|
return development_version == 1 ? development_v1_tick_microseconds
|
|
: development_version == 2 || development_version == 3
|
|
? development_v2_rate_microseconds // Version 3 keeps version 2's rates.
|
|
: 0;
|
|
}
|
|
// Chosen constants, reviewable as a unit and selected by the genome's
|
|
// development version. Declared model parameters, not balance.
|
|
struct DevelopmentRules {
|
|
std::uint64_t structure_density; // femtograms per cubic micrometre
|
|
std::uint64_t membrane_density; // femtograms per cubic micrometre
|
|
std::uint64_t maintenance_per_kilogram; // picojoules per rate period per 1000 fg
|
|
std::uint64_t membrane_upkeep_per_kilo; // picojoules per rate period per 1000 fg
|
|
std::uint64_t construction_per_kilogram; // picojoules per 1000 fg built
|
|
std::uint64_t reference_surface; // square micrometres
|
|
std::uint32_t reference_temperature; // millikelvin
|
|
std::uint32_t growth_step_per_thousand; // most one plan may advance
|
|
};
|
|
// Dimensioned parameters derived from a genome and its runtime state. A derived
|
|
// phenotype is not a viability claim and holds no fitness score.
|
|
struct Phenotype {
|
|
std::uint64_t structural_mass{}; // femtograms
|
|
std::uint64_t membrane_mass{}; // femtograms
|
|
std::uint64_t total_mass{}; // femtograms
|
|
std::uint32_t extent{}; // micrometres, the cube-model side length
|
|
std::uint64_t surface{}; // square micrometres
|
|
std::uint64_t maintenance{}; // picojoules per rate period
|
|
std::uint32_t movement_speed{}; // micrometres per rate period; zero without the capability
|
|
std::uint64_t ingestion_rate{}; // femtograms per rate period; zero without the capability
|
|
std::uint32_t conversion_per_thousand{};
|
|
// Millikelvin beyond the genome's tolerance. A reported quantity, not a rule.
|
|
std::uint32_t thermal_shortfall{};
|
|
auto operator<=>(const Phenotype&) const = default;
|
|
};
|
|
// A proposal. It reserves nothing, pays for nothing and commits nothing; the
|
|
// matching transfer does not exist until M3.3.
|
|
struct DevelopmentPlan {
|
|
GrowthState after{};
|
|
std::uint64_t material_required{};
|
|
std::uint64_t energy_required{};
|
|
auto operator<=>(const DevelopmentPlan&) const = default;
|
|
};
|
|
enum class DevelopmentError : std::uint8_t { unsupported_rules, invalid_growth, overflow };
|
|
|
|
[[nodiscard]] std::expected<DevelopmentRules, DevelopmentError>
|
|
rules_for(std::uint32_t development_version);
|
|
// Pure: a phenotype is recomputed from retained inputs rather than cached, so a
|
|
// cached copy can always be checked against a recomputation.
|
|
[[nodiscard]] std::expected<Phenotype, DevelopmentError>
|
|
derive_phenotype(const Genome& genome, GrowthState growth, EnvironmentState environment);
|
|
// Advances realized growth toward the target by at most the rule step, reduced to
|
|
// the largest step the available mass and energy admit. This bounds by total mass
|
|
// only: it cannot see which elements a step consumes, so it is a proposal and not
|
|
// an affordability authority. `metabolic_budget` decides that, per channel, and
|
|
// can only narrow this further. Never repairs damage.
|
|
[[nodiscard]] std::expected<DevelopmentPlan, DevelopmentError>
|
|
plan_development(const Genome& genome, GrowthState growth, EnvironmentState environment);
|
|
} // namespace evo::biology
|