sourcegames/capitals/play.xtl
1⍝!/usr/bin/env xetal
2⍝# Capitals: a map you click. Each round puts five red dots on the map,
3⍝# each a national capital (or a place of your own) inside its unlabeled
4⍝# country; click a dot, then its name among four nearby cities. The
5⍝# buttons along the top start a round in a region or the whole world.
6⍝# On the page the map is in a dialog and your clicks come to the program
7⍝# as events; at the command line, lines such as "click 1234 567" (map
8⍝# units) on standard input. The rules and the drawing are Atlas.xtl's.
9ᵃ⁼u̲se< "Atlas"
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