Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vivanishin committed Apr 12, 2015
1 parent 1f8b91e commit 454b5c7
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 2 deletions.
7 changes: 5 additions & 2 deletions animation-maze.sage
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ def neighbours(i, j):
return ans

def dfs(g, i, j, visited, animation):
print i, j
if (lab_h - 1, lab_w - 1) in visited: return
animation += [g + square(i, j, 'pink')]
g += square(i, j, 'pink')
animation += [g]
visited.add((i, j))
if (i, j) == (lab_h - 1, lab_w - 1):
animation += [g + square(i, j, 'red')]
Expand All @@ -44,5 +46,6 @@ for line in inp:
lab_h = len(lab)
lab_w = len(lab[0])
frames = [g]

dfs(g, 0, 0, set(), frames)
animate(frames).show(delay=66)
#animate(frames).show(delay=66)
5 changes: 5 additions & 0 deletions maze-0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.......
.#.###.
.#...#.
.#.####
.#.....
11 changes: 11 additions & 0 deletions maze-1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
...........
.#.###.###.
.#...#...#.
.#.#####.#.
.#.....#.#.
##.###.###.
.....#.#.#.
.#.###.#.##
.#...#.#...
##.#.###.##
...#.......
11 changes: 11 additions & 0 deletions maze-2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
...........
.#.###.###.
.#...#...#.
.#.#####.#.
.#.....#.#.
##.###.###.
.....#.#.#.
.#.###.#.##
.#...#.....
########.##
...#.......
3 changes: 3 additions & 0 deletions maze-3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.....
.#.##
.#...

0 comments on commit 454b5c7

Please sign in to comment.