projects
/
erdslangetjie.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e3780ba
)
Add blocked check to level
author
Neil
<neil@dip.sun.ac.za>
Mon, 15 Apr 2013 12:39:42 +0000
(14:39 +0200)
committer
Neil
<neil@dip.sun.ac.za>
Mon, 15 Apr 2013 12:39:42 +0000
(14:39 +0200)
erdslangetjie/level.py
patch
|
blob
|
history
diff --git
a/erdslangetjie/level.py
b/erdslangetjie/level.py
index 790557179a7ba5fb6d11361887396fbad8b4896f..4dffd6deb759fa075e29eda28b3867226fef2634 100644
(file)
--- a/
erdslangetjie/level.py
+++ b/
erdslangetjie/level.py
@@
-44,3
+44,16
@@
class Level(object):
def at_exit(self, pos):
return pos in self.exit_pos
+
+ def blocked(self, pos):
+ if pos[0] < 0:
+ return True
+ if pos[1] < 0:
+ return True
+ try:
+ tile = self.data[pos[1]][pos[0]]
+ except IndexError:
+ return True
+ if tile == '.':
+ return True
+ return False