programgames/trek/trek.xtl

source · imports t: games/trek/StarTrek.xtl

s : Int

value · line 7
s ← ᵗn̲ew 0

s : Int

value · line 12
s ← ᵗs̲rs s

s : Int

value · line 13
s ← ᵗl̲rs s

P : Int

value · line 18
P ← s ᵗp̲ath 3 5

s : Int

value · line 25
s ← s ᵗc̲ommand 3 3 1

s : Int

value · line 26
s ← s ᵗc̲ommand 6 6

s : Int

value · line 27
s ← s ᵗc̲ommand 5 10

s : Int

value · line 28
s ← s ᵗc̲ommand 8

ᵘf̲ar : Int -> Int

function · line 33

The game ends when the stardate runs out: warp is one stardate a factor.

ᵘf̲ar ← { s → s ᵗc̲ommand 3 5 8 }
Used in: s

s : Int

value · line 34
s ← 4 'ᵘf̲ar p̲ower s

ok : Unit

value · line 41
ok ← "2 = t:s_tatus s" a̲ssert< "the long voyage runs out of time"
a̲ssert< expands to
({ @ → (2 = ᵗs̲tatus s) ? @◆ ⎕E̲RR "assertion failed: 2 = t:s_tatus s (the long voyage runs out of time) [games/trek/trek.xtl:41]"◆ @ } @)

ok : Unit

value · line 42
ok ← "0 <= t:k_lingons s" a̲ssert< "never fewer than no Klingons"
a̲ssert< expands to
({ @ → (0 ≤ ᵗk̲lingons s) ? @◆ ⎕E̲RR "assertion failed: 0 <= t:k_lingons s (never fewer than no Klingons) [games/trek/trek.xtl:42]"◆ @ } @)