Merge branch 'master' of hongabar.org:robotgame
This commit is contained in:
commit
93d3a20e06
|
@ -160,17 +160,17 @@ def generate_simple_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
|
||||
direction objects.
|
||||
Return a tuple of a playfield without direction objects, its number of
|
||||
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 = {}, []
|
||||
for pos, val in playfield.items():
|
||||
if val is Blocker:
|
||||
new_playfield[pos] = val
|
||||
else:
|
||||
directions.append(val)
|
||||
return new_playfield, directions
|
||||
return new_playfield, steps, directions
|
||||
|
||||
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
|
||||
use this in your game.
|
||||
"""
|
||||
playfield, directions = generate_simple_unsolved_solvable(
|
||||
playfield, steps, directions = generate_simple_unsolved_solvable(
|
||||
width, height, nturns, nstones)
|
||||
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):
|
||||
text = [['·' for _ in range(width)] for _ in range(height)]
|
||||
|
|
Loading…
Reference in New Issue