Optimisation!
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user