From 49aebbc4ef4ba436f5a8fc3f72e1982b4c79b51b Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 15 Apr 2013 14:39:42 +0200 Subject: [PATCH] Add blocked check to level --- erdslangetjie/level.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/erdslangetjie/level.py b/erdslangetjie/level.py index 7905571..4dffd6d 100644 --- 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 -- 2.34.1