unified stdin/file solving

This commit is contained in:
Stephen McQuay 2012-10-31 22:33:30 -07:00
parent 5f3384d4f2
commit b5443cb424
2 changed files with 4 additions and 7 deletions

View File

@ -1,6 +0,0 @@
import sys
from maze import parse_maze
m = parse_maze(open(sys.argv[1], 'r').read())
print m.solve()

View File

@ -2,5 +2,8 @@ import sys
from maze import parse_maze from maze import parse_maze
m = parse_maze(sys.stdin.read()) if len(sys.argv) == 2:
m = parse_maze(open(sys.argv[1], 'r').read())
else:
m = parse_maze(sys.stdin.read())
print m.solve() print m.solve()