Ejemplo n.º 1
0
    def test_is_legal_move_for_bishop_negative_test(self):
        from board import Board
        b = Board()
        b._board = ChessTest.board1

        #Move left
        self.assertFalse(b._isLegalMoveForBishop([2, 7, 1, 7]))

        #Path blocked by friendly piece
        self.assertFalse(b._isLegalMoveForBishop([5, 0, 3, 2]))

        #Path blocked by enemy piece
        #(Even though this would otherwise be a legitimate kill)
        self.assertFalse(b._isLegalMoveForBishop([5, 7, 0, 2]))
Ejemplo n.º 2
0
    def test_is_legal_move_for_bishop(self):
        from board import Board
        b = Board()
        b._board = ChessTest.board2

        #Move up and to the left
        self.assertTrue(b._isLegalMoveForBishop([2, 0, 0, 2]))
        
        #Move down and to the right
        self.assertTrue(b._isLegalMoveForBishop([2, 5, 4, 7]))

        b._board = ChessTest.board1

        #Legal kill
        self.assertTrue(b._isLegalMoveForBishop([5, 7, 1, 3]))