Add bounded cellular resource perception
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (network) (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (client) (push) Canceled after 1m8s
Foundation / checks (checks) (push) Canceled after 1m13s
Foundation / checks (ecs) (push) Canceled after 1m4s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (network) (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (client) (push) Canceled after 1m8s
Foundation / checks (checks) (push) Canceled after 1m13s
Foundation / checks (ecs) (push) Canceled after 1m4s
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
|
||||
namespace evo::biology {
|
||||
inline constexpr std::uint32_t cellular_patch_pitch_um = 1'000;
|
||||
inline constexpr std::uint32_t cellular_trial_perception_radius_um = 5'000;
|
||||
inline constexpr std::size_t max_cellular_patches = 4'096;
|
||||
inline constexpr std::uint32_t cellular_habitat_format = 1;
|
||||
inline constexpr std::size_t cellular_habitat_header_bytes = 72;
|
||||
@@ -43,6 +44,12 @@ struct CellularPatchUptakeProposal {
|
||||
CellularUptakeProposal transfer;
|
||||
auto operator<=>(const CellularPatchUptakeProposal&) const = default;
|
||||
};
|
||||
// Client-safe view of an in-range patch. Provenance remains server-owned.
|
||||
struct CellularPatchPerception {
|
||||
CellularPatchAddress address;
|
||||
accounting::Inventory available;
|
||||
auto operator<=>(const CellularPatchPerception&) const = default;
|
||||
};
|
||||
enum class CellularHabitatError : std::uint8_t {
|
||||
invalid_config,
|
||||
invalid_patch,
|
||||
@@ -50,6 +57,7 @@ enum class CellularHabitatError : std::uint8_t {
|
||||
overflow,
|
||||
missing_patch,
|
||||
uptake,
|
||||
outside_area,
|
||||
format,
|
||||
version,
|
||||
checksum,
|
||||
@@ -73,6 +81,10 @@ class CellularHabitat {
|
||||
[[nodiscard]] std::span<const CellularPatch> patches() const noexcept;
|
||||
[[nodiscard]] accounting::Inventory totals() const noexcept;
|
||||
[[nodiscard]] std::optional<std::size_t> find(CellularPatchAddress address) const noexcept;
|
||||
// Returns patch stock only within the fixed M11.3 sensor radius. Patches
|
||||
// are visible when the organism-to-patch-square gap is within that radius.
|
||||
[[nodiscard]] std::expected<std::vector<CellularPatchPerception>, CellularHabitatError>
|
||||
perceive(CellularPosition position, std::uint32_t extent_um) const;
|
||||
[[nodiscard]] std::expected<CellularPatchUptakeProposal, CellularHabitatError>
|
||||
propose_uptake(CellularPatchAddress address, accounting::Inventory reserve,
|
||||
const MetabolicBudget& budget) const noexcept;
|
||||
|
||||
Reference in New Issue
Block a user