more levels

This commit is contained in:
Eric Mertens 2024-12-08 16:36:16 -08:00
parent 6012831267
commit e28a3f5b07
23 changed files with 799 additions and 23 deletions

View File

@ -85,20 +85,21 @@ isWall world (Location n y x) =
type Movement = (Int, Int) type Movement = (Int, Int)
moveBlock :: moveBlock ::
World -> World {- ^ world -} ->
Map Location (Char, Box) -> Map Location (Char, Box) {- ^ location cache -} ->
Map Location (Int, Char, Maybe Location) -> Map Location (Int, Char, Maybe Location) {- ^ accumulated changes -} ->
Location -> Location {- ^ source location -} ->
Movement -> Movement {- ^ movement direction -} ->
Rational {- ^ offset -} -> Rational {- ^ offset -} ->
Maybe (Map Char (Maybe Location)) Maybe (Map Char (Maybe Location))
-- moving into a wall, not possible -- moving a wall, not possible
moveBlock world _ _ loc _ _ moveBlock world _ _ loc _ _
| isWall world loc = Nothing | isWall world loc = Nothing
-- move introduced a loop, trim off the tail and report success -- move introduced a loop, trim off the tail and report success
moveBlock _ _ visited loc _ _ moveBlock _ _ visited loc _ _
-- XXX: ensure update is consistent to support flipped levels
| Just (n,_,_) <- Map.lookup loc visited | Just (n,_,_) <- Map.lookup loc visited
= Just (Map.fromList [(c,l) | (a,c,l) <- Map.elems visited, a >= n]) = Just (Map.fromList [(c,l) | (a,c,l) <- Map.elems visited, a >= n])
@ -126,7 +127,7 @@ moveBlock' ::
Movement -> Movement ->
Char -> Char ->
Box -> Box ->
Set Location -> Set Char ->
Rational {- ^ offset -} -> Rational {- ^ offset -} ->
Maybe (Map Char (Maybe Location)) Maybe (Map Char (Maybe Location))
moveBlock' world locMap visited loc loc' dir name box enters offset = moveBlock' world locMap visited loc loc' dir name box enters offset =
@ -138,16 +139,16 @@ moveBlock' world locMap visited loc loc' dir name box enters offset =
moveInto = moveInto =
do (n,b) <- Map.lookup loc' locMap do (n,b) <- Map.lookup loc' locMap
(locI, offset') <- enterLoc world n b dir offset (locI, offset') <- enterLoc world n b dir offset
if Set.member locI enters then if Set.member (locName loc') enters then
do epsilon <- findEpsilon world (locName locI) do epsilon <- findEpsilon world (locName loc')
moveEpsilon epsilon moveEpsilon epsilon
else else
moveBlock' world locMap visited loc locI dir name box (Set.insert locI enters) offset' moveBlock' world locMap visited loc locI dir name box (Set.insert (locName loc') enters) offset'
moveEpsilon epsilon = moveEpsilon epsilon =
do let eBox = boxIx world epsilon do let eBox = boxIx world epsilon
(locI, offset') <- enterLoc world epsilon eBox dir offset (locI, offset') <- enterLoc world epsilon eBox dir offset
moveBlock' world locMap visited loc locI dir name box (Set.insert locI enters) offset' moveBlock' world locMap visited loc locI dir name box enters offset'
moveToEat = moveToEat =
do let dir' = invert dir do let dir' = invert dir

65
levels/challenge04.txt Normal file
View File

@ -0,0 +1,65 @@
player p height 98
block W white boring
▓▓▓
▓w▓
▓▓▓
block w white interesting
▓U▓
7▓
p 1 ▓▓
▓▓
2 3 ▓▓
L▓
▓=▓
block U green interesting
▓▓▓
▓-▓
▓y▓
block y yellow boring
block 7 blue interesting
▓▓▓▓▓▓▓
block L blue interesting
▓▓▓▓▓▓▓
block 1 green interesting
▓▓
▓▓
▓▓
▓▓
block 2 green interesting
▓▓
▓▓
▓▓
▓▓
block 3 green interesting
▓▓
▓▓
▓▓
▓▓
▓▓
▓▓
block p red interesting
▓▓▓▓▓
▓ ▓ ▓
▓▓▓▓▓
▓▓▓▓▓
▓▓▓▓▓

57
levels/challenge05.txt Normal file
View File

