From 2a950900b3b7ae9514e5351c3a07903611b9153e Mon Sep 17 00:00:00 2001 From: Jeremy Thurgood Date: Thu, 15 May 2014 09:33:17 +0200 Subject: [PATCH] Player position is always a valid move. --- naja/player.py | 2 +- naja/tests/test_actions.py | 2 +- naja/tests/test_player.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/naja/player.py b/naja/player.py index 2156a36..00e6133 100644 --- a/naja/player.py +++ b/naja/player.py @@ -93,7 +93,7 @@ class Player(object): 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): diff --git a/naja/tests/test_actions.py b/naja/tests/test_actions.py index d903648..02c0796 100644 --- a/naja/tests/test_actions.py +++ b/naja/tests/test_actions.py @@ -129,7 +129,7 @@ class TestActions(TestCase): def test_AcquireWinToken(self): board = self.make_board( - player_bits=[BITS.CYAN, BITS.MAGENTA, BITS.YELLOW, BITS.MSB]) + player_bits=[BITS.CYAN, BITS.MAGENTA, BITS.YELLOW]) state_before = board.export() actions.AcquireWinToken(set()).perform_action(board, None) state_after = board.export() diff --git a/naja/tests/test_player.py b/naja/tests/test_player.py index cbae8cc..31cc817 100644 --- a/naja/tests/test_player.py +++ b/naja/tests/test_player.py @@ -161,9 +161,9 @@ class TestPlayer(TestCase): def test_legal_moves_all_available(self): player = Player(0x0f, (2, 2)) self.assertEqual( - player.legal_moves(), [(2, 1), (2, 3), (3, 2), (1, 2)]) + player.legal_moves(), [(2, 2), (2, 1), (2, 3), (3, 2), (1, 2)]) def test_legal_moves_some_unavailable(self): player = Player(0x0f, (0, 2)) player.bits.clear_bit(BITS.NORTH) - self.assertEqual(player.legal_moves(), [(0, 3), (1, 2)]) + self.assertEqual(player.legal_moves(), [(0, 2), (0, 3), (1, 2)]) -- 2.34.1