M11.1: genome schema 2 with per-second rates (ADR-0099, segment 2)
Foundation / checks (deploy) (push) Successful in 3m32s
Foundation / checks (ecs) (push) Successful in 1m56s
Foundation / checks (client) (push) Successful in 12m56s
Foundation / checks (network) (push) Successful in 13m46s
Foundation / checks (tsan) (push) Successful in 7m59s
Foundation / checks (checks) (push) Successful in 33m36s
Foundation / checks (postgres) (push) Successful in 45m30s
Foundation / postgres-tools (push) Successful in 20s
Foundation / server-image (push) Successful in 25s
Foundation / image (push) Successful in 2m36s
Foundation / checks (deploy) (push) Successful in 3m32s
Foundation / checks (ecs) (push) Successful in 1m56s
Foundation / checks (client) (push) Successful in 12m56s
Foundation / checks (network) (push) Successful in 13m46s
Foundation / checks (tsan) (push) Successful in 7m59s
Foundation / checks (checks) (push) Successful in 33m36s
Foundation / checks (postgres) (push) Successful in 45m30s
Foundation / postgres-tools (push) Successful in 20s
Foundation / server-image (push) Successful in 25s
Foundation / image (push) Successful in 2m36s
Movement and ingestion are stored per second in schema 2 (ranges x20). Schema 1 records stay valid, are never rewritten, and read as exactly x20 via Genome::per_second; drafts default to schema 1 so existing literals keep their meaning. Development version 1 converts genome rates at its own 50 ms quantum (round down), so phenotypes are unchanged. Mutation keeps the parent's schema and step; the lineage archive header names exactly the highest schema held (all-schema-1 archives keep their bytes); the development-v1 opening names schema 1. No golden changed; two tests that used 2 as an unknown schema now use the next one. Refresh the dev session window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#include "evo/biology/development.hpp"
|
||||
|
||||
#include "evo/accounting/rates.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
|
||||
@@ -96,13 +98,23 @@ derive_phenotype(const Genome& genome, GrowthState growth, EnvironmentState envi
|
||||
phenotype.conversion_per_thousand =
|
||||
static_cast<std::uint32_t>(*genome.parameter(Capability::energy_conversion));
|
||||
// A capability the genome does not carry yields nothing, whatever the size.
|
||||
// Development version 1 is defined in 50 ms ticks: genome rates (per second) enter it
|
||||
// at that quantum, rounded down as capacities (ADR-0099; exact for schema 1 records).
|
||||
const auto rate_per_tick = [](std::uint64_t per_second) {
|
||||
return accounting::per_tick(per_second, development_v1_tick_microseconds,
|
||||
accounting::Rounding::down);
|
||||
};
|
||||
if (genome.carries(Capability::movement)) {
|
||||
phenotype.movement_speed =
|
||||
static_cast<std::uint32_t>(*genome.parameter(Capability::movement));
|
||||
const auto speed = rate_per_tick(*genome.per_second(Capability::movement));
|
||||
if (!speed || *speed > std::numeric_limits<std::uint32_t>::max()) {
|
||||
return std::unexpected{DevelopmentError::overflow};
|
||||
}
|
||||
phenotype.movement_speed = static_cast<std::uint32_t>(*speed);
|
||||
}
|
||||
if (genome.carries(Capability::ingestion)) {
|
||||
const auto intake = rate_per_tick(*genome.per_second(Capability::ingestion));
|
||||
std::uint64_t uptake{};
|
||||
if (!multiply(uptake, *genome.parameter(Capability::ingestion), phenotype.surface)) {
|
||||
if (!intake || !multiply(uptake, *intake, phenotype.surface)) {
|
||||
return std::unexpected{DevelopmentError::overflow};
|
||||
}
|
||||
phenotype.ingestion_rate = uptake / rules->reference_surface;
|
||||
|
||||
Reference in New Issue
Block a user