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
+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