feat(v4): Phase 7 Task 2a -- decay, heat, temperature and the rolling window at every call (#189)
As v3's physics_pre_execute, in its order (Captain Bob, 2026-11-13: "Every call, as v3"): a word's heat decays by the ticks since its last touch at the node's decay slope (Q48.16, v3's arithmetic), unless frozen or L8 has Loop #3 off; +1; its temperature smoothed 3:1; its ID into the node's Rolling Window of Truth (4096, warm at 1024, a diversity check due every 512). The kernel's heartbeat is read at each call. Pipelining and the hot-words cache ruled "Built, off as v3" (Task 2b). Test first: test_mesh_boot.c, 56 checks. amd64 boots, RESULT: PASS, 146 s against Phase 2's 142 s. Not pushed (held). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
@@ -199,6 +199,45 @@ int main(void)
|
||||
CHECK(v4_mesh_state_flags(&ms, 0, xt) == 0, "and none for SQ");
|
||||
}
|
||||
r = line(V4_MESH_HERA, "FORGET IMM", &how);
|
||||
/* Phase 7, Task 2a: at every call, as v3's physics_pre_execute -- decay by the ticks since, heat +1,
|
||||
* the temperature, the rolling window (Captain Bob, 2026-11-13: "Every call, as v3") */
|
||||
{
|
||||
v4_mesh_physics *p = &ms.physics[0];
|
||||
const v4_mesh_account *a;
|
||||
uint64_t total0;
|
||||
r = line(V4_MESH_HERA, ": P7 DUP * ; ' P7 .", &how);
|
||||
a = v4_mesh_account_at(&ms, 0, (v4_cell)strtol(r, 0, 10));
|
||||
v4_mesh_set_tick(&ms, 100);
|
||||
total0 = p->total_executions;
|
||||
r = line(V4_MESH_HERA, "2 P7 3 P7 4 P7 + + .", &how);
|
||||
CHECK(strcmp(r, "29 ") == 0 && a && a->heat == 3 && a->last_decay_tick == 100,
|
||||
"three calls: heat 3, decayed at tick 100 (%lu)", a ? (unsigned long)a->heat : 0ul);
|
||||
CHECK(p->total_executions >= total0 + 3 && p->history[(p->window_pos + V4_MESH_WINDOW - 1u) % V4_MESH_WINDOW]
|
||||
!= (uint32_t)-1, "the rolling window took them (%lu)", (unsigned long)(p->total_executions - total0));
|
||||
CHECK(a && a->temperature_q8 > 0, "and the temperature rose: %u", a ? a->temperature_q8 : 0u);
|
||||
v4_mesh_set_tick(&ms, 106); /* six ticks at 21845 (1/3 a tick, Q48.16): 1 heat */
|
||||
r = line(V4_MESH_HERA, "2 P7 .", &how);
|
||||
CHECK(a && a->heat == 3 && a->last_decay_tick == 106, "six ticks on: one heat decayed, one added: %lu",
|
||||
a ? (unsigned long)a->heat : 0ul);
|
||||
v4_mesh_set_tick(&ms, 109); /* three ticks: 65535 >> 16 = 0, as v3 */
|
||||
r = line(V4_MESH_HERA, "2 P7 .", &how);
|
||||
CHECK(a && a->heat == 4, "three ticks decay nothing, as v3's arithmetic: %lu", a ? (unsigned long)a->heat : 0ul);
|
||||
((v4_mesh_account *)a)->state_flags |= V4_MESH_STATE_FROZEN;
|
||||
v4_mesh_set_tick(&ms, 409);
|
||||
r = line(V4_MESH_HERA, "2 P7 .", &how);
|
||||
CHECK(a && a->heat == 5, "a frozen word does not decay: %lu", a ? (unsigned long)a->heat : 0ul);
|
||||
((v4_mesh_account *)a)->state_flags &= (uint8_t)~V4_MESH_STATE_FROZEN;
|
||||
p->l3_decay = 0;
|
||||
v4_mesh_set_tick(&ms, 709);
|
||||
r = line(V4_MESH_HERA, "2 P7 .", &how);
|
||||
CHECK(a && a->heat == 6, "nor any word while L8 has Loop #3 off: %lu", a ? (unsigned long)a->heat : 0ul);
|
||||
p->l3_decay = 1;
|
||||
v4_mesh_set_tick(&ms, 1009);
|
||||
r = line(V4_MESH_HERA, "2 P7 .", &how);
|
||||
CHECK(a && a->heat == 1, "and with it on, 300 ticks take all six, then one: %lu", a ? (unsigned long)a->heat : 0ul);
|
||||
v4_mesh_set_tick(&ms, 0);
|
||||
r = line(V4_MESH_HERA, "FORGET P7", &how);
|
||||
}
|
||||
r = line(V4_MESH_HERA, "3 SQ .", &how);
|
||||
CHECK(strcmp(r, "9 ") == 0 && a && a->calls == 1, "a call to it counts one: %lu", a ? (unsigned long)a->calls : 0ul);
|
||||
r = line(V4_MESH_HERA, "5 SQ 6 SQ + .", &how);
|
||||
|
||||
Reference in New Issue
Block a user