def test_blocked_moves(self): position = [ [(BISHOP, WHITE), None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, (BISHOP, WHITE), None, None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None]] chess_position = ChessPosition(position, 3) moves = chess_position._get_bishop_moves(position[0][0], 0, 0) self.assertEquals(len(moves), 1, moves) move = moves[0] self.assertExistsPiece(move, (BISHOP, WHITE), 1, 1) position = [ [(BISHOP, WHITE), None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, (BISHOP, BLACK), None, None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None]] chess_position = ChessPosition(position, 3) moves = chess_position._get_bishop_moves(position[0][0], 0, 0) self.assertEquals(len(moves), 2, moves) move = moves[0] self.assertExistsPiece(move, (BISHOP, WHITE), 1, 1) move = moves[1] self.assertOnlyPiece(move, (BISHOP, WHITE), 2, 2)
def test_blocked_moves(self): position = [[ (BISHOP, WHITE), None, None, None, None, None, None, None ], [None, None, None, None, None, None, None, None], [None, None, (BISHOP, WHITE), None, None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None]] chess_position = ChessPosition(position, 3) moves = chess_position._get_bishop_moves(position[0][0], 0, 0) self.assertEquals(len(moves), 1, moves) move = moves[0] self.assertExistsPiece(move, (BISHOP, WHITE), 1, 1) position = [[ (BISHOP, WHITE), None, None, None, None, None, None, None ], [None, None, None, None, None, None, None, None], [None, None, (BISHOP, BLACK), None, None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None]] chess_position = ChessPosition(position, 3) moves = chess_position._get_bishop_moves(position[0][0], 0, 0) self.assertEquals(len(moves), 2, moves) move = moves[0] self.assertExistsPiece(move, (BISHOP, WHITE), 1, 1) move = moves[1] self.assertOnlyPiece(move, (BISHOP, WHITE), 2, 2)
def test_all_side_moves(self): position = [[None, None, None, None, None, None, None, None], [ None, (BISHOP, BLACK), None, (BISHOP, BLACK), None, None, None, None ], [ None, None, (BISHOP, WHITE), None, None, None, None, None ], [ None, (BISHOP, BLACK), None, (BISHOP, BLACK), None, None, None, None ], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None]] chess_position = ChessPosition(position, 3) moves = chess_position._get_bishop_moves(position[2][2], 2, 2) self.assertEquals(len(moves), 4, moves) move = moves[0] self.assertExistsPiece(move, (BISHOP, WHITE), 3, 3) move = moves[1] self.assertExistsPiece(move, (BISHOP, WHITE), 3, 1) move = moves[2] self.assertExistsPiece(move, (BISHOP, WHITE), 1, 3) move = moves[3] self.assertExistsPiece(move, (BISHOP, WHITE), 1, 1)
def test_all_side_moves(self): position = [ [None, None, None, None, None, None, None, None], [None, (BISHOP, BLACK), None, (BISHOP, BLACK), None, None, None, None], [None, None, (BISHOP, WHITE), None, None, None, None, None], [None, (BISHOP, BLACK), None, (BISHOP, BLACK), None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None]] chess_position = ChessPosition(position, 3) moves = chess_position._get_bishop_moves(position[2][2], 2, 2) self.assertEquals(len(moves), 4, moves) move = moves[0] self.assertExistsPiece(move, (BISHOP, WHITE), 3, 3) move = moves[1] self.assertExistsPiece(move, (BISHOP, WHITE), 3, 1) move = moves[2] self.assertExistsPiece(move, (BISHOP, WHITE), 1, 3) move = moves[3] self.assertExistsPiece(move, (BISHOP, WHITE), 1, 1)