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));
}
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)));
}
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));
}
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));
}
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));
}
Aggregations