programgames/lights-out/play.xtl

source · imports lo: games/lights-out/Lamps.xtl

ᵘl̲oop : Int -> Char

function · line 12

Show the board, read the next event, act on a click, again.

ᵘl̲oop ← { s →
  said ← p̲rint! ˡᵒs̲ay s
  pic ← ⎕S̲HOW ˡᵒd̲raw s
  e ← ⎕E̲VENT @
  "end" m̲atch ⎕E̲KIND e ? "THE END"
  "click" m̲atch ⎕E̲KIND e ? ᵘl̲oop s ˡᵒc̲lick ⎕E̲AT e◆ ᵘl̲oop s
}