Search in sources :

Example 1 with XYLocation

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

the class EightPuzzleBoardTest method testGetLocation.

@Test
public void testGetLocation() {
    Assert.assertEquals(new XYLocation(0, 2), board.getLocationOf(0));
    Assert.assertEquals(new XYLocation(1, 1), board.getLocationOf(1));
    Assert.assertEquals(new XYLocation(2, 2), board.getLocationOf(2));
    Assert.assertEquals(new XYLocation(2, 1), board.getLocationOf(3));
    Assert.assertEquals(new XYLocation(0, 1), board.getLocationOf(4));
    Assert.assertEquals(new XYLocation(0, 0), board.getLocationOf(5));
    Assert.assertEquals(new XYLocation(1, 0), board.getLocationOf(6));
    Assert.assertEquals(new XYLocation(2, 0), board.getLocationOf(7));
    Assert.assertEquals(new XYLocation(1, 2), board.getLocationOf(8));
}
Also used : XYLocation(aima.core.util.datastructure.XYLocation) Test(org.junit.Test)

Example 2 with XYLocation

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

the class EightPuzzleBoardTest method testGetPositions.

@Test
public void testGetPositions() {
    List<XYLocation> expected = new ArrayList<XYLocation>();
    expected.add(new XYLocation(0, 2));
    expected.add(new XYLocation(1, 1));
    expected.add(new XYLocation(2, 2));
    expected.add(new XYLocation(2, 1));
    expected.add(new XYLocation(0, 1));
    expected.add(new XYLocation(0, 0));
    expected.add(new XYLocation(1, 0));
    expected.add(new XYLocation(2, 0));
    expected.add(new XYLocation(1, 2));
    List<XYLocation> actual = board.getPositions();
    Assert.assertEquals(expected, actual);
}
Also used : XYLocation(aima.core.util.datastructure.XYLocation) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 3 with XYLocation

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

the class EightPuzzleBoardTest method testSetBoard.

@Test
public void testSetBoard() {
    List<XYLocation> passedIn = new ArrayList<XYLocation>();
    passedIn.add(new XYLocation(1, 1));
    passedIn.add(new XYLocation(0, 2));
    passedIn.add(new XYLocation(2, 2));
    passedIn.add(new XYLocation(2, 1));
    passedIn.add(new XYLocation(0, 1));
    passedIn.add(new XYLocation(0, 0));
    passedIn.add(new XYLocation(1, 0));
    passedIn.add(new XYLocation(2, 0));
    passedIn.add(new XYLocation(1, 2));
    board.setBoard(passedIn);
    Assert.assertEquals(new XYLocation(1, 1), board.getLocationOf(0));
    Assert.assertEquals(new XYLocation(0, 2), board.getLocationOf(1));
}
Also used : XYLocation(aima.core.util.datastructure.XYLocation) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 4 with XYLocation

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

the class NQueensBoardTest method testRemoveQueen.

@Test
public void testRemoveQueen() {
    board.addQueenAt(new XYLocation(0, 0));
    Assert.assertEquals(1, board.getNumberOfQueensOnBoard());
    board.removeQueenFrom(new XYLocation(0, 0));
    Assert.assertEquals(0, board.getNumberOfQueensOnBoard());
}
Also used : XYLocation(aima.core.util.datastructure.XYLocation) Test(org.junit.Test)

Example 5 with XYLocation

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

the class NQueensBoardTest method testEquality.

@Test
public void testEquality() {
    board.addQueenAt(new XYLocation(0, 0));
    NQueensBoard board2 = new NQueensBoard(8);
    board2.addQueenAt(new XYLocation(0, 0));
    Assert.assertEquals(board, board2);
    NQueensBoard board3 = new NQueensBoard(8);
    board3.addQueenAt(new XYLocation(0, 1));
    Assert.assertFalse(board.equals(board3));
}
Also used : XYLocation(aima.core.util.datastructure.XYLocation) NQueensBoard(aima.core.environment.nqueens.NQueensBoard) 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