programgames/robot-chase/robot-chase.xtl

source · imports r: games/robot-chase/RobotChase.xtl

s : Int

value · line 6
s ← ʳn̲ew 0

R : Int

value · line 12
R ← ʳr̲obots s

P : Int

value · line 13
P ← (ʳp̲os s) 'l̲eft t̲able r̲ange ʳn

d : Int

value · line 16
d ← P − R

rows : Int

value · line 23
rows ← 7 9 8 c̲at 9 r̲eshape 0
Used in: t, t0

cols : Int

value · line 24
cols ← 6 6 5 c̲at 9 r̲eshape 0
Used in: t, t0

alive : Int

value · line 25
alive ← 1 1 1 c̲at 9 r̲eshape 0
Used in: t, t0

t : Int

value · line 26
t ← 8 8 3 0 0 0 c̲at rows c̲at cols c̲at alive c̲at 256 r̲eshape 0

t : Int

value · line 28
t ← t ʳm̲ove 5

t : Int

value · line 31
t ← t ʳm̲ove 5

t0 : Int

value · line 38
t0 ← 8 8 3 0 0 0 c̲at rows c̲at cols c̲at alive c̲at 256 r̲eshape 0
Used in: lost

lost : Int

value · line 39
lost ← (t0 ʳm̲ove 5) ʳm̲ove 4

ok : Unit

value · line 50
ok ← "1 = r:s_tatus t" a̲ssert< "the three robots collide: won"
a̲ssert< expands to
({ @ → (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 : Unit

value · line 51
ok ← "2 = r:s_tatus lost" a̲ssert< "walking into a robot: caught"
a̲ssert< expands to
({ @ → (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]"◆ @ } @)