Fix in rollingstone.
This commit is contained in:
parent
4a3c977a92
commit
c948a6e688
|
@ -160,17 +160,17 @@ def generate_simple_playfield(width, height, nturns, nstones,
|
||||||
|
|
||||||
def generate_simple_unsolved_solvable_playfield(width, height, nturns, nstones):
|
def generate_simple_unsolved_solvable_playfield(width, height, nturns, nstones):
|
||||||
"""
|
"""
|
||||||
Return a tuple of a playfield without direction objects, and a list of the
|
Return a tuple of a playfield without direction objects, its number of
|
||||||
direction objects.
|
steps, and a list of the direction objects.
|
||||||
"""
|
"""
|
||||||
playfield = generate_simple_playfield(width, height, nturns, stones)
|
playfield, steps = generate_simple_playfield(width, height, nturns, stones)
|
||||||
new_playfield, directions = {}, []
|
new_playfield, directions = {}, []
|
||||||
for pos, val in playfield.items():
|
for pos, val in playfield.items():
|
||||||
if val is Blocker:
|
if val is Blocker:
|
||||||
new_playfield[pos] = val
|
new_playfield[pos] = val
|
||||||
else:
|
else:
|
||||||
directions.append(val)
|
directions.append(val)
|
||||||
return new_playfield, directions
|
return new_playfield, steps, directions
|
||||||
|
|
||||||
def generate_simple_unsolved_solvable_extra(width, height, nturns, nstones):
|
def generate_simple_unsolved_solvable_extra(width, height, nturns, nstones):
|
||||||
"""
|
"""
|
||||||
|
@ -178,10 +178,10 @@ def generate_simple_unsolved_solvable_extra(width, height, nturns, nstones):
|
||||||
of the direction object not returned by that function. You probably want to
|
of the direction object not returned by that function. You probably want to
|
||||||
use this in your game.
|
use this in your game.
|
||||||
"""
|
"""
|
||||||
playfield, directions = generate_simple_unsolved_solvable(
|
playfield, steps, directions = generate_simple_unsolved_solvable(
|
||||||
width, height, nturns, nstones)
|
width, height, nturns, nstones)
|
||||||
missing_dir = list(all_directions - set(directions))[0]
|
missing_dir = list(all_directions - set(directions))[0]
|
||||||
return playfield, directions + [missing_dir] * (len(directions) / 3)
|
return playfield, steps, directions + [missing_dir] * (len(directions) / 3)
|
||||||
|
|
||||||
def print_playfield(playfield, width, height, hide_directions):
|
def print_playfield(playfield, width, height, hide_directions):
|
||||||
text = [['·' for _ in range(width)] for _ in range(height)]
|
text = [['·' for _ in range(width)] for _ in range(height)]
|
||||||
|
|
Loading…
Reference in New Issue