programgames/maze/play.xtl
The maze: find the way out (>). Up (or w) steps ahead, down (or s) steps back, left and right (or a and d) turn a quarter; m shows or hides a mini map of what you have seen; r starts a new maze. Each game is a new maze, carved from its seed. Finding the way out ends the program (on the page, Play or any key then starts a new one). On the page the maze is in a dialog and your keys come to the program as events; at the command line, lines such as "key UP" on standard input. The rules are Walls.xtl's.
ᵘs̲how : (Truthy a, Num b) => (Int, Int, Int, Int, a, b, Int) -> Char
Show the view, then wait for the next key.
ᵘs̲how ← { s → _ ← ⎕S̲HOW ᵐᶻd̲raw s 0 < ᵐᶻs̲tatus s ? ᵘe̲nd s ᵘl̲oop s }
Used in: ᵘl̲oop, games/maze/play.xtl:29
ᵘl̲oop : (Truthy a, Num b) => (Int, Int, Int, Int, a, b, Int) -> Char
The next event: a key acts; the end of the events ends the game.
ᵘl̲oop ← { s → e ← ⎕E̲VENT @ "end" m̲atch ⎕E̲KIND e ? "THE END" n̲ot "key" m̲atch ⎕E̲KIND e ? ᵘl̲oop s name ← f̲ormat ⎕E̲KEY e "r" m̲atch name ? ᵘs̲how ᵐᶻn̲ew 0 ᵘs̲how s ᵐᶻk̲ey name }