From 6bfbd221081e93e46df91812e9466973afbce424 Mon Sep 17 00:00:00 2001 From: Rampoina Date: Sun, 5 Mar 2023 18:07:44 +0100 Subject: [PATCH] More comments --- logic.bqn | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/logic.bqn b/logic.bqn index 312f6c6..ac6e369 100644 --- a/logic.bqn +++ b/logic.bqn @@ -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 # Calculates the bounces of a laser beam recursively - Bounce←{(w‿d)S x:{ + Bounce←{(w‿d)S x:{ # Base case: ⊑opaque∊˜⊑w⊑x? # When the beam touches an opaque object (not a mirror): (machine=⊑w⊑x)◶⟨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 - ⟩@; + ⟩@; # and the recursion stops ⊑empties∊˜⊑w⊑x ? # When the beam passes through an empty space: # we draw the laser beam and recurse to the next: ⟨w+d,d⟩S{ # 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←{𝕩 {𝕨Bounce´⌽𝕩} ∾⟨<0‿¯1,<0‿1,<¯1‿0,<1‿0⟩(⊣⋈˜¨+)¨ FindIdx⟜(⊑¨𝕩)¨ lasers}