#pragma once #include "evo/biology/cellular_habitat.hpp" #include #include namespace evo::biology { struct CellularStepIntent { CellularIntent movement{}; std::optional 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{}; // ADR-0125: fund and place one wildlife bud after the tick's mutations (rules 4 only). // Exclusive with an intake target and with engulfment; the owner decides everything. bool bud{}; // ADR-0128: the owner is offline; the cell does nothing this tick (no maintenance, // movement, intake or heat) but can still be engulfed. Exclusive with every other field. bool frozen{}; 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 intake; auto operator<=>(const CellularStepCandidate&) const = default; }; [[nodiscard]] std::expected 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