feat(biology): evolve photosynthetic producers that capture light
Foundation / checks (ecs) (push) Successful in 2m25s
Foundation / checks (deploy) (push) Successful in 5m15s
Foundation / checks (network) (push) Successful in 21m56s
Foundation / checks (client) (push) Successful in 22m54s
Foundation / checks (tsan) (push) Successful in 47m4s
Foundation / checks (postgres) (push) Successful in 1h15m49s
Foundation / checks (checks) (push) Failing after 1h30m4s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped
Foundation / checks (ecs) (push) Successful in 2m25s
Foundation / checks (deploy) (push) Successful in 5m15s
Foundation / checks (network) (push) Successful in 21m56s
Foundation / checks (client) (push) Successful in 22m54s
Foundation / checks (tsan) (push) Successful in 47m4s
Foundation / checks (postgres) (push) Successful in 1h15m49s
Foundation / checks (checks) (push) Failing after 1h30m4s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped
ADR-0175 implements ADR-0136 step C with trial costs to be balanced after playtesting. Genome schema 5 adds a photosynthesis efficiency (empty in schemas 1-4, so earlier offers and draws are unchanged; mutation operators 29-32 are appended). Development version 5 builds the organelles as internal membrane (p/4 of structure, upkept twice) and slows movement by p/2 per thousand. Founder 4 and cellular rules 11 let lineages earn the capability as an offspring plan that children express. Owner format 9 declares the region's light. Inside each tick's detached candidate, active unfrozen producers capture cross-section x irradiance x efficiency (a quarter while moving), credited to the reserve and boundary inflow together and replayed from recorded intentions. Well-lit wildlife producers hold still. The joint owner keeps infall, water and radiation and nests a rules-11 owner unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#include "evo/server/lifecycle/cellular_light.hpp"
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace evo::server {
|
||||
namespace {
|
||||
bool multiply(std::uint64_t& value, std::uint64_t factor) noexcept {
|
||||
if (factor != 0 && value > std::numeric_limits<std::uint64_t>::max() / factor)
|
||||
return false;
|
||||
value *= factor;
|
||||
return true;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
std::optional<std::uint64_t> cellular_light_capture(const biology::Genome& genome,
|
||||
std::uint32_t extent_um,
|
||||
const CellularLight& light,
|
||||
bool moving) noexcept {
|
||||
if (!genome.carries(biology::Capability::photosynthesis) || light.numerator == 0 ||
|
||||
light.denominator == 0)
|
||||
return 0;
|
||||
const auto efficiency = genome.parameter(biology::Capability::photosynthesis);
|
||||
if (!efficiency)
|
||||
return std::nullopt;
|
||||
// Exact checked products before the single rounding; overflow is refused.
|
||||
std::uint64_t energy = extent_um;
|
||||
if (!multiply(energy, extent_um) || !multiply(energy, light.numerator) ||
|
||||
!multiply(energy, *efficiency) || (moving && !multiply(energy, light.moving_per_thousand)))
|
||||
return std::nullopt;
|
||||
std::uint64_t divisor = light.denominator;
|
||||
if (!multiply(divisor, 1000) || (moving && !multiply(divisor, 1000)))
|
||||
return std::nullopt;
|
||||
return energy / divisor;
|
||||
}
|
||||
} // namespace evo::server
|
||||
Reference in New Issue
Block a user