Files
aevolution/include/evo/server/lifecycle/cellular_light.hpp
T
dingoandClaude Opus 5.5 108f29eda5
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
feat(biology): evolve photosynthetic producers that capture light
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>
2026-10-19 18:06:02 -04:00

35 lines
1.7 KiB
C++

#pragma once
#include "evo/accounting/ledger.hpp"
#include "evo/biology/genome.hpp"
#include <compare>
#include <cstdint>
#include <optional>
namespace evo::server {
// ADR-0175 trial values: light on a region's habitat, as picojoules per square micrometre
// of a cell's cross-section per 50 ms tick (a rational), and the share a moving cell keeps.
inline constexpr std::uint64_t cellular_light_trial_irradiance = 40;
inline constexpr std::uint32_t cellular_light_trial_moving_per_thousand = 250;
// Declared light on one habitat. The entitlement bounds cumulative capture; light nobody
// captures is not modelled and never enters the books.
struct CellularLight {
std::uint64_t numerator{}, denominator{1};
accounting::Picojoules entitlement{};
std::uint32_t moving_per_thousand{cellular_light_trial_moving_per_thousand};
auto operator<=>(const CellularLight&) const = default;
};
[[nodiscard]] constexpr bool cellular_light_valid(const CellularLight& light) noexcept {
return light.denominator != 0 && light.moving_per_thousand <= 1000 &&
(light.numerator == 0) == (light.entitlement.value == 0);
}
// Energy one cell captures in a tick: cross-section (extent squared) x irradiance x its
// photosynthesis efficiency, reduced while moving, rounded down. Nothing for a genome
// without the capability. Nothing on overflow (refused, never wrapped).
[[nodiscard]] std::optional<std::uint64_t> cellular_light_capture(const biology::Genome& genome,
std::uint32_t extent_um,
const CellularLight& light,
bool moving) noexcept;
} // namespace evo::server