Remove trailing whitespace
This commit is contained in:
parent
42c98d1ddb
commit
b5dd8929b7
|
@ -20,6 +20,6 @@ Otherwise:
|
||||||
1. `make` to compile CBQN (`make CC=cc` if clang isn't installed)
|
1. `make` to compile CBQN (`make CC=cc` if clang isn't installed)
|
||||||
2. `make run` to run the game
|
2. `make run` to run the game
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Sokobqn is licensed as AGPLv3
|
Sokobqn is licensed as AGPLv3
|
||||||
|
|
7
arc.bqn
7
arc.bqn
|
@ -28,21 +28,21 @@ Ascii2Matrix←{(⊑chars⊐𝕩)⊑⟨≍0,1‿0,2‿0,≍3,1‿3,2‿3,≍6,7
|
||||||
Tiles←{⟨𝕩,𝕩+𝕨,𝕩+2×𝕨⟩} # given object (including itself)
|
Tiles←{⟨𝕩,𝕩+𝕨,𝕩+2×𝕨⟩} # given object (including itself)
|
||||||
|
|
||||||
# Move 𝕩 | 𝕩: ⟨⟨1,0⟩,⟨0⟩⟩ (2 tiles) | result: ⟨⟨0⟩,⟨1,0⟩⟩
|
# Move 𝕩 | 𝕩: ⟨⟨1,0⟩,⟨0⟩⟩ (2 tiles) | result: ⟨⟨0⟩,⟨1,0⟩⟩
|
||||||
# Move the first object in the first tile to the second tile.
|
# Move the first object in the first tile to the second tile.
|
||||||
# Only move Movable tile -> Empty tile
|
# Only move Movable tile -> Empty tile
|
||||||
# the second tile can't be a movable object because we moved it previously
|
# the second tile can't be a movable object because we moved it previously
|
||||||
# if it is it means that the object was unmovable (next to a wall) so we do nothing
|
# if it is it means that the object was unmovable (next to a wall) so we do nothing
|
||||||
Move←{a‿b:⟨1↓a,(⊑a)∾b⟩}⍟{∨´(⥊movables≍⌜empties)≡⌜<⊑¨𝕩}
|
Move←{a‿b:⟨1↓a,(⊑a)∾b⟩}⍟{∨´(⥊movables≍⌜empties)≡⌜<⊑¨𝕩}
|
||||||
|
|
||||||
# Push 𝕩 | 𝕩: ⟨⟨1,0⟩,⟨2,0⟩,⟨0,0)⟩ (3 tiles) | result: ⟨⟨0⟩,⟨1,0⟩,⟨2,0)⟩
|
# Push 𝕩 | 𝕩: ⟨⟨1,0⟩,⟨2,0⟩,⟨0,0)⟩ (3 tiles) | result: ⟨⟨0⟩,⟨1,0⟩,⟨2,0)⟩
|
||||||
# Given 3 tiles try to [P]ush the second tile (possible box)
|
# Given 3 tiles try to [P]ush the second tile (possible box)
|
||||||
# and afterwards try to move the first one (player) if possible
|
# and afterwards try to move the first one (player) if possible
|
||||||
Push←Move⌾(2↑⊢)Move⌾(1↓⊢)
|
Push←Move⌾(2↑⊢)Move⌾(1↓⊢)
|
||||||
|
|
||||||
FindIdx←/○⥊⟜(↕≢)∘⍷
|
FindIdx←/○⥊⟜(↕≢)∘⍷
|
||||||
|
|
||||||
# 𝕨 Beam 𝕩 | 𝕨: level | 𝕩: position | replace positions with the laser beam
|
# 𝕨 Beam 𝕩 | 𝕨: level | 𝕩: position | replace positions with the laser beam
|
||||||
Beam←{{"--++"⊏˜" -|+"⊐𝕩}⌾(𝕩⊸⊑)𝕨}
|
Beam←{{"--++"⊏˜" -|+"⊐𝕩}⌾(𝕩⊸⊑)𝕨}
|
||||||
|
|
||||||
# w‿d Bounce x | x: map | w‿d: w: current position, d: direction of the laser
|
# w‿d Bounce x | x: map | w‿d: w: current position, d: direction of the laser
|
||||||
# Calculates the bounces of a laser beam recursively
|
# Calculates the bounces of a laser beam recursively
|
||||||
|
@ -88,7 +88,6 @@ clear←""
|
||||||
{𝕤⋄moves↩⟨0‿0⟩}⍟(key='r')@
|
{𝕤⋄moves↩⟨0‿0⟩}⍟(key='r')@
|
||||||
{𝕤⋄clear↩e∾"[2J"}⍟(((1⊸+>○(⌊1+10⋆⁼1⌈⊢)⊢)¯1+≠moves)∧key='u')@
|
{𝕤⋄clear↩e∾"[2J"}⍟(((1⊸+>○(⌊1+10⋆⁼1⌈⊢)⊢)¯1+≠moves)∧key='u')@
|
||||||
•Out e∾"8" # Restore cursor position
|
•Out e∾"8" # Restore cursor position
|
||||||
|
|
||||||
{𝕤⋄•Out clear∾ansi.yellow∾"⭍"∾ansi.defaultB∾" Power the machines (⊕) by moving the mirrors ("∾ansi.cyan∾"\/"∾ansi.defaultB∾")"∾(@+10)∾"Controls: (hjkl or wasd) to move, u to undo, r to reset level, q to quit"}⍟(⊑key∊"wasdhjkluqr")@
|
{𝕤⋄•Out clear∾ansi.yellow∾"⭍"∾ansi.defaultB∾" Power the machines (⊕) by moving the mirrors ("∾ansi.cyan∾"\/"∾ansi.defaultB∾")"∾(@+10)∾"Controls: (hjkl or wasd) to move, u to undo, r to reset level, q to quit"}⍟(⊑key∊"wasdhjkluqr")@
|
||||||
{𝕤⋄•Out "Invalid key: (hjkl or wasd) to move, u to undo, r to reset level"}⍟(¬⊑key∊"wasdhjkluqr")@
|
{𝕤⋄•Out "Invalid key: (hjkl or wasd) to move, u to undo, r to reset level"}⍟(¬⊑key∊"wasdhjkluqr")@
|
||||||
•Out¨ (currentLevel⊑levels) Draw moves
|
•Out¨ (currentLevel⊑levels) Draw moves
|
||||||
|
|
Loading…
Reference in New Issue