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
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:
@@ -1,4 +1,6 @@
|
||||
#include "evo/accounting/rates.hpp"
|
||||
#include "evo/biology/cellular_tuning.hpp"
|
||||
#include "evo/biology/founder.hpp"
|
||||
|
||||
#include <cstdio>
|
||||
#include <fstream>
|
||||
@@ -125,6 +127,81 @@ void founder_handling() {
|
||||
CHECK(handling.thrust_cost.value == 1'000 && handling.reverse_cost.value == 900);
|
||||
}
|
||||
|
||||
Genome founder_genome(const MovementArrangement& arrangement, bool movement = true) {
|
||||
const auto founder = primitive_founder(1, 1, primitive_founder_v5);
|
||||
check(founder.has_value());
|
||||
GenomeDraft draft{2, 2, 6, {1}, {}, genome_schema_v6, arrangement};
|
||||
for (const auto& record : founder->capabilities())
|
||||
if (movement || record.kind != Capability::movement)
|
||||
draft.capabilities.push_back(record);
|
||||
const auto genome = Genome::create(draft);
|
||||
check(genome.has_value());
|
||||
return *genome;
|
||||
}
|
||||
|
||||
CellularHandling handling_of(const Genome& genome) {
|
||||
const auto budget = metabolic_budget(genome, {1'000, 0}, {293'150, {}});
|
||||
check(budget.has_value());
|
||||
const auto handling = derive_cellular_handling(genome, *budget, v0());
|
||||
check(handling.has_value());
|
||||
return *handling;
|
||||
}
|
||||
|
||||
void derived_handling() {
|
||||
const auto founder = primitive_founder(1, 1, primitive_founder_v5);
|
||||
CHECK(founder && founder->movement_arrangement() == founder_movement_arrangement);
|
||||
const auto budget = metabolic_budget(*founder, {1'000, 0}, {293'150, {}});
|
||||
CHECK(budget);
|
||||
const auto base = handling_of(*founder);
|
||||
// The founder arrangement reproduces the tuned founder handling exactly.
|
||||
const auto full =
|
||||
*evo::accounting::per_tick(budget->movement.value, 50'000, evo::accounting::Rounding::up);
|
||||
CHECK(base == founder_cellular_handling(v0(), {full}, {full}));
|
||||
CHECK(full > 0);
|
||||
|
||||
auto a = founder_movement_arrangement;
|
||||
a.output = 105; // 001: more thrust, costing more per tick.
|
||||
const auto strong = handling_of(founder_genome(a));
|
||||
CHECK(strong.thrust_q10 == 21'504 && strong.thrust_cost.value > base.thrust_cost.value);
|
||||
CHECK(strong.reverse_thrust_q10 == base.reverse_thrust_q10);
|
||||
|
||||
a = founder_movement_arrangement;
|
||||
a.efficiency = 105; // 002: same thrust, cheaper.
|
||||
const auto economical = handling_of(founder_genome(a));
|
||||
CHECK(economical.thrust_q10 == base.thrust_q10 &&
|
||||
economical.thrust_cost.value < base.thrust_cost.value);
|
||||
|
||||
a = founder_movement_arrangement;
|
||||
a.steering = 105; // 004
|
||||
CHECK(handling_of(founder_genome(a)).turn == 3'439);
|
||||
|
||||
a = founder_movement_arrangement;
|
||||
a.streamlining = 105; // 005: forward drag only.
|
||||
const auto straight = handling_of(founder_genome(a));
|
||||
CHECK(straight.forward_drag_ppm == 90'631 && straight.lateral_drag_ppm == 95'163);
|
||||
|
||||
a = founder_movement_arrangement;
|
||||
a.braking = 105; // 006
|
||||
CHECK(handling_of(founder_genome(a)).reverse_thrust_q10 == 21'504);
|
||||
|
||||
a = founder_movement_arrangement;
|
||||
a.coasting = 105; // 008: both drags at 100/105, about 95.24%.
|
||||
const auto coaster = handling_of(founder_genome(a));
|
||||
CHECK(coaster.forward_drag_ppm == 90'631 && coaster.lateral_drag_ppm == 90'631);
|
||||
|
||||
a = founder_movement_arrangement;
|
||||
a.output = 0; // 009: shed propulsion drifts but cannot thrust or turn.
|
||||
const auto shed = handling_of(founder_genome(a));
|
||||
CHECK(shed.thrust_q10 == 0 && shed.reverse_thrust_q10 == 0 && shed.turn == 0);
|
||||
CHECK(shed.thrust_cost.value == 0 && shed.forward_drag_ppm == base.forward_drag_ppm);
|
||||
CHECK(handling_of(founder_genome(founder_movement_arrangement, false)).thrust_q10 == 0);
|
||||
|
||||
const auto old = primitive_founder(1, 1, primitive_founder_v4);
|
||||
CHECK(old);
|
||||
const auto old_budget = metabolic_budget(*old, {1'000, 0}, {293'150, {}});
|
||||
CHECK(old_budget && !derive_cellular_handling(*old, *old_budget, v0()));
|
||||
}
|
||||
|
||||
// The checked-in DEV tuning file must parse; CTest passes its path when it is present.
|
||||
void repository_file(const char* path) {
|
||||
std::ifstream file(path, std::ios::binary);
|
||||
@@ -145,6 +222,7 @@ int main(int argc, char** argv) {
|
||||
comments_separators_and_whitespace();
|
||||
refusals();
|
||||
founder_handling();
|
||||
derived_handling();
|
||||
if (argc > 1)
|
||||
repository_file(argv[1]);
|
||||
} catch (const std::exception& error) {
|
||||
|
||||
Reference in New Issue
Block a user