programgames/raycaster/raycaster.xtl

The raycaster, scripted (seed 1), with the rules of Rays.xtl: one ray per column of the picture, every ray stepped through the grid at once until all of them have hit a wall.

source · imports rc: games/raycaster/Rays.xtl

s : (Float, Float, Float, Float, Int)

value · line 9
s ← ʳᶜn̲ew 0

r : Float

value · line 16
r ← ʳᶜs̲ees s

ᵘp̲ress : (Any a, Num b) => (Float, Float, Float, a, b) -> Char -> (Float, Float, Float, a, b)

function · line 22
ᵘp̲ress ← { s k → s ʳᶜk̲ey k }
Used in: ᵘk̲eys

ᵘk̲eys : (Any a, Num b) => (Float, Float, Float, a, b) -> Box Char -> (Float, Float, Float, a, b)

function · line 23
ᵘk̲eys ← { s ks → 0 = t̲ally ks ? s◆ (s ᵘp̲ress d̲isclose f̲irst ks) ᵘk̲eys 1 d̲rop ks }
Used in: ᵘk̲eys, turned

turned : (Float, Float, Float, Float, Int)

value · line 24
turned ← (s ᵘk̲eys "UP" "UP" "UP") ᵘk̲eys 12 r̲eshape e̲nclose "RIGHT"

_ : Char

function · line 27
_ ← ⎕S̲HOW ʳᶜd̲raw turned

_ : Unit

function · line 30
_ ← "2 = f_loor f_irst 60 s_elect rc:s_ees rc:n_ew 0" a̲ssert< "straight ahead at the start is the blue wall"
a̲ssert< expands to
({ @ → (2 = f̲loor f̲irst 60 s̲elect ʳᶜs̲ees ʳᶜn̲ew 0) ? @◆ ⎕E̲RR "assertion failed: 2 = f_loor f_irst 60 s_elect rc:s_ees rc:n_ew 0 (straight ahead at the start is the blue wall) [games/raycaster/raycaster.xtl:30]"◆ @ } @)

_ : Unit

function · line 31
_ ← "120 = t_ally rc:s_ees turned" a̲ssert< "a ray for every column"
a̲ssert< expands to
({ @ → (120 = t̲ally ʳᶜs̲ees turned) ? @◆ ⎕E̲RR "assertion failed: 120 = t_ally rc:s_ees turned (a ray for every column) [games/raycaster/raycaster.xtl:31]"◆ @ } @)

_ : Unit

function · line 32
_ ← "0 = rc:s_tatus turned" a̲ssert< "still inside"
a̲ssert< expands to
({ @ → (0 = ʳᶜs̲tatus turned) ? @◆ ⎕E̲RR "assertion failed: 0 = rc:s_tatus turned (still inside) [games/raycaster/raycaster.xtl:32]"◆ @ } @)