Search in sources :

Example 1 with EightPuzzleBoard

use of aima.core.environment.eightpuzzle.EightPuzzleBoard in project aima-java by aimacode.

the class EightPuzzleBoardMoveTest method testPosition6MoveUp.

@Test
public void testPosition6MoveUp() {
    // { 6, 5, 4, 1, 8, 0, 7, 3, 2 }
    setGapToPosition6();
    board.moveGapUp();
    Assert.assertEquals(new EightPuzzleBoard(new int[] { 6, 5, 0, 1, 8, 4, 7, 3, 2 }), board);
}
Also used : EightPuzzleBoard(aima.core.environment.eightpuzzle.EightPuzzleBoard) Test(org.junit.Test)

Example 2 with EightPuzzleBoard

use of aima.core.environment.eightpuzzle.EightPuzzleBoard in project aima-java by aimacode.

the class EightPuzzleBoardMoveTest method testPosition8MoveDown.

@Test
public void testPosition8MoveDown() {
    // { 6, 5, 4, 7, 1, 8, 3, 0, 2 }
    setGapToPosition8();
    board.moveGapDown();
    Assert.assertEquals(new EightPuzzleBoard(new int[] { 6, 5, 4, 7, 1, 8, 3, 0, 2 }), board);
}
Also used : EightPuzzleBoard(aima.core.environment.eightpuzzle.EightPuzzleBoard) Test(org.junit.Test)

Example 3 with EightPuzzleBoard

use of aima.core.environment.eightpuzzle.EightPuzzleBoard in project aima-java by aimacode.

the class EightPuzzleBoardMoveTest method testPosition6MoveRight.

@Test
public void testPosition6MoveRight() {
    // { 6, 5, 4, 1, 8, 0, 7, 3, 2 }
    setGapToPosition6();
    board.moveGapRight();
    Assert.assertEquals(new EightPuzzleBoard(new int[] { 6, 5, 4, 1, 8, 0, 7, 3, 2 }), board);
}
Also used : EightPuzzleBoard(aima.core.environment.eightpuzzle.EightPuzzleBoard) Test(org.junit.Test)

Example 4 with EightPuzzleBoard

use of aima.core.environment.eightpuzzle.EightPuzzleBoard in project aima-java by aimacode.

the class EightPuzzleBoardMoveTest method testPosition9MoveDown.

@Test
public void testPosition9MoveDown() {
    // { 6, 5, 4, 7, 1, 8, 3, 2, 0 }
    setGapToPosition9();
    board.moveGapDown();
    Assert.assertEquals(new EightPuzzleBoard(new int[] { 6, 5, 4, 7, 1, 8, 3, 2, 0 }), board);
}
Also used : EightPuzzleBoard(aima.core.environment.eightpuzzle.EightPuzzleBoard) Test(org.junit.Test)

Example 5 with EightPuzzleBoard

use of aima.core.environment.eightpuzzle.EightPuzzleBoard in project aima-java by aimacode.

the class EightPuzzleBoardMoveTest method testPosition8MoveUp.

@Test
public void testPosition8MoveUp() {
    // { 6, 5, 4, 7, 1, 8, 3, 0, 2 }
    setGapToPosition8();
    board.moveGapUp();
    Assert.assertEquals(new EightPuzzleBoard(new int[] { 6, 5, 4, 7, 0, 8, 3, 1, 2 }), board);
}
Also used : EightPuzzleBoard(aima.core.environment.eightpuzzle.EightPuzzleBoard) Test(org.junit.Test)

Aggregations

EightPuzzleBoard (aima.core.environment.eightpuzzle.EightPuzzleBoard)43 Test (org.junit.Test)42 Action (aima.core.agent.Action)5 BidirectionalEightPuzzleProblem (aima.core.environment.eightpuzzle.BidirectionalEightPuzzleProblem)3 SearchAgent (aima.core.search.framework.SearchAgent)3 GoalTest (aima.core.search.framework.problem.GoalTest)3 MoveToAction (aima.core.environment.map.MoveToAction)2 GreedyBestFirstSearch (aima.core.search.informed.GreedyBestFirstSearch)2 ArrayList (java.util.ArrayList)2 Node (aima.core.search.framework.Node)1 AStarSearch (aima.core.search.informed.AStarSearch)1 Random (java.util.Random)1