X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=naja%2Fplayer.py;fp=naja%2Fplayer.py;h=f502b640ffd94ddd999022931425e77248794141;hb=0bd160dc700e55e996a1ad89e9daf6cdc00c88d8;hp=00e6133ed720486bd19d878136abcdcd5087b86a;hpb=adc94b74d51f5e20faac9b98257463eb918585fd;p=naja.git diff --git a/naja/player.py b/naja/player.py index 00e6133..f502b64 100644 --- a/naja/player.py +++ b/naja/player.py @@ -92,6 +92,12 @@ 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 = [self.position] for direction in [BITS.NORTH, BITS.SOUTH, BITS.EAST, BITS.WEST]: