- def check_task(self, task, *args, **kwargs):
- if task == 'move':
- if len(args) > 0:
- direction = args[0]
- else:
- direction = kwargs['direction']
- test_pos = self.position[:]
- self._move_pos(direction, test_pos)
- if test_pos[0] < 0 or test_pos[1] < 0 or \
- test_pos[0] >= self.world.map_size[0] or \
- test_pos[1] >= self.world.map_size[1]:
- raise GameError('would move outside map bounds')
- pos_i = test_pos[0] * self.world.map_size[1] + test_pos[1]
- map_tile = self.world.map_[pos_i]
- if map_tile != '.':
- raise GameError('would move into illegal terrain')
-