feat(biology): liquid motion in the shared region tick
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 5s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 4m28s
Foundation / postgres-tools (push) Successful in 25s
Foundation / server-image (push) Successful in 4m3s
Foundation / image (push) Successful in 4m28s
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 5s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 4m28s
Foundation / postgres-tools (push) Successful in 25s
Foundation / server-image (push) Successful in 4m3s
Foundation / image (push) Successful in 4m28s
Rules 12 lives carry a liquid input (motion state, handling, brake and the local flow sample) and step through propose_liquid_cellular_step: maintenance first, then one kinematic tick funded from what is left, so unfundable thrust coasts with the current. A format-3 habitat requires liquid input on every life and older habitats refuse it. Contact feeding sweeps each liquid cell's whole path so a fast cell cannot pass over food; frozen cells keep their motion; corpse bubbles in a format-3 habitat count one merged bubble and use the larger deposit limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -84,6 +84,12 @@ struct CellularPatchPerception {
|
||||
// Whether a cell's square footprint touches a patch (format 1 square) or a deposit's disc.
|
||||
[[nodiscard]] bool cellular_patch_contact(CellularPosition position, std::uint32_t extent_um,
|
||||
const CellularPatch& patch) noexcept;
|
||||
// Whether a footprint moving in a straight line from `from` to `to` touches the deposit at any
|
||||
// point, sampled no further apart than half the smaller of the deposit's radius and the
|
||||
// footprint, so a fast cell cannot pass over food.
|
||||
[[nodiscard]] bool cellular_path_contact(CellularPosition from, CellularPosition to,
|
||||
std::uint32_t extent_um,
|
||||
const CellularPatch& patch) noexcept;
|
||||
enum class CellularHabitatError : std::uint8_t {
|
||||
invalid_config,
|
||||
invalid_patch,
|
||||
|
||||
@@ -39,6 +39,9 @@ struct CellularLifeStepInput {
|
||||
MetabolicBudget budget;
|
||||
std::uint32_t membrane_um{}; // Genome membrane thickness; contests engulfment (rules 3).
|
||||
std::uint64_t source{}; // Provenance for a detritus patch this life creates (rules 3).
|
||||
// Rules 12: liquid motion, required exactly when the habitat is format 3. The movement
|
||||
// intent becomes the propulsion command.
|
||||
std::optional<CellularLiquidInput> liquid{};
|
||||
auto operator<=>(const CellularLifeStepInput&) const = default;
|
||||
};
|
||||
enum class CellularEngulfStatus : std::uint8_t {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "evo/biology/cellular_habitat.hpp"
|
||||
#include "evo/biology/cellular_kinematics.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
@@ -48,12 +49,31 @@ struct CellularStepCandidate {
|
||||
CellularMovementStatus movement_status{CellularMovementStatus::not_requested};
|
||||
CellularIntakeStatus intake_status{CellularIntakeStatus::not_requested};
|
||||
std::optional<CellularPatchUptakeProposal> intake;
|
||||
// Rules 12 (liquid motion): the motion state after the tick and the path travelled.
|
||||
CellularMotionState motion{};
|
||||
std::uint64_t path_um{};
|
||||
auto operator<=>(const CellularStepCandidate&) const = default;
|
||||
};
|
||||
// Rules 12: liquid-relative motion inputs for one life (Cellular_Region_Movement_Plan.md).
|
||||
struct CellularLiquidInput {
|
||||
CellularMotionState motion;
|
||||
CellularHandling handling;
|
||||
CellularFlowSample flow; // Sampled at the footprint centre by the caller.
|
||||
bool brake{};
|
||||
auto operator<=>(const CellularLiquidInput&) 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;
|
||||
// Rules 12: maintenance first, then one kinematic tick funded from what is left; thrust it
|
||||
// cannot fund is not applied and the cell coasts with the flow. No targeted intake: liquid
|
||||
// regions feed by contact in the region step.
|
||||
[[nodiscard]] std::expected<CellularStepCandidate, CellularStepError>
|
||||
propose_liquid_cellular_step(std::uint64_t begin_tick, CellularArea area, CellularPosition position,
|
||||
std::uint32_t extent_um, CellularIntent movement,
|
||||
const CellularLiquidInput& liquid, accounting::Inventory reserve,
|
||||
accounting::Inventory heat, const MetabolicBudget& budget) noexcept;
|
||||
} // namespace evo::biology
|
||||
|
||||
Reference in New Issue
Block a user