Search in sources :

Example 36 with EightPuzzleBoard

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

the class EightPuzzleBoardMoveTest method testPosition1MoveLeft.

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

Example 37 with EightPuzzleBoard

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

the class EightPuzzleBoardMoveTest method testPosition1MoveUp.

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

Example 38 with EightPuzzleBoard

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

the class EightPuzzleBoardMoveTest method testPosition5MoveRight.

@Test
public void testPosition5MoveRight() {
    // { 6, 5, 4, 1, 0, 8, 7, 3, 2 }
    setGapToPosition5();
    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 39 with EightPuzzleBoard

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

the class EightPuzzleBoardMoveTest method testPosition3MoveRight.

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

Example 40 with EightPuzzleBoard

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

the class EightPuzzleBoardMoveTest method testPosition3MoveDown.

@Test
public void testPosition3MoveDown() {
    // { 5, 4, 0, 6, 1, 8, 7, 3, 2 }
    setGapToPosition3();
    board.moveGapDown();
    Assert.assertEquals(new EightPuzzleBoard(new int[] { 5, 4, 8, 6, 1, 0, 7, 3, 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