Files
aevolution/include/evo/biology/cellular_step.hpp
T
dingoandClaude Opus 5.5 0fb67c3257
Foundation / checks (ecs) (push) Successful in 2m17s
Foundation / checks (deploy) (push) Successful in 3m57s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 6m13s
Foundation / checks (checks) (push) Canceled after 6m19s
Foundation / checks (tsan) (push) Canceled after 3m58s
Foundation / checks (client) (push) Canceled after 6m17s
Foundation / checks (network) (push) Canceled after 6m18s
Resolve cellular engulfment and detritus in the region step
ADR-0124 implements ADR-0098's predation and corpse rules for the
cellular trial. Under rules 3 the pure region step adds an engulf phase
after every life's step: in ascending life id, a predator takes the
lowest-id contacted survivor whose total mass, times 1.5 per micrometre
of its membrane, is at most the predator's. The prey's whole inventory
moves once; the predator keeps what its remaining per-tick intake allows
and the rest, like every starvation corpse, becomes detritus in the
patch at the dead cell's 1 mm cell. Corpse candidates report their cause.
Rules 2 is unchanged and ignores engulf intents.

Owner, protocol v11, persistence and recovery wiring follow in the next
11.3f steps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 18:47:48 -04:00

54 lines
2.0 KiB
C++

#pragma once
#include "evo/biology/cellular_habitat.hpp"
#include <cstdint>
#include <optional>
namespace evo::biology {
struct CellularStepIntent {
CellularIntent movement{};
std::optional<CellularPatchAddress> intake_target;
// ADR-0124: take one smaller contacted cell after every life's step (rules 3 only).
// Exclusive with an intake target; the server chooses the prey.
bool engulf{};
auto operator<=>(const CellularStepIntent&) const = default;
};
enum class CellularStepError : std::uint8_t {
invalid_tick,
unsupported_rate_period,
insufficient_maintenance,
overflow,
motion
};
enum class CellularIntakeStatus : std::uint8_t { not_requested, acquired, missing, out_of_contact };
enum class CellularMovementStatus : std::uint8_t {
not_requested,
moved,
blocked,
insufficient_reserve
};
// Complete detached candidate for one 50 ms life tick. Maintenance is charged
// first; unaffordable motion leaves the cell stationary, then one targeted patch
// may be absorbed at the resulting position. Publication owns the final swap.
struct CellularStepCandidate {
std::uint64_t begin_tick{}, end_tick{};
CellularPosition position;
accounting::Inventory reserve_after;
accounting::Inventory heat_after;
accounting::Picojoules maintenance_cost{}, movement_cost{};
CellularMovementStatus movement_status{CellularMovementStatus::not_requested};
CellularIntakeStatus intake_status{CellularIntakeStatus::not_requested};
std::optional<CellularPatchUptakeProposal> intake;
auto operator<=>(const CellularStepCandidate&) const = default;
};
[[nodiscard]] std::expected<CellularStepCandidate, CellularStepError>
propose_cellular_step(std::uint64_t begin_tick, CellularArea area, CellularPosition position,
std::uint32_t extent_um, CellularStepIntent intent,
accounting::Inventory reserve, accounting::Inventory heat,
const MetabolicBudget& budget, const CellularHabitat& habitat) noexcept;
} // namespace evo::biology