This commit is contained in:
Stephen McQuay 2012-10-25 21:33:35 -07:00
commit 612fb5f38e
4 changed files with 96 additions and 0 deletions

4
.hgignore Normal file
View File

@ -0,0 +1,4 @@
.*.swp$
.*.pyc$
tags$

3
bin/p1.py Normal file
View File

@ -0,0 +1,3 @@
from maze import make_maze
print make_maze()

17
maze/__init__.py Normal file
View File

@ -0,0 +1,17 @@
import random
def make_maze(size=8):
r = [[[0] * size] * size] * size
for i in xrange(size):
for j in xrange(size):
r[i][j] = [random.randint(0, 1) for i in xrange(size)]
r[0][0][0] = 1
r[7][7][7] = 1
return r
def parse_maze(filename):
f = open(filename, 'r')
t = f.read()
return [[int(j) for j in i.split()] for i in t.split('\n\n') if i]

72
samples/maze.txt Normal file
View File

@ -0,0 +1,72 @@
1 0 0 0 1 0 0 0
0 1 1 1 1 1 0 0
0 1 0 1 1 0 0 0
0 1 1 1 0 0 1 1
1 1 0 0 0 1 0 0
1 1 1 0 0 1 1 0
1 0 1 0 0 1 0 1
0 0 1 0 1 0 1 0
1 0 0 0 0 1 0 0
1 1 0 0 0 1 0 1
1 0 1 0 1 1 1 1
0 0 0 0 1 0 0 1
0 0 0 0 1 0 1 1
0 0 0 1 0 0 1 0
1 0 1 0 1 0 0 0
0 1 0 1 1 0 0 1
1 1 1 0 0 0 0 1
1 0 0 1 1 1 0 1
1 0 0 1 1 0 1 0
0 1 0 1 0 1 1 1
1 0 1 1 1 1 0 0
0 1 0 1 1 0 0 0
1 1 0 1 0 0 0 1
1 1 1 0 0 0 1 0
1 1 0 0 1 0 1 1
1 1 1 1 1 0 0 1
1 1 0 0 1 0 1 1
0 1 1 1 1 1 0 1
0 1 1 0 0 0 1 0
0 1 0 1 0 0 0 0
1 1 0 1 0 1 1 0
0 0 0 0 1 1 1 0
1 0 0 0 1 1 1 0
0 1 0 1 0 1 0 1
1 0 0 1 0 0 0 0
1 1 1 0 0 1 0 0
0 1 1 0 0 0 1 0
0 1 0 1 0 1 0 0
1 0 0 1 1 1 0 1
1 1 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