ludic.base: a queue's fact records come round again (q_rec / q_ring_add), used by effects, clock, wallet, weather, tracks, needs, fire, settings, update, steps, crafting, shop, gear, hints, session and photo instead of a new record per fact; the minimap's marks cleared and rubbed out in place, its scale steps without a list; the clock's dice seeded again, not made again; once-per-join, per-save and pool-miss paths declared

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 20:03:46 +03:00
parent 5be2422c84
commit d9612ba2a6
31 changed files with 215 additions and 25 deletions

View file

@ -0,0 +1,21 @@
# ludic.base/queue_ring.ludic - a fact's record made again rather than new: Ludic frees nothing, and a
# mechanic reports all day. q_rec hands out a record neither waiting in the queue nor handed out by
# its last drain, or null when every one is: the caller makes one more and q_ring_add keeps it, so
# the ring grows to the busiest frame and stays there. The caller sets every field it reads
export function q_rec<T>(q: Queue<T>) -> T {
let n = len(q.ring)
for t in 0 .. n {
let r = q.ring[q.ring_at]
q.ring_at = (q.ring_at + 1) % n
if not q_holds(q, r) { return r }
}
return null
}
export function q_ring_add<T>(q: Queue<T>, r: T) -> void { kept_push(q.ring, r) }
function q_holds<T>(q: Queue<T>, r: T) -> bool {
for i in 0 .. len(q.items) { if q.items[i] == r { return true } }
for i in 0 .. len(q.spare) { if q.spare[i] == r { return true } }
return false
}