Add phenotype-derived cellular motion proposal
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m58s
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 (network) (push) Canceled after 6s
Foundation / checks (client) (push) Canceled after 2m14s
Foundation / checks (checks) (push) Canceled after 2m17s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m58s
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 (network) (push) Canceled after 6s
Foundation / checks (client) (push) Canceled after 2m14s
Foundation / checks (checks) (push) Canceled after 2m17s
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
|
||||
#include "evo/biology/metabolism.hpp"
|
||||
|
||||
#include <compare>
|
||||
#include <cstdint>
|
||||
#include <expected>
|
||||
|
||||
namespace evo::biology {
|
||||
inline constexpr std::uint64_t cellular_motion_tick_microseconds = 50'000;
|
||||
inline constexpr std::uint64_t cellular_motion_axis_limit_um = 1'000'000;
|
||||
inline constexpr std::int32_t cellular_intent_component_limit = 1'000;
|
||||
|
||||
struct CellularArea {
|
||||
std::uint64_t width_um{}, height_um{};
|
||||
auto operator<=>(const CellularArea&) const = default;
|
||||
};
|
||||
// Lower-left corner of the cell's square footprint, in micrometres.
|
||||
struct CellularPosition {
|
||||
std::uint64_t x_um{}, y_um{};
|
||||
auto operator<=>(const CellularPosition&) const = default;
|
||||
};
|
||||
// Bounded movement direction/magnitude, not a position or speed claim.
|
||||
struct CellularIntent {
|
||||
std::int16_t x{}, y{};
|
||||
auto operator<=>(const CellularIntent&) const = default;
|
||||
};
|
||||
struct CellularMotionProposal {
|
||||
CellularPosition position;
|
||||
std::uint64_t distance_um{}; // Conservative integer upper bound on actual travel.
|
||||
accounting::Picojoules movement_cost{};
|
||||
auto operator<=>(const CellularMotionProposal&) const = default;
|
||||
};
|
||||
enum class CellularMotionError : std::uint8_t {
|
||||
invalid_area,
|
||||
invalid_extent,
|
||||
outside_area,
|
||||
invalid_intent,
|
||||
unsupported_rate_period,
|
||||
overflow
|
||||
};
|
||||
|
||||
// Pure M11.3 proposal for one 50 ms tick. Costs are reported, not spent; the
|
||||
// authoritative state owner must apply the proposal only when its reserve can
|
||||
// fund the movement_cost. Only per-second development-v2 budgets are accepted.
|
||||
[[nodiscard]] std::expected<CellularMotionProposal, CellularMotionError>
|
||||
propose_cellular_motion(CellularArea area, CellularPosition position, std::uint32_t extent_um,
|
||||
CellularIntent intent, const MetabolicBudget& budget) noexcept;
|
||||
|
||||
// Axis-aligned square footprints touching at an edge count as in contact.
|
||||
[[nodiscard]] bool cellular_footprints_contact(CellularPosition a, std::uint32_t extent_a_um,
|
||||
CellularPosition b,
|
||||
std::uint32_t extent_b_um) noexcept;
|
||||
} // namespace evo::biology
|
||||
Reference in New Issue
Block a user