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:
parent
19fcf60599
commit
a476ec7976
79 changed files with 481 additions and 355 deletions
|
|
@ -14,17 +14,19 @@ A <code>state</code> declares one state of an enclosing <code>machine</code>: a
|
|||
```ludic
|
||||
program DoorControl {
|
||||
enum DoorState { Closed, Opening, Open }
|
||||
var door: int = DoorState.Closed
|
||||
var elapsed_frames: int = 0
|
||||
state DoorControlState {
|
||||
door: int = DoorState.Closed
|
||||
elapsed_frames: int = 0
|
||||
}
|
||||
|
||||
handler RunDoor phase Update {
|
||||
machine door {
|
||||
handler RunDoor(door_control_st: mut DoorControlState) phase Update {
|
||||
machine door_control_st.door {
|
||||
state Closed {
|
||||
if Input.key() == ' ' { elapsed_frames = 0; become Opening }
|
||||
if Input.key() == ' ' { door_control_st.elapsed_frames = 0; become Opening }
|
||||
}
|
||||
state Opening {
|
||||
elapsed_frames = elapsed_frames + 1
|
||||
if elapsed_frames >= 30 { become Open }
|
||||
door_control_st.elapsed_frames = door_control_st.elapsed_frames + 1
|
||||
if door_control_st.elapsed_frames >= 30 { become Open }
|
||||
}
|
||||
state Open {
|
||||
Screen.status("door open")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue