wip(0.S3): packages and examples migrated again from their pre-0.S sources in one run

ludic migrate state packages <every example program> packages/ludic.lab/example/plate.ludic
  1804 vars into 126 states, 64 into lets; 23498 edits in 460 files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-25 15:31:34 +03:00
parent 5ffe50ed02
commit 19fcf60599
459 changed files with 17862 additions and 17603 deletions

View file

@ -3,19 +3,16 @@
# the ground under each line against aim_clear_to. Lines the ground merely grazes are left out: that
# is the probe's sampling against the aim's, not a disagreement. Moves the camera (AimView's) through
# `look`, which the game binds to put its camera at a point.
var am_seen: int = 0
var am_blocked: int = 0
var am_disagree: int = 0
export function aim_probe_seen() -> int { return am_seen }
export function aim_probe_blocked() -> int { return am_blocked }
export function aim_probe_disagree() -> int { return am_disagree }
export function aim_probe_seen(aim_st: AimState) -> int { return aim_st.am_seen }
export function aim_probe_blocked(aim_st: AimState) -> int { return aim_st.am_blocked }
export function aim_probe_disagree(aim_st: AimState) -> int { return aim_st.am_disagree }
# true when at least one line is hidden and the aim disagrees with the ground on at most one in fifty
export function aim_probe_ground(px: float, pz: float, look: fn(float, float, float) -> void) -> bool {
am_seen = 0
am_blocked = 0
am_disagree = 0
export function aim_probe_ground(aim_st: mut AimState, px: float, pz: float, look: fn(float, float, float) -> void) -> bool {
aim_st.am_seen = 0
aim_st.am_blocked = 0
aim_st.am_disagree = 0
for sp in 0 .. 9 {
var sx = px
var sz = pz
@ -24,12 +21,12 @@ export function aim_probe_ground(px: float, pz: float, look: fn(float, float, fl
sx = px + Math.sin(sa) * 250.0
sz = pz + Math.cos(sa) * 250.0
}
if AimView.dry(sx, sz) { am_probe_from(sx, AimView.ground(sx, sz) + 1.6, sz, look) }
if AimView.dry(sx, sz) { am_probe_from(aim_st, sx, AimView.ground(sx, sz) + 1.6, sz, look) }
}
return am_blocked >= 1 and not (am_disagree > am_seen / 50)
return aim_st.am_blocked >= 1 and not (aim_st.am_disagree > aim_st.am_seen / 50)
}
function am_probe_from(sx: float, sy: float, sz: float, look: fn(float, float, float) -> void) -> void {
function am_probe_from(aim_st: mut AimState, sx: float, sy: float, sz: float, look: fn(float, float, float) -> void) -> void {
for di in 0 .. 3 {
var dist = 60.0
if di == 1 { dist = 120.0 }
@ -42,10 +39,10 @@ function am_probe_from(sx: float, sy: float, sz: float, look: fn(float, float, f
let truth = am_probe_gap(sx, sy, sz, ex, ey, ez, 0.5, 10000.0)
if am_probe_gap(sx, sy, sz, ex, ey, ez, -0.5, 0.5) and not truth { continue }
look(sx, sy, sz)
am_seen += 1
aim_st.am_seen += 1
let clear = aim_clear_to(ex, ey, ez)
if not clear { am_blocked += 1 }
if clear == truth { am_disagree += 1 }
if not clear { aim_st.am_blocked += 1 }
if clear == truth { aim_st.am_disagree += 1 }
}
}
}