X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=naja%2Fplayer.py;h=00e6133ed720486bd19d878136abcdcd5087b86a;hb=1fd94d28fdfa2331a025ce3b0d0f6fecb5af3324;hp=ff253da35ea3113216240649fa4dfe8a0dbf5dab;hpb=616e138c8fa95c96280bc367e908178737ca180b;p=naja.git diff --git a/naja/player.py b/naja/player.py index ff253da..00e6133 100644 --- a/naja/player.py +++ b/naja/player.py @@ -91,3 +91,11 @@ class Player(object): 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]: + position = self.get_adjacent_position(direction) + if position is not None and self.bits.check_bit(direction): + positions.append(position) + return positions