programgames/horse-race/horse-race.xtl

source · imports hr: games/horse-race/HorseRace.xtl

p : Int

value · line 7
p ← ʰʳn̲ew 5

r : Int

value · line 8
r ← ʰʳr̲oll p

p : Int

value · line 10
p ← p ʰʳm̲ove r

ᵘr̲ace : Int -> Int

function · line 16

A whole race: a round at a time until a horse finishes; each round printed as its rolls, then the track.

ᵘr̲ace ← { p →
  r ← p̲rint! ʰʳr̲oll p
  q ← p ʰʳm̲ove r
  shown ← p̲rint! ʰʳv̲iew q
  1 = ʰʳs̲tatus q ? q◆ ᵘr̲ace q
}
Used in: ᵘr̲ace, final

final : Int

value · line 22
final ← ᵘr̲ace ʰʳn̲ew 5

ok : Unit

value · line 29
ok ← "1 = hr:s_tatus final" a̲ssert< "the race ends with a winner"
a̲ssert< expands to
({ @ → (1 = ʰʳs̲tatus final) ? @◆ ⎕E̲RR "assertion failed: 1 = hr:s_tatus final (the race ends with a winner) [games/horse-race/horse-race.xtl:29]"◆ @ } @)

ok : Unit

value · line 30
ok ← "0 < t_ally hr:w_inners final" a̲ssert< "someone wins"
a̲ssert< expands to
({ @ → (0 < t̲ally ʰʳw̲inners final) ? @◆ ⎕E̲RR "assertion failed: 0 < t_ally hr:w_inners final (someone wins) [games/horse-race/horse-race.xtl:30]"◆ @ } @)