Fix -h handling and fix color handling for the description text

This commit is contained in:
Rampoina 2023-03-05 22:49:04 +01:00
parent 4919a9903a
commit f327bd29be
2 changed files with 6 additions and 6 deletions

View File

@ -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 clearansi.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

View File

@ -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,dlaserchars
floor,player,box,machine,pmachine,wall,lmirror,rmirror,hbeam,vbeam,xbeam,llaser,rlaser,ulaser,dlaserchars
mirrorslmirrorrmirror # the mirrors to reflect
mirrorslmirrorrmirror # the mirrors to reflect
beamshbeamvbeamxbeam # the laser beams
lasersllaserrlaserulaserdlaser # shot by the laser
# Each with every possible orientation
@ -119,8 +119,8 @@ Game⇐{ # The Game function creates a game object
cols (2colors)¨(mirrors) # the color for the mirrors
cols (3colors)¨(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:
# -------------------------------------------------------------------------------