feat(cellular): session v14, bundle 15 and rules-13 wildlife
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m29s
Foundation / postgres-tools (push) Successful in 24s
Foundation / server-image (push) Successful in 4m33s
Foundation / image (push) Successful in 4m59s
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m29s
Foundation / postgres-tools (push) Successful in 24s
Foundation / server-image (push) Successful in 4m33s
Foundation / image (push) Successful in 4m59s
Session v14 carries the rules-13 revamp: a body block in the owner's view (members, emergence threshold, exclusions, Emerge open, payable energy, mass and the 20 traits), become, emerge and channel exclusions on actions, become on mutation choices, catalog offers (id, chance, cost) and the emerged ending. Older sessions never see a v14 field. The client shows Stay / Become offspring offers named from the shared catalog, continuing as a bud, the organism and its Emerge button, kept channels, the body and the emerged end screen. Bundle 15 (rules 13 on owner format 11) is durable: schema 60 admits it raw-only, stores become as bit 15 of the choice's operator, widens the action input and mutation results, and publishes the 14 -> 15 revamp profile migration. evo-world-clone opens cellular-v10 (cellular-v9 plus the revamp upgrade from --revamp-tuning), resumable and recoverable. Wildlife counts reserve matter as energy, waits for the bud fee, grows organisms one short of emerging, and hunts by the region step's rules-13 engulf test. The play summary adds organisms, offers and the spent pool. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -607,6 +607,117 @@ void v13_perception_carries_liquid_motion() {
|
||||
CHECK(!decode_session(old_brake));
|
||||
}
|
||||
|
||||
// Rules 13: v14 is v13 plus the revamp: the body block in the view, become, emerge and
|
||||
// exclusions on actions, become on choices, catalog offers and the emerged ending. Earlier
|
||||
// versions refuse every revamp field.
|
||||
void v14_carries_the_revamp() {
|
||||
CellularLifeDiagnostics d;
|
||||
d.reserve_energy_pj = 9;
|
||||
d.members = 3;
|
||||
d.emerge_members = 8;
|
||||
d.exclude = 0b0101;
|
||||
d.can_emerge = false;
|
||||
d.payable_energy_pj = 12'000;
|
||||
d.total_mass_fg = 24'000'000;
|
||||
for (std::size_t i = 0; i < d.traits.size(); ++i)
|
||||
d.traits.at(i) = static_cast<std::uint16_t>(100 + i);
|
||||
CellularPerception view{77, 7, {}, d};
|
||||
const auto bytes = encode_session(SessionMessage{view}, session_protocol_v14);
|
||||
CHECK(bytes.size() == session_header_bytes + 18 + 64 + 40 + 16 + 56 + 64);
|
||||
std::uint16_t version{};
|
||||
const auto decoded = decode_session(bytes, &version);
|
||||
CHECK(decoded && version == session_protocol_v14 &&
|
||||
std::get<CellularPerception>(*decoded) == view);
|
||||
CHECK(encode_session(SessionMessage{view}, session_protocol_v13).empty());
|
||||
// A life has at least one member; exclusions are four channels; the flag is 0 or 1.
|
||||
auto none = view;
|
||||
none.diagnostics->members = 0;
|
||||
CHECK(encode_session(SessionMessage{none}, session_protocol_v14).empty());
|
||||
constexpr std::size_t block = session_header_bytes + 18 + 64 + 40 + 16 + 56;
|
||||
auto bad = bytes;
|
||||
bad[block + 4] = 0x10;
|
||||
CHECK(!decode_session(bad));
|
||||
bad = bytes;
|
||||
bad[block + 5] = 2;
|
||||
CHECK(!decode_session(bad));
|
||||
bad = bytes;
|
||||
bad[block + 6] = 1;
|
||||
CHECK(!decode_session(bad));
|
||||
// A cleared view carries an empty block.
|
||||
CellularPerception cleared{78, 0, {}, std::nullopt};
|
||||
const auto empty = encode_session(SessionMessage{cleared}, session_protocol_v14);
|
||||
CHECK(std::get<CellularPerception>(*decode_session(empty)) == cleared);
|
||||
auto stray = empty;
|
||||
stray[block] = 1;
|
||||
CHECK(!decode_session(stray));
|
||||
|
||||
// Actions: become with a bud, emerge without a target, exclusions; v14 only.
|
||||
CellularAction become{1, 2, 3, 4, 0, 0, false, 0, 0};
|
||||
become.bud = true;
|
||||
become.become = true;
|
||||
become.exclude = 0x0F;
|
||||
CHECK(std::get<CellularAction>(*decode_session(
|
||||
encode_session(SessionMessage{become}, session_protocol_v14))) == become);
|
||||
CHECK(encode_session(SessionMessage{become}, session_protocol_v13).empty());
|
||||
auto lone = become;
|
||||
lone.bud = false;
|
||||
CHECK(encode_session(SessionMessage{lone}, session_protocol_v14).empty());
|
||||
CellularAction emerge{1, 2, 3, 4, 300, 0, false, 0, 0};
|
||||
emerge.emerge = true;
|
||||
CHECK(std::get<CellularAction>(*decode_session(
|
||||
encode_session(SessionMessage{emerge}, session_protocol_v14))) == emerge);
|
||||
auto feeding = emerge;
|
||||
feeding.engulf = true;
|
||||
CHECK(encode_session(SessionMessage{feeding}, session_protocol_v14).empty());
|
||||
auto wide = become;
|
||||
wide.exclude = 0x10;
|
||||
CHECK(encode_session(SessionMessage{wide}, session_protocol_v14).empty());
|
||||
auto forged = encode_session(SessionMessage{emerge}, session_protocol_v14);
|
||||
forged[session_header_bytes + 36] = 3; // Emerge with a bud.
|
||||
CHECK(!decode_session(forged));
|
||||
|
||||
// The canonical action input keeps them (schema 60).
|
||||
CellularActionInput input{9, 0, 0, false, 0, 0, false, true, false, true, false, 0b0011};
|
||||
const auto stored = encode_cellular_action_input(input);
|
||||
CHECK(stored[13] == 2 && stored[14] == 3 && decode_cellular_action_input(stored) == input);
|
||||
auto loose = stored;
|
||||
loose[12] = 0; // Become without the bud.
|
||||
CHECK(!decode_cellular_action_input(loose));
|
||||
|
||||
// Choices: become travels only on v14.
|
||||
CellularMutationAction choice{1, 2, 3, 40, 7, 1, 30, 12};
|
||||
choice.become = true;
|
||||
CHECK(std::get<CellularMutationAction>(*decode_session(
|
||||
encode_session(SessionMessage{choice}, session_protocol_v14))) == choice);
|
||||
CHECK(encode_session(SessionMessage{choice}, session_protocol_v13).empty());
|
||||
|
||||
// Offers name catalog mutations with a chance and a cost, nothing operator-shaped.
|
||||
CellularMutationOffer offer{40, 7, 1, 30, {}};
|
||||
CellularOfferedCandidate named{};
|
||||
named.operator_id = 12;
|
||||
named.parameter = 700'000;
|
||||
named.cost_energy_pj = 5;
|
||||
named.cost_matter_fg = {1, 2, 3, 4};
|
||||
offer.candidates.push_back(named);
|
||||
named.operator_id = 49;
|
||||
named.parameter = 10;
|
||||
offer.candidates.push_back(named);
|
||||
CHECK(std::get<CellularMutationOffer>(*decode_session(
|
||||
encode_session(SessionMessage{offer}, session_protocol_v14))) == offer);
|
||||
auto shaped = offer;
|
||||
shaped.candidates[0].capability = 1;
|
||||
CHECK(encode_session(SessionMessage{shaped}, session_protocol_v14).empty());
|
||||
auto certain = offer;
|
||||
certain.candidates[0].parameter = 1'000'001;
|
||||
CHECK(encode_session(SessionMessage{certain}, session_protocol_v14).empty());
|
||||
|
||||
// The emerged ending is v14's.
|
||||
CellularLifeEnded emerged{50, 7, CellularDeathReason::emerged};
|
||||
CHECK(std::get<CellularLifeEnded>(*decode_session(
|
||||
encode_session(SessionMessage{emerged}, session_protocol_v14))) == emerged);
|
||||
CHECK(encode_session(SessionMessage{emerged}, session_protocol_v13).empty());
|
||||
}
|
||||
|
||||
int main() {
|
||||
try {
|
||||
round_trip_and_version_gate();
|
||||
@@ -622,6 +733,7 @@ int main() {
|
||||
v11_perception_carries_deposits();
|
||||
v12_perception_carries_light_and_producers();
|
||||
v13_perception_carries_liquid_motion();
|
||||
v14_carries_the_revamp();
|
||||
std::puts(
|
||||
"PASS cellular protocol: v6 intention, v7 action, v8-v10 perception/action framing");
|
||||
} catch (const std::exception& error) {
|
||||
|
||||
Reference in New Issue
Block a user