From 9245c619a99f785eae5fc92344a4cc14ad1544ae Mon Sep 17 00:00:00 2001 From: Rampoina Date: Sun, 5 Mar 2023 03:05:16 +0100 Subject: [PATCH] Get rid of the magic numbers --- arc.bqn | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/arc.bqn b/arc.bqn index 5cdf95b..7d3ead6 100755 --- a/arc.bqn +++ b/arc.bqn @@ -7,10 +7,14 @@ # Each list contains the objects of the game represented as ints moves←⟨0‿0⟩ # list of moves, each move is a direction, we start without moving -chars←" λ$⊕λ⭍#/\-|+<>^v" # legal characters -movables←1‿2‿7‿8 # player, box and mirrors -opaque←1‿2‿3‿12‿13‿14‿15‿6 # non laser reflecting -empties←0‿9‿10‿11 # floor and laser beams +chars←" λ$⊕⭍#/\-|+<>^v" # legal characters +⟨floor,player,box,machine,pmachine,wall,lmirror,rmirror,hbeam,vbeam,xbeam,llaser,rlaser,ulaser,dlaser⟩←↕≠chars +beams←hbeam‿vbeam‿xbeam +mirrors←lmirror‿rmirror +lasers←llaser‿rlaser‿ulaser‿dlaser +movables←player‿box∾mirrors # player, box and mirrors +opaque←player‿box‿machine‿wall∾lasers # non laser reflecting +empties←floor∾beams # floor and laser beams ansi←{ e⇐@+27 red⇐e∾"[31m" @@ -19,8 +23,15 @@ ansi←{ defaultB⇐e∾"[0m" } +colors←(≠chars)⥊