@ -0,0 +1,57 @@
player p height 90
block W white boring
▓▓▓
▓w▓
▓▓▓
block w white interesting
p
g b
G B
▓▓▓
block g green interesting
▓▓▓▓▓▓▓▓▓
▓▓
▓▓
▓▓
▓▓
▓▓ ▓
▓▓
▓▓▓▓▓▓▓▓▓
block G green interesting
▓▓▓▓▓▓▓▓▓
▓▓▓▓▓▓▓=
▓▓▓▓▓▓▓▓▓
▓▓
▓ ▓
▓▓
▓▓
▓▓
▓▓▓▓▓▓▓▓▓
block b blue interesting
▓▓▓▓▓▓▓▓▓
▓▓
▓▓
▓▓
▓ ▓
▓▓
▓ ▓▓
▓ ▓▓
▓▓▓▓▓▓▓▓▓
block B blue interesting
▓▓▓▓▓▓▓▓▓
▓ ▓▓
▓▓
▓▓
▓ ▓
▓▓
▓▓
▓ ▓▓
▓▓▓▓▓▓▓▓▓
block p red interesting
▓▓▓▓▓
▓ ▓ ▓
▓▓▓▓▓
▓▓▓▓▓
▓▓▓▓▓

39
levels/challenge06.txt Normal file
View File

@ -0,0 +1,39 @@
player p height 105
block W white boring
▓▓▓
▓w▓
▓▓▓
block w white interesting
p 1
=
2 3
block 1 blue interesting
block 2 green interesting
block 3 yellow interesting
block p red interesting
-

89
levels/challenge11.txt Normal file
View File

@ -0,0 +1,89 @@
player p height 98
block w white boring
▓▓▓▓▓▓▓
▓▓▓ab▓▓
▓▓▓gc▓▓
▓▓▓▓▓▓▓
▓▓▓▓▓▓▓
▓p d▓
▓▓▓▓▓▓▓
link a g green
link b g green
link c g green
link d g green
block g green interesting
1ABCD
EFGHI
KLM2
OP3QR
STUVW
block 1 yellow interesting
▓▓ ▓▓
▓▓
▓▓▓▓▓
▓▓▓=
▓▓▓▓▓
block 2 yellow interesting
▓ ▓ ▓
▓ ▓
▓ ▓ ▓
▓ ▓
▓▓▓ ▓
block 3 yellow interesting
▓▓▓ ▓
▓▓▓ ▓
▓▓▓ ▓
▓ ▓▓▓
block A blue boring
block B blue boring
block C blue boring
block D blue boring
block E blue boring
block F blue boring
block G blue boring
block H blue boring
block I blue boring
block J blue boring
block K blue boring
block L blue boring
block M blue boring
block N blue boring
block O blue boring
block P blue boring
block Q blue boring
block R blue boring
block S blue boring
block T blue boring
block U blue boring
block V blue boring
block W blue boring
block p magenta boring
▓▓▓▓▓
▓ ▓ ▓
▓▓▓▓▓
▓▓▓▓▓
▓▓▓▓▓

46
levels/challenge16.txt Normal file
View File

@ -0,0 +1,46 @@
player p height 98
block g green interesting
▓▓▓▓▓▓▓▓▓
▓▓g123456
▓▓▓▓ ▓▓▓▓
▓ ▓
▓ 7 8 9 ▓
▓ ▓
▓ p y ▓
▓ Y▓
▓▓▓▓▓▓▓▓▓
block y yellow interesting
link Y y yellow
block 1 red boring
block 2 red boring
block 3 red boring
block 4 red boring
▓▓▓
▓=▓
▓ ▓
block 5 red boring
block 6 red boring
block 7 red boring
block 8 red boring
block 9 red boring
block p magenta boring
▓▓▓▓▓
▓ ▓ ▓
▓▓▓▓▓
▓▓▓▓▓
▓▓▓▓▓

View File

@ -45,10 +45,12 @@ block y blue boring
block z blue boring block z blue boring
block p magenta boring block p magenta boring height 7
▓▓▓▓▓ ▓▓▓▓▓
▓ ▓ ▓ ▓ ▓ ▓
▓▓▓▓▓
▓▓▓▓▓
▓▓▓▓▓ ▓▓▓▓▓
▓▓▓▓▓ ▓▓▓▓▓
block 1 green interesting block 1 green interesting

70
levels/challenge32.txt Normal file
View File

@ -0,0 +1,70 @@
player p
block W white boring
▓▓▓
▓w▓
▓▓▓
block w white interesting
▓▓Y▓
1 ▓ y
2
3 p
ABC
▓ 4567
block Y yellow interesting
▓▓▓▓▓
▓▓▓▓▓
▓ =▓▓
▓ ▓▓▓
▓ ▓▓▓
block g green interesting
▓D▓
E▓F
▓G▓
link A g green
link B g green
link C g green
link D g green
link E g green
link F g green
link G g green
epsilon ε g green
block Q red interesting
▓▓▓▓▓▓▓▓▓
▓ ▓
▓ ▓
▓ ▓
▓ ε ▓
▓ ▓
▓ ▓
▓ ▓
▓▓▓▓▓▓▓▓▓
block 1 blue boring
block 2 blue boring
block 3 blue boring
block 4 blue boring
block 5 blue boring
block 6 blue boring
block 7 blue boring
block y yellow boring
▓ ▓▓▓
▓ ▓▓▓
▓▓▓
▓▓▓▓▓
▓▓▓▓▓
block p magenta boring
▓▓▓▓▓
▓ ▓ ▓
▓▓▓▓▓
▓▓▓▓▓
▓▓▓▓▓

