feat(biology): genome schema 6 movement arrangement and derived handling
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 5s
Foundation / checks (deploy) (push) Successful in 4m26s
Foundation / postgres-tools (push) Successful in 19s
Foundation / image (push) Successful in 3m57s
Foundation / server-image (push) Successful in 4m2s

Schema 6 genomes carry the body's movement arrangement for mutations 001-010 as
reference-point indices (100 = founder): output, efficiency, burst, steering,
streamlining, braking, anchor, coasting and colony drive. It is encoded after the
capability records and covered by the digest; older schemas refuse it, so their
capability tables and mutation catalogs are unchanged. Development version 6 and
founder 5 serve rules 12.

derive_cellular_handling scales the tuned founder handling by the arrangement:
output scales thrust, braking reverse thrust, steering turning; streamlining lowers
forward drag and coasting both drags. Full-output costs follow the metabolic
budget's movement cost times output over efficiency. Shed output or a missing
movement capability leaves only passive drift. Refreshes the DEV session window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-21 16:39:09 -04:00
co-authored by Claude Opus 5.5
parent ab5df35c3f
commit 2bffbc2095
16 changed files with 285 additions and 20 deletions
+12
View File
@@ -1,6 +1,7 @@
#pragma once
#include "evo/biology/cellular_kinematics.hpp"
#include "evo/biology/metabolism.hpp"
#include <compare>
#include <cstddef>
@@ -78,4 +79,15 @@ parse_cellular_tuning(std::string_view text);
[[nodiscard]] CellularHandling founder_cellular_handling(const CellularTuning& tuning,
accounting::Picojoules thrust_cost,
accounting::Picojoules reverse_cost);
enum class CellularHandlingError : std::uint8_t { unsupported_genome, unsupported_rate, overflow };
// Development 6: an organism's handling from its movement arrangement, scaled from the
// founder's tuned handling (index 100 = founder). Output scales thrust, braking scales
// reverse thrust, steering scales turning; streamlining lowers forward drag only and
// coasting lowers both, so a coasting body also tops out faster. Full-output costs per tick
// are the budget's full-speed movement cost times output (or braking) over efficiency.
// Without the movement capability or with shed output, the body cannot thrust or turn.
[[nodiscard]] std::expected<CellularHandling, CellularHandlingError>
derive_cellular_handling(const Genome& genome, const MetabolicBudget& budget,
const CellularTuning& tuning);
} // namespace evo::biology
+2 -2
View File
@@ -32,8 +32,8 @@ inline constexpr std::uint64_t development_v2_rate_microseconds = 1'000'000;
[[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 <= 5
? development_v2_rate_microseconds // Versions 3-5 keep version 2's rates.
: development_version >= 2 && development_version <= 6
? development_v2_rate_microseconds // Versions 3-6 keep version 2's rates.
: 0;
}
// Chosen constants, reviewable as a unit and selected by the genome's
+3
View File
@@ -37,6 +37,9 @@ inline constexpr FounderVersion primitive_founder_v3{genome_schema_v4, 4};
// Founder 4 serves rules 11 (ADR-0175): founder 3 that can evolve photosynthesis. Founders
// start without it; the capability is only ever earned through mutation.
inline constexpr FounderVersion primitive_founder_v4{genome_schema_v5, 5};
// Founder 5 serves rules 12 (Cellular_Region_Movement_Plan.md): founder 4 with the founder
// movement arrangement (every index at the 100-point reference).
inline constexpr FounderVersion primitive_founder_v5{genome_schema_v6, 6};
inline constexpr std::uint32_t primitive_founder_development_version =
primitive_founder_v1.development_version;
// The founder genome under a world-scoped identity and its origin event. Fails only on
+28 -4
View File
@@ -5,6 +5,7 @@
#include <cstddef>
#include <cstdint>
#include <expected>
#include <optional>
#include <span>
#include <vector>
@@ -99,6 +100,19 @@ struct CapabilityRecord {
std::uint32_t prerequisites{};
auto operator<=>(const CapabilityRecord&) const = default;
};
// Schema 6 (Cellular_movement_draft.md 001-010): the body's movement arrangement as
// indices in reference points, where 100 is the founder's arrangement. Burst, anchor and
// colony drive are acquired modules: 0 means absent. Output 0 means propulsion was shed
// (009); independent propulsion also needs the movement capability.
struct MovementArrangement {
std::uint16_t output{}, efficiency{}, burst{}, steering{}, streamlining{}, braking{}, anchor{},
coasting{}, colony_drive{};
auto operator<=>(const MovementArrangement&) const = default;
};
inline constexpr std::uint16_t movement_reference_points = 100;
inline constexpr std::uint16_t max_movement_points = 1'000;
inline constexpr MovementArrangement founder_movement_arrangement{100, 100, 0, 100, 100,
100, 0, 100, 0};
// Unvalidated input. Only Genome::create turns one into a record.
struct GenomeDraft {
std::uint64_t id{};
@@ -110,6 +124,8 @@ struct GenomeDraft {
// literal keeps its meaning (rates per 50 ms tick); new records name schema 2. Last,
// so positional initialisers are unaffected.
std::uint32_t schema_version{1};
// Required from schema 6 and refused before it.
std::optional<MovementArrangement> movement_arrangement{};
};
enum class GenomeError : std::uint8_t {
unsupported_version,
@@ -134,16 +150,19 @@ inline constexpr std::uint32_t genome_schema_v3 = 3;
inline constexpr std::uint32_t genome_schema_v4 = 4;
// Schema 5 (rules 11, ADR-0175): schema 4's steps with the photosynthesis capability.
inline constexpr std::uint32_t genome_schema_v5 = 5;
// Schema 6 (rules 12, Cellular_Region_Movement_Plan.md): schema 5's capabilities and steps
// plus the movement arrangement.
inline constexpr std::uint32_t genome_schema_v6 = 6;
// The newest schema. Older records stay valid and are never rewritten (ADR-0099).
inline constexpr std::uint32_t genome_schema_version = genome_schema_v5;
// The capability table of a supported schema (1 to 5); nullptr otherwise.
inline constexpr std::uint32_t genome_schema_version = genome_schema_v6;
// The capability table of a supported schema (1 to 6); nullptr otherwise.
[[nodiscard]] constexpr const std::array<CapabilitySpec, capability_count>*
capability_schema_for(std::uint32_t schema) noexcept {
return schema == genome_schema_v1 ? &capability_schema_v1
: schema == genome_schema_v2 || schema == genome_schema_v3 || schema == genome_schema_v4
? &capability_schema_v2
: schema == genome_schema_v5 ? &capability_schema_v5
: nullptr;
: schema == genome_schema_v5 || schema == genome_schema_v6 ? &capability_schema_v5
: nullptr;
}
inline constexpr std::size_t max_parents = 2;
inline constexpr std::size_t max_genome_bytes = 256;
@@ -182,6 +201,10 @@ class Genome {
[[nodiscard]] std::span<const CapabilityRecord> capabilities() const noexcept {
return capabilities_;
}
// Present exactly from schema 6.
[[nodiscard]] const std::optional<MovementArrangement>& movement_arrangement() const noexcept {
return movement_arrangement_;
}
[[nodiscard]] bool carries(Capability kind) const noexcept;
[[nodiscard]] std::expected<std::uint32_t, GenomeError>
parameter(Capability kind) const noexcept;
@@ -206,6 +229,7 @@ class Genome {
std::uint32_t development_version_{};
std::vector<std::uint64_t> parents_;
std::vector<CapabilityRecord> capabilities_;
std::optional<MovementArrangement> movement_arrangement_;
std::uint64_t digest_{};
};
} // namespace evo::biology