programgames/tower-defense/tower-defense.xtl

Tower defense, scripted (seed 1), with the rules of Defense.xtl on lib/Ecs: every tower against every creep in one table, shots against creeps in another, the road found by a flood, the board in 2.5D.

source · imports td: games/tower-defense/Defense.xtl

start : (Float, Int, Int, Int, Int, Float, Int, Int, Int, Float, Int, Int, Char)

value · line 9
start ← ᵗᵈn̲ew 0

arrows : (Float, Int, Int, Int, Int, Float, Int, Int, Int, Float, Int, Int, Char)

value · line 16
arrows ← (start ᵗᵈc̲lick 416.0 208.0) ᵗᵈc̲lick 480.0 240.0
Used in: built

built : (Float, Int, Int, Int, Int, Float, Int, Int, Int, Float, Int, Int, Char)

value · line 17
built ← (arrows ᵗᵈk̲ey "2") ᵗᵈc̲lick 352.0 240.0

wave : (Float, Int, Int, Int, Int, Float, Int, Int, Int, Float, Int, Int, Char)

value · line 24
wave ← built ᵗᵈk̲ey " "
Used in: later

ᵘg̲o : (Any a, Num b, Any c, Num d, Num e, Any f, Num g) => (Float, Int, Int, Int, Int, Float, a, b, c, Float, d, e, f) -> g -> (Float, Int, Int, Int, Int, Float, a, b, c, Float, d, e, f)

function · line 25
ᵘg̲o ← { s n → (n = 0) ∨ 0 < ᵗᵈs̲tatus s ? s◆ (s ᵗᵈt̲ick 0.1) ᵘg̲o n − 1 }
Used in: ᵘg̲o, later

later : (Float, Int, Int, Int, Int, Float, Int, Int, Int, Float, Int, Int, Char)

value · line 26
later ← wave ᵘg̲o 200

_ : Char

function · line 29
_ ← ⎕S̲HOW ᵗᵈd̲raw later

_ : Unit

function · line 32
_ ← "52 = t_ally td:r_oad td:n_ew 0" a̲ssert< "the road is 52 tiles from S to E"
a̲ssert< expands to
({ @ → (52 = t̲ally ᵗᵈr̲oad ᵗᵈn̲ew 0) ? @◆ ⎕E̲RR "assertion failed: 52 = t_ally td:r_oad td:n_ew 0 (the road is 52 tiles from S to E) [games/tower-defense/tower-defense.xtl:32]"◆ @ } @)

_ : Unit

function · line 33
_ ← "20 = 2 s_elect td:s_core later" a̲ssert< "no creep of the first wave got out"
a̲ssert< expands to
({ @ → (20 = 2 s̲elect ᵗᵈs̲core later) ? @◆ ⎕E̲RR "assertion failed: 20 = 2 s_elect td:s_core later (no creep of the first wave got out) [games/tower-defense/tower-defense.xtl:33]"◆ @ } @)