Cellular rules 8: pools and bubbles fed by contact (ADR-0136 step A)
Foundation / checks (checks) (push) Successful in 47m40s
Foundation / checks (client) (push) Successful in 17m27s
Foundation / checks (deploy) (push) Successful in 4m17s
Foundation / checks (ecs) (push) Successful in 4m31s
Foundation / checks (network) (push) Successful in 22m1s
Foundation / checks (tsan) (push) Successful in 13m10s
Foundation / checks (postgres) (push) Successful in 20m54s
Foundation / image (push) Successful in 4m15s
Foundation / postgres-tools (push) Successful in 5m32s
Foundation / server-image (push) Successful in 7m15s
Foundation / checks (checks) (push) Successful in 47m40s
Foundation / checks (client) (push) Successful in 17m27s
Foundation / checks (deploy) (push) Successful in 4m17s
Foundation / checks (ecs) (push) Successful in 4m31s
Foundation / checks (network) (push) Successful in 22m1s
Foundation / checks (tsan) (push) Successful in 13m10s
Foundation / checks (postgres) (push) Successful in 20m54s
Foundation / image (push) Successful in 4m15s
Foundation / postgres-tools (push) Successful in 5m32s
Foundation / server-image (push) Successful in 7m15s
Square patches invited camping and left the space between them empty. Rules 8 run on a format-2 habitat of deposits: - pools and single-nutrient bubbles at free micrometre centres, each with a stable id and a contact radius; the cellular-v7 opening scatters bubbles reproducibly from the genesis commit (three in ten in loose clumps) and lists pools with --pool; - every cell drains what it touches, up to its intake rate per tick, with no target; a pool gives at most a quarter of that rate; an emptied deposit disappears; - a dead cell's detritus breaks into one bubble per non-empty channel; - wildlife swims to the nearest non-empty deposit and feeds by touch. Bundle v9 (habitat 2) and schema v43 admit it. Session v11 carries the owner's 512 nearest deposits (id, centre, radius, shape, a drained flag and 16-bit amount codes) instead of patches; every other cellular message is v10's. The client asks for v11, draws bubbles (nutrient-coloured, pulsing while drained, popping when gone) and pools as puddles, slows near food and sends no feed target; the HUD summarises food in range. Earlier rules, regions and v10 clients are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -18,25 +18,41 @@ 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;
|
||||
// ADR-0136 step A: format 2 holds deposits (pools and bubbles) at free micrometre centres,
|
||||
// each with a stable id, a radius and a kind, and the next id to give a new deposit.
|
||||
inline constexpr std::uint32_t cellular_habitat_deposit_format = 2;
|
||||
inline constexpr std::size_t cellular_habitat_header_bytes = 72;
|
||||
inline constexpr std::size_t cellular_patch_record_bytes = 56;
|
||||
inline constexpr std::size_t cellular_deposit_record_bytes = 64;
|
||||
inline constexpr std::size_t max_cellular_habitat_bytes =
|
||||
cellular_habitat_header_bytes + cellular_patch_record_bytes * max_cellular_patches + 8;
|
||||
cellular_habitat_header_bytes + cellular_deposit_record_bytes * max_cellular_patches + 8;
|
||||
// A bubble's contact radius (tunable); pools carry their own.
|
||||
inline constexpr std::uint32_t cellular_mote_radius_um = 30;
|
||||
inline constexpr std::uint32_t max_cellular_deposit_radius_um = 5'000;
|
||||
// A pool yields at most this share (per thousand) of a cell's intake rate per tick.
|
||||
inline constexpr std::uint64_t cellular_pool_yield_per_thousand = 250;
|
||||
enum class CellularDepositKind : std::uint8_t { patch, pool, mote };
|
||||
|
||||
struct CellularPatchAddress {
|
||||
std::uint32_t x_um{}, y_um{};
|
||||
auto operator<=>(const CellularPatchAddress&) const = default;
|
||||
};
|
||||
// Format 1: a 1 mm square patch at a pitch-aligned corner. Format 2: a deposit centred at
|
||||
// `address`, a disc of `radius_um`; `id` is stable and only labels it for clients.
|
||||
struct CellularPatch {
|
||||
CellularPatchAddress address;
|
||||
std::uint64_t source{}; // Explicit region-opening provenance.
|
||||
accounting::Inventory stock{};
|
||||
std::uint32_t id{}, radius_um{};
|
||||
CellularDepositKind kind{};
|
||||
auto operator<=>(const CellularPatch&) const = default;
|
||||
};
|
||||
struct CellularHabitatConfig {
|
||||
std::uint64_t world{}, region{}, frame{};
|
||||
std::uint32_t width_um{}, height_um{};
|
||||
std::vector<CellularPatch> patches; // Strictly ordered by (x_um, y_um).
|
||||
std::uint32_t format{cellular_habitat_format};
|
||||
std::uint32_t next_deposit{}; // Format 2: above every deposit id.
|
||||
auto operator<=>(const CellularHabitatConfig&) const = default;
|
||||
};
|
||||
struct CellularPatchUptakeProposal {
|
||||
@@ -48,8 +64,13 @@ struct CellularPatchUptakeProposal {
|
||||
struct CellularPatchPerception {
|
||||
CellularPatchAddress address;
|
||||
accounting::Inventory available;
|
||||
std::uint32_t id{}, radius_um{}; // Format 2 deposits; zero for format 1 patches.
|
||||
CellularDepositKind kind{};
|
||||
auto operator<=>(const CellularPatchPerception&) const = default;
|
||||
};
|
||||
// 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;
|
||||
enum class CellularHabitatError : std::uint8_t {
|
||||
invalid_config,
|
||||
invalid_patch,
|
||||
@@ -65,6 +86,21 @@ enum class CellularHabitatError : std::uint8_t {
|
||||
identity
|
||||
};
|
||||
|
||||
// ADR-0136 step A opening: bubbles scattered over the whole area. Each holds `amount` on
|
||||
// one channel (cycling through the channels `amount` stocks), three in ten of them in
|
||||
// loose clumps; positions follow `seed` only, so a genesis is reproducible.
|
||||
struct CellularMoteField {
|
||||
std::uint32_t count{};
|
||||
std::uint64_t source{};
|
||||
accounting::Inventory amount{}; // Per bubble, per channel.
|
||||
std::uint64_t seed{};
|
||||
};
|
||||
// A format-2 habitat of the given pools (centre, radius, source and stock; their ids and kind
|
||||
// are assigned) and the scattered bubbles, sorted by address with ids 1..n.
|
||||
[[nodiscard]] std::expected<CellularHabitatConfig, CellularHabitatError>
|
||||
scatter_deposits(CellularHabitatConfig base, std::span<const CellularPatch> pools,
|
||||
const CellularMoteField& field);
|
||||
|
||||
// Region-local finite food stock for the cellular trial. Empty/unlisted patches
|
||||
// contain no stock. This is a read/proposal owner; the caller commits its patch
|
||||
// and organism candidate together through the durable cellular state owner.
|
||||
|
||||
@@ -21,6 +21,10 @@ struct CellularRegionRules {
|
||||
// Rules 2 (false) is the original trial: engulf intents are ignored and starvation
|
||||
// corpses keep their inventory.
|
||||
bool engulf_and_detritus{};
|
||||
// ADR-0136 step A (format 2 habitats): every cell drains the deposits it touches, up to
|
||||
// its intake rate, with no intake target; pools yield at most a quarter of that rate.
|
||||
// A dead life's detritus becomes one bubble per non-empty channel.
|
||||
bool contact_feeding{};
|
||||
auto operator<=>(const CellularRegionRules&) const = default;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user