68
levels/challenge33.txt Normal file
View File

@ -0,0 +1,68 @@
player p height 121
block b blue interesting
▓▓
▓ ▓▓
▓A
▓▓
p ▓B
▓ ▓▓
f b▓▓▓C
▓▓▓▓▓
▓▓▓▓D
▓▓▓▓y▓▓▓▓▓▓
▓▓▓▓▓▓▓▓▓▓▓
block y yellow interesting
link f b blue
epsilon A b blue
X
▓ c
link c b blue
link X y yellow
epsilon B A blue
Y
d
▓ ▓
2
link d b blue
link Y y yellow
epsilon C B blue
Z
e 3
link e b blue
link Z y yellow
epsilon D C blue
=
block 1 yellow boring
block 2 yellow boring
block 3 yellow boring
block p magenta boring
▓▓▓▓▓
▓ ▓ ▓
▓▓▓▓▓
▓▓▓▓▓
▓▓▓▓▓

36
levels/challenge34.txt Normal file
View File

@ -0,0 +1,36 @@
player p height 98
block w white interesting
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▓ ▓▓▓ ▓
▓ ▓ ▓
▓ 1 ▓ E ▓
▓ ▓▓ ▓
▓ 2 3 ▓ ▓
▓ ▓▓▓▓▓▓▓
▓ ▓ p ▓▓-▓▓
▓ ▓- F ▓
▓ A b ▓▓▓▓-▓▓
▓ ▓▓▓▓▓▓▓
▓ B ▓▓= ▓▓▓
▓ ▓▓ I ▓▓
▓ ▓▓▓ ▓▓▓
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
block b blue interesting
epsilon E b blue
epsilon F E blue
link A b blue
link B b blue
infinity I b blue
block 1 yellow boring
block 2 yellow boring
block p magenta boring
▓▓▓▓▓
▓ ▓ ▓
▓▓▓▓▓
▓▓▓▓▓
▓▓▓▓▓

33
levels/gallery01.txt Normal file
View File

@ -0,0 +1,33 @@
player p height 98
block w white interesting
▓▓▓▓▓▓▓
▓ ▓
▓ b ▓
▓ p ▓
▓ g ▓
▓ ▓
▓▓▓▓▓▓▓
block b blue interesting
block g green interesting
▓▓▓ ▓▓▓
▓▓ ▓▓▓
▓▓ ▓▓▓▓
=▓ ▓▓
▓▓-12 ▓
▓▓-▓▓▓▓
▓▓▓▓▓▓▓
block 1 yellow boring
block 2 yellow boring
block p magenta boring
▓▓▓▓▓
▓ ▓ ▓
▓▓▓▓▓
▓▓▓▓▓
▓▓▓▓▓

23
levels/gallery02.txt Normal file
View File

@ -0,0 +1,23 @@
player p height 98
block b blue interesting
▓▓▓▓▓▓▓
▓ ▓
▓ g ▓
▓p -
▓ b ▓
▓ ▓
▓▓▓▓▓▓▓
block g green interesting
▓▓▓▓▓▓▓
▓ ▓
▓ ▓
- = ▓
▓ ▓
▓ ▓
▓▓▓▓▓▓▓
block p magenta boring
▓▓▓▓▓
▓ ▓ ▓
▓▓▓▓▓
▓▓▓▓▓
▓▓▓▓▓

23
levels/gallery03.txt Normal file
View File

@ -0,0 +1,23 @@
player p height 98
block b blue interesting
▓▓▓▓▓▓▓
=▓
- -p ▓
g ▓
▓ b▓▓
▓▓▓▓ ▓▓
▓▓▓▓▓▓
block g green interesting
block p magenta boring
▓▓▓▓▓
▓ ▓ ▓
▓▓▓▓▓
▓▓▓▓▓
▓▓▓▓▓

View File

@ -0,0 +1,26 @@
player p
block p magenta boring
▓▓▓▓▓
▓ ▓ ▓
▓▓▓▓▓
▓▓▓▓▓
▓▓▓▓▓
block w white interesting
▓▓▓▓▓▓▓
▓▓▓▓ ▓▓
▓ g ▓
▓ ▓
▓ p ▓
▓ G ▓
▓▓▓▓▓▓▓
block g green interesting
▓ ▓
▓▓▓
▓▓▓
link G g green
epsilon ε g green
=

