Merge branch 'master' into No_movement_mode
[naja.git] / naja / player.py
index 2156a3665c8f64e21452f5e8bffd6b1750bc8146..f502b640ffd94ddd999022931425e77248794141 100644 (file)
@@ -92,8 +92,14 @@ class Player(object):
             return True
         return False
 
+    def set_position(self, new_position):
+        if new_position in self.legal_moves():
+            self.position = new_position
+            return True
+        return False
+
     def legal_moves(self):
-        positions = []
+        positions = [self.position]
         for direction in [BITS.NORTH, BITS.SOUTH, BITS.EAST, BITS.WEST]:
             position = self.get_adjacent_position(direction)
             if position is not None and self.bits.check_bit(direction):