ADR-0125 and the M11.5 plan define budding and wildlife descendants. The first piece is biology only: fund_bud pays the ADR-0032 investment and a 30 s provision from the parent's reserve, builds the bud at the largest growth the investment matter allows, and sends construction energy to heat, refusing with nothing spent when any channel is short. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
37 lines
1.8 KiB
C++
37 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include "evo/biology/metabolism.hpp"
|
|
|
|
#include <cstdint>
|
|
#include <expected>
|
|
|
|
// 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);
|
|
} // namespace evo::biology
|