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
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:
@@ -3,6 +3,7 @@
|
||||
#include "evo/client/organism_view.hpp"
|
||||
#include "evo/network/session_protocol.hpp"
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
@@ -71,6 +72,16 @@ steer_cellular(const CellularControls& controls, client::Intention intention,
|
||||
result.intention.move_y = component(intention.move_y);
|
||||
return result;
|
||||
}
|
||||
// ADR-0129 amendment: what one bud needs that the reserve lacks, per channel: energy
|
||||
// first, then C, N, P and other matter. Nothing set when it can be paid; a genome that
|
||||
// cannot bud reports a zero cost, which this treats as affordable (the button is the guide).
|
||||
[[nodiscard]] inline std::array<bool, 5> bud_shortfall(const network::CellularLifeDiagnostics& d) {
|
||||
std::array<bool, 5> short_on{};
|
||||
short_on[0] = d.bud_cost_energy_pj > d.reserve_energy_pj;
|
||||
for (std::size_t i = 0; i < d.bud_cost_matter_fg.size(); ++i)
|
||||
short_on[i + 1] = d.bud_cost_matter_fg[i] > d.reserve_matter_fg[i];
|
||||
return short_on;
|
||||
}
|
||||
[[nodiscard]] inline bool can_fund(const network::CellularOfferedCandidate& candidate,
|
||||
const network::CellularLifeDiagnostics& reserve) {
|
||||
if (candidate.cost_energy_pj > reserve.reserve_energy_pj)
|
||||
|
||||
Reference in New Issue
Block a user