programgames/dungeon/dungeon.xtl

The dungeon, scripted (seed 1), with the rules of Crawl.xtl on lib/Ecs: the world as a matrix, what each entity is as the components it has, and every rule as one expression over all of them.

source · imports cr: games/dungeon/Crawl.xtl; ec: lib/Ecs.xtl lib/Ecs.xtlm

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

value · line 13
start ← ᶜʳn̲ew 0

W : Float

value · line 14
(W, _, _, _, _) ← start

ᵘw̲alk : Num a => (Float, Int, a, Char, Int) -> Float -> (Float, Int, a, Char, Int)

function · line 26
ᵘw̲alk ← { s D → 0 = t̲ally D ? s◆ (s ᶜʳt̲urn f̲irst D) ᵘw̲alk 1 d̲rop D }
Used in: ᵘw̲alk, walked

walked : (Float, Int, Int, Char, Int)

value · line 27
walked ← start ᵘw̲alk 6 2 r̲eshape 0 1 0 1 1 0 1 0 0 -1 0 -1.0

m : Char

value · line 28
(_, _, _, m, _) ← walked

_ : Char

function · line 31
_ ← ⎕S̲HOW ᶜʳd̲raw walked

ᵘw̲orld : (Any a, Any b, Any c, Any d, Any e) => (a, b, c, d, e) -> a

function · line 34
ᵘw̲orld ← { (W, g, n, m, lv) → W }
Used in: _

_ : Unit

function · line 35
_ ← "10 = ec:c_ount u:w_orld cr:n_ew 0" a̲ssert< "a new dungeon holds ten entities"
a̲ssert< expands to
({ @ → (10 = ᵉᶜc̲ount ᵘw̲orld ᶜʳn̲ew 0) ? @◆ ⎕E̲RR "assertion failed: 10 = ec:c_ount u:w_orld cr:n_ew 0 (a new dungeon holds ten entities) [games/dungeon/dungeon.xtl:35]"◆ @ } @)

_ : Unit

function · line 36
_ ← "6 = 3 s_elect cr:y_ou walked" a̲ssert< "six turns taken"
a̲ssert< expands to
({ @ → (6 = 3 s̲elect ᶜʳy̲ou walked) ? @◆ ⎕E̲RR "assertion failed: 6 = 3 s_elect cr:y_ou walked (six turns taken) [games/dungeon/dungeon.xtl:36]"◆ @ } @)