コード例 #1
0
    def test_get_number_of_attacking_pairs_v(self):
        size = 5
        queens = (XYLocation(1, 3), XYLocation(1, 4), XYLocation(1, 0))
        nqb = NQueensBoard(size)
        nqb.set_board(queens)

        self.assertEqual(3, nqb.get_number_of_attacking_pairs())
コード例 #2
0
    def test_get_number_of_queens_on_board(self):
        size = 5
        queens = (XYLocation(1, 1), XYLocation(2, 4), XYLocation(3, 3))
        nqb = NQueensBoard(size)

        nqb.set_board(queens)
        self.assertEqual(3, nqb.get_number_of_queens_on_board())
コード例 #3
0
ファイル: test_nqueens.py プロジェクト: mushketyk/aima-python
    def test_get_number_of_attacking_pairs_v(self):
        size = 5
        queens = (XYLocation(1, 3), XYLocation(1, 4), XYLocation(1, 0))
        nqb = NQueensBoard(size)
        nqb.set_board(queens)

        self.assertEqual(3, nqb.get_number_of_attacking_pairs())
コード例 #4
0
ファイル: test_nqueens.py プロジェクト: mushketyk/aima-python
    def test_get_number_of_queens_on_board(self):
        size = 5
        queens = (XYLocation(1, 1), XYLocation(2, 4), XYLocation(3, 3))
        nqb = NQueensBoard(size)

        nqb.set_board(queens)
        self.assertEqual(3, nqb.get_number_of_queens_on_board())
コード例 #5
0
ファイル: test_nqueens.py プロジェクト: mushketyk/aima-python
    def test_remove_queen_action(self):
        queens = (XYLocation(1, 3), XYLocation(1, 4), XYLocation(1, 0))
        nqb = NQueensBoard(5)
        nqb.set_board(queens)

        nqrf = NQResultFunction()
        new_board = nqrf.result(nqb, QueenAction(QueenAction.REMOVE_QUEEN, XYLocation(1, 4)))

        self.assertEquals(2, new_board.get_number_of_queens_on_board())
コード例 #6
0
    def test_remove_queen_action(self):
        queens = (XYLocation(1, 3), XYLocation(1, 4), XYLocation(1, 0))
        nqb = NQueensBoard(5)
        nqb.set_board(queens)

        nqrf = NQResultFunction()
        new_board = nqrf.result(
            nqb, QueenAction(QueenAction.REMOVE_QUEEN, XYLocation(1, 4)))

        self.assertEquals(2, new_board.get_number_of_queens_on_board())