diff --git a/arc.bqn b/arc.bqn index 14c9a68..90a5a59 100755 --- a/arc.bqn +++ b/arc.bqn @@ -14,7 +14,7 @@ opts←{ --chars STRING: Characters to display for each game object, needs to have length 15 --fchars STRING: Characters to represent each game object in the levels file, needs to have length 15" •Exit 0 - }⍟((⊑"-h"<⊸⍷a)∨⊑"--help"<⊸⍷a) @ + }⍟((∨´"-h"<⊸⍷a)∨(∨´"--help"<⊸⍷a)) @ chars⇐{0=≠𝕩?" λ$⊕⭍#/\-|+<>^v";⊑𝕩}(»(<"--chars")⊸⍷)⊸/a fchars⇐{0=≠𝕩?" λ$⊕⭍#/\-|+<>^v";⊑𝕩}(»(<"--fchars")⊸⍷)⊸/a @@ -30,7 +30,7 @@ clear←"" •Out clear∾ansi.cursor.origin clear↩"" •Out "Level: "∾•Repr 1+g.currentLevel - •Out ansi.yellow∾"⭍"∾ansi.defaultB∾" Power the machines (⊕) by moving the mirrors ("∾ansi.cyan∾"\/"∾ansi.defaultB∾") " + •Out (g.Color g.pmachine)∾ansi.defaultB∾" Power the machines ("∾(g.Color g.machine)∾") by moving the mirrors ("∾(∾g.Color¨ g.mirrors)∾ansi.defaultB∾")" •Out "Controls: (hjkl or wasd) to move, u to undo, r to reset level, q to quit" g.Draw @ •Out "Moves: "∾•Repr ¯1+≠g.moves diff --git a/logic.bqn b/logic.bqn index fca1fab..f783c35 100644 --- a/logic.bqn +++ b/logic.bqn @@ -15,9 +15,9 @@ Game⇐{ # The Game function creates a game object # Game representation: # ------------------------------------------------------------------------------- # The game has the following objects represented as consecutive integers: - ⟨floor,player,box,machine,pmachine,wall,lmirror,rmirror,hbeam,vbeam,xbeam,llaser,rlaser,ulaser,dlaser⟩←↕≠chars + ⟨floor,player,box,machine,pmachine,wall,lmirror,rmirror,hbeam,vbeam,xbeam,llaser,rlaser,ulaser,dlaser⟩⇐↕≠chars - mirrors←lmirror‿rmirror # the mirrors to reflect + mirrors⇐lmirror‿rmirror # the mirrors to reflect beams←hbeam‿vbeam‿xbeam # the laser beams lasers←llaser‿rlaser‿ulaser‿dlaser # shot by the laser # Each with every possible orientation @@ -119,8 +119,8 @@ Game⇐{ # The Game function creates a game object 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 + Color⇐{(𝕩⊑cols)∾𝕩⊑dchars} # 𝕩: game Object (int) | draw object with color + DrawLevel←{∾´¨<˘Color¨+´¨Shoot 𝕨 Step´ ⌽𝕩} # 𝕨 Draw 𝕩 | 𝕨: levels | 𝕩: moves | Draw the game in ASCII # State and state mutating functions: # -------------------------------------------------------------------------------