示例#1
0
    def test_non_attack(self):
        piece_01 = Rook("white")
        piece_02 = Bishop("black")

        piece_01.position = (3, 3)
        piece_02.position = (4, 6)

        self.board.add_piece_to_board(piece_01)
        self.board.add_piece_to_board(piece_02)

        expected_score = 0
        self.assertEqual(self.evaluate_score(), expected_score)
示例#2
0
    def test_same_color_asymetry_attack(self):
        piece_01 = Rook("white")
        piece_02 = Bishop("white")

        piece_01.position = (3, 3)
        piece_02.position = (3, 6)

        self.board.add_piece_to_board(piece_01)
        self.board.add_piece_to_board(piece_02)

        expected_score = -1
        self.assertEqual(self.evaluate_score(), expected_score)
示例#3
0
    def test_knight_attack(self):
        piece_01 = Rook("white")
        piece_02 = Knight("white")

        piece_01.position = (3, 3)
        piece_02.position = (5, 4)

        self.board.add_piece_to_board(piece_01)
        self.board.add_piece_to_board(piece_02)

        expected_score = -1
        self.assertEqual(self.evaluate_score(), expected_score)
示例#4
0
    def test_inline_attack(self):
        piece_01 = Rook("white")
        piece_02 = Bishop("white")
        piece_03 = Bishop("black")  # hiding behind piece 2

        piece_01.position = (3, 3)
        piece_02.position = (3, 4)
        piece_03.position = (3, 5)

        self.board.add_piece_to_board(piece_01)
        self.board.add_piece_to_board(piece_02)
        self.board.add_piece_to_board(piece_03)

        expected_score = -1
        self.assertEqual(self.evaluate_score(), expected_score)
示例#5
0
    def test_diff_color_attack(self):
        piece_01 = Rook("white")
        piece_02 = Rook("black")

        piece_01.position = (3, 3)
        piece_02.position = (3, 6)

        self.board.add_piece_to_board(piece_01)
        self.board.add_piece_to_board(piece_02)

        expected_score = 2
        self.assertEqual(self.evaluate_score(), expected_score)