Foundation / checks (ecs) (push) Successful in 2m20s
Foundation / checks (deploy) (push) Successful in 4m4s
Foundation / checks (tsan) (push) Successful in 9m59s
Foundation / checks (client) (push) Successful in 19m19s
Foundation / checks (network) (push) Successful in 19m24s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 32m13s
Foundation / checks (checks) (push) Canceled after 32m19s
The v10 cellular perception carries the bud cost after the diagnostics block: the energy (construction plus the bud's provision) and matter per channel one bud takes from a fully grown cell's reserve. biology::bud_cost reads it from fund_bud itself, so the shown cost is exactly the charge; the server caches it per genome. The client shows it and names the channels the reserve is short on. v10 clients must be rebuilt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
44 lines
2.3 KiB
C++
44 lines
2.3 KiB
C++
#pragma once
|
|
|
|
#include "evo/biology/metabolism.hpp"
|
|
|
|
#include <cstdint>
|
|
#include <expected>
|
|
#include <optional>
|
|
|
|
// M11.5 budding (ADR-0098 decision 1, ADR-0125): a funded proposal, detached from any
|
|
// owner. The parent pays its ADR-0032 reproduction investment and a starting provision
|
|
// from its reserve; nothing is drawn from its body.
|
|
namespace evo::biology {
|
|
// Seconds of the bud's full demand (maintenance plus full-speed movement) the parent
|
|
// provides as starting reserve energy: the founder's reserve rule (ADR-0100). Trial.
|
|
inline constexpr std::uint64_t bud_provision_seconds = 30;
|
|
|
|
struct BudTransition {
|
|
GrowthState growth{}; // the bud's, the largest the investment matter builds
|
|
accounting::Inventory body{}; // the bud's developed body
|
|
accounting::Inventory reserve; // the bud's: leftover matter and the provision
|
|
accounting::Inventory parent_reserve; // the parent's reserve after paying
|
|
accounting::Picojoules heat{}; // the investment's construction energy
|
|
auto operator<=>(const BudTransition&) const = default;
|
|
};
|
|
enum class BuddingError : std::uint8_t {
|
|
no_capability, // The genome cannot reproduce.
|
|
not_grown, // The parent is not fully realized, or is damaged.
|
|
insufficient_funding, // Some channel of investment plus provision is missing.
|
|
development // The genome's rules cannot develop it.
|
|
};
|
|
|
|
// Pure and deterministic. On every channel the parent's reserve before equals its reserve
|
|
// after plus the bud's body and reserve, plus heat in energy. A refusal spends nothing.
|
|
[[nodiscard]] std::expected<BudTransition, BuddingError>
|
|
fund_bud(const Genome& genome, GrowthState parent_growth,
|
|
const accounting::Inventory& parent_reserve, std::uint32_t temperature_millikelvin);
|
|
// What one bud takes from a fully grown, undamaged parent of this genome at this temperature
|
|
// (ADR-0129 amendment): investment matter per channel, and construction energy plus the
|
|
// bud's provision; exactly what `fund_bud` charges such a parent. Nullopt when the genome
|
|
// cannot bud or cannot build a cell from its investment.
|
|
[[nodiscard]] std::optional<accounting::Inventory> bud_cost(const Genome& genome,
|
|
std::uint32_t temperature_millikelvin);
|
|
} // namespace evo::biology
|