More comments

This commit is contained in:
Rampoina 2023-03-05 18:07:44 +01:00
parent 7c02f21b75
commit 6bfbd22108
1 changed files with 3 additions and 2 deletions

View File

@ -79,11 +79,11 @@ Game⇐{ # The Game function creates a game object
# w‿d Bounce x | x: map | w‿d: w: current position, d: direction of the laser # w‿d Bounce x | x: map | w‿d: w: current position, d: direction of the laser
# Calculates the bounces of a laser beam recursively # Calculates the bounces of a laser beam recursively
Bounce{(wd)S x:{ Bounce{(wd)S x:{ # Base case:
opaque˜wx? # When the beam touches an opaque object (not a mirror): opaque˜wx? # When the beam touches an opaque object (not a mirror):
(machine=wx)x, # we do nothing if it doesn't touch a machine (machine=wx)x, # we do nothing if it doesn't touch a machine
pmachine˙(w)x # and if it does we change it to a powered machine pmachine˙(w)x # and if it does we change it to a powered machine
@; @; # and the recursion stops
empties˜wx ? # When the beam passes through an empty space: empties˜wx ? # When the beam passes through an empty space:
# we draw the laser beam and recurse to the next: # we draw the laser beam and recurse to the next:
w+d,dS{ # we choose the type of laser beam to draw w+d,dS{ # we choose the type of laser beam to draw
@ -99,6 +99,7 @@ Game⇐{ # The Game function creates a game object
} }
} }
# We find each laser machine and shoot a beam in its direction
# Shoot 𝕩 | 𝕩: map | calculates the bounces for each laser # Shoot 𝕩 | 𝕩: map | calculates the bounces for each laser
Shoot{𝕩 {𝕨Bounce´𝕩} <0¯1,<01,<¯10,<10(˜¨+)¨ FindIdx(¨𝕩)¨ lasers} Shoot{𝕩 {𝕨Bounce´𝕩} <0¯1,<01,<¯10,<10(˜¨+)¨ FindIdx(¨𝕩)¨ lasers}