Fixed lasermirror room bug where levers are unaccessible.

This commit is contained in:
Niels Serup 2012-08-10 12:42:36 +02:00
parent c16fc5cd6a
commit a1e05a19fd
1 changed files with 6 additions and 5 deletions

View File

@ -82,12 +82,13 @@ def generate_simple_playfield(nmirrors):
succs = (lambda s: lambda d: succ(s(d)))(succs) succs = (lambda s: lambda d: succ(s(d)))(succs)
source_direc = succ(source_direc) source_direc = succ(source_direc)
occup = set(playfield.keys())
emptys = list( emptys = list(
set([(0, y) for y in range(12)] set([(0, y) for y in filter(lambda y: (1, y) not in occup, range(12))]
+ [(11, y) for y in range(12)] + [(11, y) for y in filter(lambda y: (10, y) not in occup, range(12))]
+ [(x, 0) for x in range(12)] + [(x, 0) for x in filter(lambda x: (x, 1) not in occup, range(12))]
+ [(x, 11) for x in range(12)]) + [(x, 11) for x in filter(lambda x: (x, 10) not in occup, range(12))])
- set(playfield.keys())) - occup)
if len(emptys) < nlevers: if len(emptys) < nlevers:
raise Exception("Not enough space for all levers!") raise Exception("Not enough space for all levers!")
for pos in misc.pick_random_elements(emptys, nlevers): for pos in misc.pick_random_elements(emptys, nlevers):