"""Load the level"""
self.data = []
for line in levelfile.readlines():
- self.data.append(list(line))
+ self.data.append(list(line.strip('\n')))
def load_tiles(self):
"""Load the list of tiles for the level"""
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