source · imports r: games/robot-chase/RobotChase.xtl
r:
s ← ʳn̲ew 0
R ← ʳr̲obots s
P ← (ʳp̲os s) 'l̲eft t̲able r̲ange ʳn
d ← P − R
rows ← 7 9 8 c̲at 9 r̲eshape 0
cols ← 6 6 5 c̲at 9 r̲eshape 0
alive ← 1 1 1 c̲at 9 r̲eshape 0
t ← 8 8 3 0 0 0 c̲at rows c̲at cols c̲at alive c̲at 256 r̲eshape 0
t ← t ʳm̲ove 5
t0 ← 8 8 3 0 0 0 c̲at rows c̲at cols c̲at alive c̲at 256 r̲eshape 0
lost ← (t0 ʳm̲ove 5) ʳm̲ove 4
ok ← "1 = r:s_tatus t" a̲ssert< "the three robots collide: won"
a̲ssert<
({ @ → (1 = ʳs̲tatus t) ? @◆ ⎕E̲RR "assertion failed: 1 = r:s_tatus t (the three robots collide: won) [games/robot-chase/robot-chase.xtl:50]"◆ @ } @)
ok ← "2 = r:s_tatus lost" a̲ssert< "walking into a robot: caught"
({ @ → (2 = ʳs̲tatus lost) ? @◆ ⎕E̲RR "assertion failed: 2 = r:s_tatus lost (walking into a robot: caught) [games/robot-chase/robot-chase.xtl:51]"◆ @ } @)