sourcegames/stargazer/play.xtl
1⍝!/usr/bin/env xetal
2⍝# Stargazer: a sky you click. Each round rings five named stars, mixed
3⍝# bright, middling and faint; click a ringed star, then its name among
4⍝# four (one star from each brightness band besides it). The buttons
5⍝# along the top start a round in a part of the sky or all of it. On the
6⍝# page the sky is in a dialog and your clicks come to the program as
7⍝# events; at the command line, lines such as "click 26000 10600" (sky
8⍝# units) on standard input. The rules and the drawing are Sky.xtl's.
9ᵏ⁼u̲se< "Sky"
10
11ᵘl̲oop ← { s →
12 said ← p̲rint! ᵏs̲ay s
13 pic ← ⎕S̲HOW ᵏd̲raw s
14 e ← ⎕E̲VENT @
15 "end" m̲atch ⎕E̲KIND e ? "THE END"
16 "click" m̲atch ⎕E̲KIND e ? ᵘl̲oop s ᵏc̲lick ⎕E̲AT e◆ ᵘl̲oop s
17}
18ᵘl̲oop ᵏn̲ew 0