docs(0.S): the doc fences migrated by ludic migrate state; LANGUAGE.md's state section says what the tool and the checker do now; no module-level var left in the docs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-25 15:37:29 +03:00
parent 19fcf60599
commit a476ec7976
79 changed files with 481 additions and 355 deletions

View file

@ -18,8 +18,8 @@ Parameters:
```ludic
program ChaseDistance {
var target: int = 40
var here: int = 12
let target: int = 40
let here: int = 12
handler Report phase Update {
let gap = Math.abs(target - here) # 28, regardless of which is larger

View file

@ -20,7 +20,7 @@ Parameters:
program RowsNeeded {
const ROW_HEIGHT: fixed = 12.0
var content_height: fixed = 30.0
let content_height: fixed = 30.0
handler Layout phase Update {
let rows = Math.ceil(content_height / ROW_HEIGHT) # 3

View file

@ -22,10 +22,12 @@ Parameters:
program CameraBounds {
const WORLD_WIDTH: int = 320
var camera_x: int = 0
state CameraBoundsState {
camera_x: int = 0
}
handler Follow phase Update {
camera_x = Math.clamp(camera_x, 0, WORLD_WIDTH - 1)
handler Follow(camera_bounds_st: mut CameraBoundsState) phase Update {
camera_bounds_st.camera_x = Math.clamp(camera_bounds_st.camera_x, 0, WORLD_WIDTH - 1)
}
}
```

View file

@ -20,7 +20,7 @@ Parameters:
program TileIndex {
const TILE_SIZE: fixed = 16.0
var world_x: fixed = 40.5
let world_x: fixed = 40.5
handler Locate phase Update {
let column = Math.floor(world_x / TILE_SIZE) # 2

View file

@ -22,7 +22,7 @@ Parameters:
program HealthFraction {
const MAX_HP: fixed = 200.0
var hp: fixed = 150.0
let hp: fixed = 150.0
handler Draw phase Render {
let fraction = Math.inverse_lerp(0.0, MAX_HP, hp) # 0.75

View file

@ -20,11 +20,13 @@ Parameters:
```ludic
program EaseCamera {
var camera_x: fixed = 0.0
var target_x: fixed = 100.0
state EaseCameraState {
camera_x: fixed = 0.0
}
let target_x: fixed = 100.0
handler Follow phase Update {
camera_x = Math.lerp(camera_x, target_x, 0.1) # glides a tenth of the way each frame
handler Follow(ease_camera_st: mut EaseCameraState) phase Update {
ease_camera_st.camera_x = Math.lerp(ease_camera_st.camera_x, target_x, 0.1) # glides a tenth of the way each frame
}
}
```

View file

@ -19,10 +19,12 @@ Parameters:
```ludic
program Countdown {
var timer: int = 60
state CountdownState {
timer: int = 60
}
handler Tick phase Update {
timer = Math.max(timer - 1, 0) # stops at 0, never negative
handler Tick(countdown_st: mut CountdownState) phase Update {
countdown_st.timer = Math.max(countdown_st.timer - 1, 0) # stops at 0, never negative
}
}
```

View file

@ -19,10 +19,12 @@ Parameters:
```ludic
program ClampScore {
var score: int = 0
state ClampScoreState {
score: int = 0
}
handler AddPoint phase Update {
score = Math.min(score + 1, 100) # never climbs past 100
handler AddPoint(clamp_score_st: mut ClampScoreState) phase Update {
clamp_score_st.score = Math.min(clamp_score_st.score + 1, 100) # never climbs past 100
}
}
```

View file

@ -25,7 +25,7 @@ program HealthBar {
const MAX_HP: fixed = 200.0
const BAR_WIDTH: fixed = 64.0
var hp: fixed = 150.0
let hp: fixed = 150.0
handler Draw phase Render {
let width = Math.remap(hp, 0.0, MAX_HP, 0.0, BAR_WIDTH) # 48.0

View file

@ -18,7 +18,7 @@ Parameters:
```ludic
program SnapToPixel {
var smooth_x: fixed = 10.5
let smooth_x: fixed = 10.5
handler Draw phase Render {
let px = Math.round(smooth_x) # 11

View file

@ -18,11 +18,13 @@ Parameters:
```ludic
program FaceTarget {
var x: int = 8
var target: int = 20
state FaceTargetState {
x: int = 8
}
let target: int = 20
handler StepToward phase Update {
x = x + Math.sign(target - x) # +1 while target is to the right
handler StepToward(face_target_st: mut FaceTargetState) phase Update {
face_target_st.x = face_target_st.x + Math.sign(target - face_target_st.x) # +1 while target is to the right
}
}
```