diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-11 23:46:02 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-12 01:40:04 -0300 |
| commit | 60e07feef401d9044db3a1c925cb9d1f6d20dac9 (patch) | |
| tree | 98957ba8425193f686c8e8692cd10a10f27dbf4b /anim/scenes/heap.zig | |
| parent | 9c0696447dbc5cf37e56aee562c7ebba4f4d4e6b (diff) | |
| download | computeranim-60e07feef401d9044db3a1c925cb9d1f6d20dac9.tar.gz computeranim-60e07feef401d9044db3a1c925cb9d1f6d20dac9.zip | |
canim: relations as one data-oriented subsystem; aim; the ASan pair; the introduction's chapters
From the user. Relations between panes are one subsystem: per-frame
tables of places and values in struct-of-arrays, owned by the frame;
the kinds one table of data; a resolver of pure passes (join, filter,
priority, cut) unit-tested on hand-written tables. Ported kinds draw
byte-identical frames; a synthetic map of 4000 places and 6000 values
resolves in 0.56 ms against the old table's 5.7. aim, a word holding a
code address tied to its row, is the first new kind, off unless a scene
turns it on.
The ASan pair: one overflow built plain and with ASan, recorded by
instruction; the frame as bytes eight a row; the plain run goes on alone
in the column, its return address aimed at main's row until the letters
reach it; the fault at ret. The introduction's three chapters are built
and tested, not yet exported. Annotations, rows and scrolls that changed
in one frame now fade; captions stand twelve seconds at most.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
Diffstat (limited to 'anim/scenes/heap.zig')
| -rw-r--r-- | anim/scenes/heap.zig | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/anim/scenes/heap.zig b/anim/scenes/heap.zig index 6e521d0..07eccea 100644 --- a/anim/scenes/heap.zig +++ b/anim/scenes/heap.zig @@ -176,7 +176,10 @@ const Lists = struct { const changed = counts[0] == null or !real[0] or counts[0].? != counts[1].?; const comes = !real[0] or counts[0] == null; const bv = v.faded(if (comes) after(now, 42, 6) else 1); - const heat = if (changed and now.walking()) now.heat(0, null, now.since(.idea, 0) - 60.0 / 60.0) else if (changed) canim.ui.Heat.ember else canim.ui.Heat.none; + // Changed in the step before: its mark leaves as any does (with a run's ease, or its embers' steps), never in a frame. + const before = if (heapAt(a, rec, now.stops[2])) |hp| holds(hp) else null; + const changed_before = now.stops[2] != now.stops[1] and real[0] and counts[0] != null and before != counts[0]; + const heat = if (changed and now.walking()) now.heat(0, null, now.since(.idea, 0) - 60.0 / 60.0) else if (changed) canim.ui.Heat.ember else if (changed_before) now.heat(1, null, std.math.inf(f32)) else canim.ui.Heat.none; bv.fill(badge, theme.color.page); const ink = bv.cellWritten(badge, heat, theme.color.page); // Framed, but while the strike's paper is on it. @@ -199,7 +202,15 @@ const Lists = struct { const sx = top_r.x + top_r.w - 16 - tv.width(.mono, theme.size.mono.context, size_text); tv.text(.mono, theme.size.mono.context, top_r.x + 16, theme.baseline(top_r.y, h, theme.size.mono.context), "top", t.dim); var ink: canim.ui.Ink = .{ .ink = ui.rgb(t.dim) }; - if (side == 1 and moved and tops[0] != null and now.walking()) ink = tv.cellWritten(.{ .x = sx - 4, .y = top_r.y + 10, .w = tv.width(.mono, theme.size.mono.context, size_text) + 8, .h = 24 }, now.heat(0, null, now.since(.idea, 0) - 12.0 / 60.0), null); + const cell: canim.Rect = .{ .x = sx - 4, .y = top_r.y + 10, .w = tv.width(.mono, theme.size.mono.context, size_text) + 8, .h = 24 }; + if (side == 1 and moved and tops[0] != null) ink = tv.cellWritten(cell, if (now.resting() and now.gaits[0] == .walk) canim.ui.Heat.ember else now.heat(0, null, now.since(.idea, 0) - 12.0 / 60.0), null) else if (side == 1 and !moved and now.stops[2] != now.stops[1] and now.gaits[1] == .walk) { + // Moved in the step before: its mark leaves as any does, never in a frame. + const old = heapAt(a, rec, now.stops[2]); + const was = if (old) |hp| (if (hp.chunks.len > 0) hp.chunks[hp.chunks.len - 1] else null) else null; + if (was) |top_was| if (top_was.addr != top.addr or top_was.size() != top.size()) { + ink = tv.cellWritten(cell, now.heat(1, null, std.math.inf(f32)), null); + }; + } tv.text(ink.face, theme.size.mono.context, sx, theme.baseline(top_r.y, h, theme.size.mono.context), size_text, ink.ink); _ = tv.address(top_r.x + 16, top_r.y - 8, top.addr, .{ .ink = ui.rgb(theme.color.region.heap) }); }; |
