Added elevator and minor other things to level 3 and 4. Added link from level 3

to level 4.
This commit is contained in:
Niels Serup
2012-08-21 18:36:51 +02:00
parent e7745a6f60
commit ca7fea1916
9 changed files with 175 additions and 48 deletions

View File

@@ -54,12 +54,12 @@ class Source(object):
def generate_simple_playfield(nmirrors):
"""
Generate a completable 16x16 playfield where:
Generate a completable 17x17 playfield where:
* there are four laser sources, one in each corner
+ the one in the upper left corner (0, 0) starts in (0, -1) heading down
+ the one in the upper right corner (15, 0) starts in (16, 0), heading left
+ the one in the lower right corner (15, 15) starts in (15, 16), heading up
+ the one in the lower left corner (0, 15) starts in (-1, 15), heading right
+ the one in the upper right corner (16, 0) starts in (17, 0), heading left
+ the one in the lower right corner (16, 16) starts in (16, 17), heading up
+ the one in the lower left corner (0, 16) starts in (-1, 16), heading right
* there are four laser targets
* there are nmirrors mirrors
* there are nmirrors levers
@@ -69,20 +69,25 @@ def generate_simple_playfield(nmirrors):
Target | MirrorLeft | MirrorRight | rstone.Blocker | Lever}
"""
width, height = 16, 16
width, height = 17, 17
playfield = {(0, 0): Source(Down),
(width - 1, 0): Source(Left),
(width - 1, height - 1): Source(Up),
(0, height - 1): Source(Right),
(6, 6): Target,
(9, 6): Target,
(6, 9): Target,
(9, 9): Target,
(10, 6): Target,
(6, 10): Target,
(10, 10): Target,
(7, 7): rstone.Blocker,
(7, 8): rstone.Blocker,
(7, 9): rstone.Blocker,
(8, 7): rstone.Blocker,
(8, 8): rstone.Blocker,
(8, 9): rstone.Blocker,
(9, 7): rstone.Blocker,
(9, 8): rstone.Blocker,
(9, 9): rstone.Blocker,
}
succs = lambda d: d
@@ -156,7 +161,7 @@ def generate_lasers(playfield):
Return [((x, y), direction), ...]
"""
width, height = 16, 16
width, height = 17, 17
sources = ((pos, obj.direction) for pos, obj
in filter(lambda posobj: isinstance(posobj[1], Source),
playfield.items()))