Bud unowned wildlife from the cellular owner under rules 4
Owner format 5 / rules 4 (ADR-0125) adds the bud intent: after the tick's mutations a parent pays fund_bud's investment and provision, and the bud is placed touching it with the next region-namespace identity, the parent's current genome and its parent life. Buds are wildlife with no account and never earn mutation offers; restore enforces the identity namespace and sequence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,21 @@ inline constexpr std::uint32_t cellular_lives_rules = 2;
|
||||
// corpse detritus. They are used together, with the revision-format archive.
|
||||
inline constexpr std::uint32_t cellular_lives_engulf_format = 4;
|
||||
inline constexpr std::uint32_t cellular_lives_engulf_rules = 3;
|
||||
// ADR-0125: format 5 adds the region's bud sequence and each life's and corpse's parent
|
||||
// life; rules 4 add funded budding of unowned wildlife on top of rules 3.
|
||||
inline constexpr std::uint32_t cellular_lives_bud_format = 5;
|
||||
inline constexpr std::uint32_t cellular_lives_bud_rules = 4;
|
||||
// A bud's life, organism and event identity: 2^63 + region * 2^32 + sequence. The world
|
||||
// allocator stays at or below 2^63 (schema v36), so the namespaces never meet.
|
||||
inline constexpr std::uint64_t cellular_bud_namespace = std::uint64_t{1} << 63U;
|
||||
inline constexpr std::uint64_t cellular_bud_max_region = (std::uint64_t{1} << 31U) - 1;
|
||||
[[nodiscard]] constexpr std::uint64_t cellular_bud_identity(std::uint64_t region,
|
||||
std::uint64_t sequence) noexcept {
|
||||
return region == 0 || region > cellular_bud_max_region || sequence == 0 ||
|
||||
sequence > 0xFFFF'FFFFULL
|
||||
? 0
|
||||
: cellular_bud_namespace + (region << 32U) + sequence;
|
||||
}
|
||||
inline constexpr std::size_t max_cellular_lives_bytes = std::size_t{16} * 1024 * 1024;
|
||||
inline constexpr std::uint64_t cellular_mutation_surplus_seconds = 60;
|
||||
inline constexpr std::uint16_t cellular_mutation_candidate_count = 3;
|
||||
@@ -44,6 +59,7 @@ struct CellularOwnedLife {
|
||||
accounting::Inventory body{};
|
||||
accounting::Inventory reserve{};
|
||||
CellularMutationProgress mutation{};
|
||||
std::uint64_t parent_life{}; // Format 5: the budding parent; zero for a founder.
|
||||
auto operator<=>(const CellularOwnedLife&) const = default;
|
||||
};
|
||||
struct CellularOwnedCorpse {
|
||||
@@ -57,6 +73,7 @@ struct CellularOwnedCorpse {
|
||||
accounting::Inventory inventory{}; // Empty under rules 3: it became detritus.
|
||||
biology::CellularDeathCause cause{biology::CellularDeathCause::unrecorded};
|
||||
std::uint64_t predator_life{}; // Engulfed only.
|
||||
std::uint64_t parent_life{}; // Format 5: kept after death.
|
||||
auto operator<=>(const CellularOwnedCorpse&) const = default;
|
||||
};
|
||||
struct CellularLifeIntent {
|
||||
@@ -75,9 +92,22 @@ struct CellularMutationExecution {
|
||||
CellularMutationResult result{};
|
||||
auto operator<=>(const CellularMutationExecution&) const = default;
|
||||
};
|
||||
enum class CellularBudResult : std::uint8_t {
|
||||
budded,
|
||||
life_died, // The parent died earlier in the tick.
|
||||
not_able, // No reproduction capability, not fully grown, or damaged.
|
||||
insufficient_funding, // Some channel of investment plus provision is missing.
|
||||
no_placement // No free spot touching the parent, or no identity left.
|
||||
};
|
||||
struct CellularBudExecution {
|
||||
std::uint64_t parent_life{}, bud_life{}; // bud_life is zero unless budded.
|
||||
CellularBudResult result{};
|
||||
auto operator<=>(const CellularBudExecution&) const = default;
|
||||
};
|
||||
struct CellularTickExecution {
|
||||
biology::CellularRegionStepCandidate step;
|
||||
std::vector<CellularMutationExecution> mutations;
|
||||
std::vector<CellularBudExecution> buds; // Rules 4, in parent life order.
|
||||
};
|
||||
struct CellularLifeTickFeedback {
|
||||
std::uint64_t life_id{}, tick{};
|
||||
@@ -87,11 +117,14 @@ struct CellularLifeTickFeedback {
|
||||
biology::CellularIntakeStatus intake{biology::CellularIntakeStatus::not_requested};
|
||||
biology::CellularEngulfStatus engulf{biology::CellularEngulfStatus::not_requested};
|
||||
std::uint64_t prey_life{};
|
||||
std::optional<CellularBudResult> bud; // Rules 4, when this life asked to bud.
|
||||
std::uint64_t bud_life{};
|
||||
auto operator<=>(const CellularLifeTickFeedback&) const = default;
|
||||
};
|
||||
// Which owner version a new region starts on. Offers: format 2, rules 2 (the M11.3/11.4
|
||||
// trial, upgraded by the no-tick migrations). Engulf: format 4, rules 3 (ADR-0124).
|
||||
enum class CellularLivesProfile : std::uint8_t { offers, engulf };
|
||||
// Budding: format 5, rules 4 (ADR-0125).
|
||||
enum class CellularLivesProfile : std::uint8_t { offers, engulf, budding };
|
||||
struct CellularLivesConfig {
|
||||
biology::CellularArea area{};
|
||||
std::uint64_t tick{};
|
||||
@@ -139,6 +172,8 @@ class CellularLives {
|
||||
[[nodiscard]] std::uint64_t tick() const noexcept;
|
||||
[[nodiscard]] std::uint32_t format_version() const noexcept;
|
||||
[[nodiscard]] std::uint32_t rules_version() const noexcept;
|
||||
// Format 5: the sequence the next bud's identity will use (ADR-0125).
|
||||
[[nodiscard]] std::uint64_t next_bud_sequence() const noexcept;
|
||||
[[nodiscard]] std::uint32_t ambient_temperature_millikelvin() const noexcept;
|
||||
[[nodiscard]] biology::CellularArea area() const noexcept;
|
||||
[[nodiscard]] std::span<const CellularOwnedLife> lives() const noexcept;
|
||||
|
||||
Reference in New Issue
Block a user