View File

@ -0,0 +1,28 @@
player p height 98
block p magenta boring
▓▓▓▓▓
▓ ▓ ▓
▓▓▓▓▓
▓▓▓▓▓
▓▓▓▓▓
block w white interesting
▓▓▓▓▓▓▓
▓ ▓
▓ p ▓
▓G ▓
▓ ▓
▓g 1 ▓
▓▓▓▓▓▓▓
block g green interesting
▓ ▓
▓▓▓
link G g green
block 1 blue boring
epsilon ε g green
=

View File

@ -0,0 +1,31 @@
player p height 98
block p magenta boring
▓▓▓▓▓
▓ ▓ ▓
▓▓▓▓▓
▓▓▓▓▓
▓▓▓▓▓
block w white interesting
▓▓▓▓▓▓▓
▓▓▓ Gg▓
▓ F▓
▓ 1 ▓
▓ ▓▓
▓p ▓▓
▓▓▓▓▓▓▓
block g green interesting
▓▓▓▓▓
▓▓▓▓▓
▓▓▓▓
▓▓▓▓▓
▓▓ ▓▓
link G g green
link F g green
block 1 blue boring
epsilon ε g green
=
▓▓
▓ ▓▓
-▓

View File

@ -0,0 +1,32 @@
player p
block p magenta boring
▓▓▓▓▓
▓ ▓ ▓
▓▓▓▓▓
▓▓▓▓▓
▓▓▓▓▓
block w white interesting
▓▓▓▓▓▓▓
▓ ▓
▓ 1 2 ▓
▓ p ▓
▓ G ▓
▓ g ▓
▓▓▓▓▓▓▓
block g green interesting
▓▓ ▓▓
▓▓ ▓▓
▓▓ ▓▓
▓▓▓▓▓
▓▓▓▓▓
link G g green
block 1 blue boring
block 2 blue boring
epsilon ε g green
=

View File

@ -0,0 +1,32 @@
player p height 98
block p magenta boring
▓▓▓▓▓
▓ ▓ ▓
▓▓▓▓▓
▓▓▓▓▓
▓▓▓▓▓
block w white interesting
▓▓▓▓▓▓▓
▓ ▓
▓ 1 2 ▓
▓ p ▓
▓ g ▓
▓ G ▓
▓▓▓▓▓▓▓
block g green interesting
▓▓ ▓▓
▓▓ ▓▓
▓▓ ▓▓
▓▓▓▓▓
▓▓▓▓▓
link G g green
block 1 blue boring
block 2 blue boring
epsilon ε g green
=

View File

@ -1,4 +1,4 @@
player p player p height 98
block w white interesting block w white interesting
▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓
▓ p ▓ ▓ p ▓

View File

@ -0,0 +1,26 @@
player p height 98
block w white interesting
▓▓▓▓▓▓▓
▓- ▓ ▓▓
▓=p ▓▓
▓ ▓
▓ ▓ε▓▓
▓g ▓ ▓▓
▓▓▓▓▓▓▓
link G g green
block g green interesting
▓▓▓
▓▓G
▓▓▓
epsilon ε g green
block p magenta boring
▓▓▓▓▓
▓ ▓ ▓
▓▓▓▓▓
▓▓▓▓▓
▓▓▓▓▓

View File

@ -0,0 +1,26 @@
player p height 81
block w white interesting
▓▓▓▓▓▓▓▓▓
▓g ▓▓▓
▓ = ▓▓
▓G p ▓▓
▓ - ▓
▓ ▓▓
▓▓ ε ▓▓
▓▓▓▓▓▓ ▓▓
▓▓▓▓▓▓▓▓▓
link G g green
block g green interesting
epsilon ε g green
▓ ▓
▓ ▓
block p magenta boring
▓▓▓▓▓
▓ ▓ ▓
▓▓▓▓▓
▓▓▓▓▓
▓▓▓▓▓

View File

@ -0,0 +1,29 @@
player p
block p magenta boring
▓▓▓▓▓
▓ ▓ ▓
▓▓▓▓▓
▓▓▓▓▓
▓▓▓▓▓
block g green interesting
▓▓▓
▓ ε▓▓
▓▓▓
p
▓ --- ▓
g=G
link G g green
link F g green
epsilon ε g green
▓ F
▓▓▓▓▓▓
▓▓

View File

@ -35,12 +35,6 @@ epsilon ε r red
block 1 blue boring block 1 blue boring
block 2 blue boring block 2 blue boring