Search in sources :

Example 31 with XYLocation

use of aima.core.util.datastructure.XYLocation in project aima-java by aimacode.

the class NQueensFunctionsTest method testSingleSquareBoard.

@Test
public void testSingleSquareBoard() {
    board = new NQueensBoard(1);
    Assert.assertFalse(goalTest.test(board));
    board.addQueenAt(new XYLocation(0, 0));
    Assert.assertTrue(goalTest.test(board));
}
Also used : XYLocation(aima.core.util.datastructure.XYLocation) NQueensBoard(aima.core.environment.nqueens.NQueensBoard) Test(org.junit.Test) GoalTest(aima.core.search.framework.problem.GoalTest)

Example 32 with XYLocation

use of aima.core.util.datastructure.XYLocation in project aima-java by aimacode.

the class NQueensBoardTest method testAttack6.

@Test
public void testAttack6() {
    board.addQueenAt(new XYLocation(1, 6));
    Assert.assertTrue(board.isSquareUnderAttack(new XYLocation(0, 7)));
}
Also used : XYLocation(aima.core.util.datastructure.XYLocation) Test(org.junit.Test)

Example 33 with XYLocation

use of aima.core.util.datastructure.XYLocation in project aima-java by aimacode.

the class NQueensFunctionsTest method testCorrectPlacement.

@Test
public void testCorrectPlacement() {
    Assert.assertFalse(goalTest.test(board));
    // This is the configuration of Figure 5.9 (c) in AIMA 2nd Edition
    board.addQueenAt(new XYLocation(0, 1));
    board.addQueenAt(new XYLocation(1, 4));
    board.addQueenAt(new XYLocation(2, 6));
    board.addQueenAt(new XYLocation(3, 3));
    board.addQueenAt(new XYLocation(4, 0));
    board.addQueenAt(new XYLocation(5, 7));
    board.addQueenAt(new XYLocation(6, 5));
    board.addQueenAt(new XYLocation(7, 2));
    Assert.assertTrue(goalTest.test(board));
}
Also used : XYLocation(aima.core.util.datastructure.XYLocation) Test(org.junit.Test) GoalTest(aima.core.search.framework.problem.GoalTest)

Example 34 with XYLocation

use of aima.core.util.datastructure.XYLocation in project aima-java by aimacode.

the class NQueensFunctionsTest method testInCorrectPlacement.

@Test
public void testInCorrectPlacement() {
    Assert.assertFalse(goalTest.test(board));
    // This is the configuration of Figure 3.5 (b) in AIMA 2nd Edition
    board.addQueenAt(new XYLocation(0, 0));
    board.addQueenAt(new XYLocation(1, 2));
    board.addQueenAt(new XYLocation(2, 4));
    board.addQueenAt(new XYLocation(3, 6));
    board.addQueenAt(new XYLocation(4, 1));
    board.addQueenAt(new XYLocation(5, 3));
    board.addQueenAt(new XYLocation(6, 5));
    board.addQueenAt(new XYLocation(7, 7));
    Assert.assertFalse(goalTest.test(board));
}
Also used : XYLocation(aima.core.util.datastructure.XYLocation) Test(org.junit.Test) GoalTest(aima.core.search.framework.problem.GoalTest)

Example 35 with XYLocation

use of aima.core.util.datastructure.XYLocation in project aima-java by aimacode.

the class XYEnvironmentTest method testAddObject.

@Test
public void testAddObject() {
    Assert.assertEquals(1, env.getAgents().size());
    Assert.assertEquals(new XYLocation(3, 4), env.getCurrentLocationFor(a));
}
Also used : XYLocation(aima.core.util.datastructure.XYLocation) Test(org.junit.Test)

Aggregations

XYLocation (aima.core.util.datastructure.XYLocation)56 Test (org.junit.Test)42 TicTacToeState (aima.core.environment.tictactoe.TicTacToeState)5 NQueensBoard (aima.core.environment.nqueens.NQueensBoard)4 Wall (aima.core.environment.xyenv.Wall)4 MockAgent (aima.test.core.unit.agent.impl.MockAgent)4 ArrayList (java.util.ArrayList)4 AbstractAgent (aima.core.agent.impl.AbstractAgent)3 GoalTest (aima.core.search.framework.problem.GoalTest)3 EnvironmentObject (aima.core.agent.EnvironmentObject)2 TicTacToeGame (aima.core.environment.tictactoe.TicTacToeGame)2 XYEnvironment (aima.core.environment.xyenv.XYEnvironment)1 IterativeDeepeningAlphaBetaSearch (aima.core.search.adversarial.IterativeDeepeningAlphaBetaSearch)1 LinkedHashSet (java.util.LinkedHashSet)1 Background (javafx.scene.layout.Background)1 BackgroundFill (javafx.scene.layout.BackgroundFill)1 ColumnConstraints (javafx.scene.layout.ColumnConstraints)1 RowConstraints (javafx.scene.layout.RowConstraints)1 StackPane (javafx.scene.layout.StackPane)1 Polygon (javafx.scene.shape.Polygon)1