Show what a bud costs (ADR-0129 amendment)
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>
This commit is contained in:
dingo
2026-10-15 19:11:28 -04:00
co-authored by Claude Opus 5.5
parent a97f0c3fea
commit d98d71e7c0
13 changed files with 225 additions and 13 deletions
+18
View File
@@ -77,4 +77,22 @@ std::expected<BudTransition, BuddingError> fund_bud(const Genome& genome, Growth
}
return std::unexpected{BuddingError::insufficient_funding}; // Too little to build a cell.
}
std::optional<accounting::Inventory> bud_cost(const Genome& genome,
std::uint32_t temperature_millikelvin) {
// Fund against an ample reserve and read the charge: one code path decides both.
constexpr std::uint64_t ample = std::uint64_t{1} << 60U;
const accounting::Inventory unlimited{
{ample},
{accounting::Femtograms{ample}, accounting::Femtograms{ample},
accounting::Femtograms{ample}, accounting::Femtograms{ample}}};
const auto funded = fund_bud(genome, {1000, 0}, unlimited, temperature_millikelvin);
if (!funded)
return std::nullopt;
accounting::Inventory cost;
cost.energy.value = ample - funded->parent_reserve.energy.value;
for (std::size_t channel = 0; channel < cost.matter.size(); ++channel)
cost.matter[channel].value = ample - funded->parent_reserve.matter[channel].value;
return cost;
}
} // namespace evo::biology