Files
aevolution/include/evo/biology/cellular_step.hpp
T
dingo 1ccc0ce476
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m51s
Foundation / checks (client) (push) Failing after 4m32s
Foundation / checks (network) (push) Failing after 3m3s
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 52s
Foundation / checks (tsan) (push) Canceled after 24s
Foundation / checks (checks) (push) Canceled after 5m28s
Compose single-life cellular tick proposals
2026-10-10 21:24:39 -04:00

44 lines
1.7 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;
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 };
// 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{};
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