Finished rolling stone playfield generation.

This commit is contained in:
Niels Serup
2012-08-08 11:07:33 +02:00
parent 2457f743cc
commit 6c050f954b
4 changed files with 184 additions and 153 deletions

View File

@@ -53,13 +53,9 @@ class Left(Direction):
x, y = pos
return x - 1, y
succ = {Up: Right,
Right: Down,
Down: Left,
Left: Up}.__getitem__
all_directions = set((Up, Left, Down, Right))
pred = {Right: Up,
Down: Right,
Left: Down,
Up: Left}.__getitem__
succ = lambda d: all_directions[(all_directions.index(d) + 1) % 4]
pred = lambda d: all_directions[(all_directions.index(d) - 1) % 4]
isDirection = lambda obj: obj in (Up, Left, Down, Right)