Optimisation!

This commit is contained in:
Sakse Dalum
2012-08-08 19:53:48 +02:00
parent a4df741866
commit 5c1af793df
4 changed files with 33 additions and 33 deletions

View File

@@ -163,7 +163,7 @@ def generate_simple_unsolved_solvable_playfield(width, height, nturns, nstones):
Return a tuple of a playfield without direction objects, its number of
steps, and a list of the direction objects.
"""
playfield, steps = generate_simple_playfield(width, height, nturns, stones)
playfield, steps = generate_simple_playfield(width, height, nturns, nstones)
new_playfield, directions = {}, []
for pos, val in playfield.items():
if val is Blocker:
@@ -180,7 +180,7 @@ def generate_simple_unsolved_solvable_extra(width, height, nturns, nstones):
"""
playfield, steps, directions = generate_simple_unsolved_solvable_playfield(
width, height, nturns, nstones)
missing_dir = list(all_directions - set(directions))[0]
missing_dir = list(set(all_directions) - set(directions))[0]
return playfield, steps, directions + [missing_dir] * (len(directions) / 3)
def print_playfield(playfield, width, height, hide_directions):