diff --git a/logic.bqn b/logic.bqn index 91eb2e3..98573e7 100644 --- a/logic.bqn +++ b/logic.bqn @@ -8,6 +8,7 @@ Game⇐{ # The Game function creates a game object 𝕊 levelPath‿dchars‿chars‿colors: # from parameters: # levelPath: the path of the file containing the levels # dchars: the characters to use for drawing + # chars: the characters that are used in the level representation # colors: a list with colors # Game representation: @@ -29,13 +30,6 @@ Game⇐{ # The Game function creates a game object # *Empty* objects can contain other ones on top: empties←floor∾beams - # Colors: - # The parameter 'color' is a list of colors passed to the Game function to alter the - cols←(≠chars)⥊<(⊑colors) # base color, - cols (1⊑colors)˙⌾(pmachine⊸⊑)↩ # the color for the powered machine - cols (2⊑colors)¨⌾(mirrors⊸⊏)↩ # the color for the mirrors - cols (3⊑colors)¨⌾(beams⊸⊏)↩ # the color for the laser beams - # We use a list of game objects (ints) to represent each tile lTiles←{⊑𝕩∊movables ? 𝕩‿floor; # the movables are on top of the floor (list of 2 elements) @@ -117,6 +111,13 @@ Game⇐{ # The Game function creates a game object # Drawing: # ------------------------------------------------------------------------------- + # Colors: + # The parameter 'color' is a list of colors passed to the Game function to alter the + cols←(≠chars)⥊<(⊑colors) # base color, + cols (1⊑colors)˙⌾(pmachine⊸⊑)↩ # the color for the powered machine + cols (2⊑colors)¨⌾(mirrors⊸⊏)↩ # the color for the mirrors + cols (3⊑colors)¨⌾(beams⊸⊏)↩ # the color for the laser beams + Colorize←{𝕩∾˜cols⊑˜⊑dchars⊐𝕩} # 𝕩: character | Turn character into color+character DrawLevel←{∾´¨<˘Colorize¨dchars⊏˜+´¨Shoot 𝕨 Step´ ⌽𝕩} # 𝕨 Draw 𝕩 | 𝕨: levels | 𝕩: moves | Draw the game in ASCII