Class PDPuzzleGenerator
- java.lang.Object
-
- ai.libs.jaicore.search.exampleproblems.npuzzle.parentdiscarding.PDPuzzleGenerator
-
- All Implemented Interfaces:
org.api4.java.datastructure.graph.implicit.IGraphGenerator<PDPuzzleNode,java.lang.String>
public class PDPuzzleGenerator extends java.lang.Object implements org.api4.java.datastructure.graph.implicit.IGraphGenerator<PDPuzzleNode,java.lang.String>
-
-
Field Summary
Fields Modifier and Type Field Description protected intdimension
-
Constructor Summary
Constructors Constructor Description PDPuzzleGenerator(int[][] board, int emptyX, int emptyY)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.api4.java.datastructure.graph.implicit.ISingleRootGenerator<PDPuzzleNode>getRootGenerator()org.api4.java.datastructure.graph.implicit.ISuccessorGenerator<PDPuzzleNode,java.lang.String>getSuccessorGenerator()PDPuzzleNodemove(PDPuzzleNode n, int y, int x)The actual move of the empty tile.PDPuzzleNodemove(PDPuzzleNode n, java.lang.String move)Moves the empty tile to another location.
-
-
-
Method Detail
-
getRootGenerator
public org.api4.java.datastructure.graph.implicit.ISingleRootGenerator<PDPuzzleNode> getRootGenerator()
- Specified by:
getRootGeneratorin interfaceorg.api4.java.datastructure.graph.implicit.IGraphGenerator<PDPuzzleNode,java.lang.String>
-
getSuccessorGenerator
public org.api4.java.datastructure.graph.implicit.ISuccessorGenerator<PDPuzzleNode,java.lang.String> getSuccessorGenerator()
- Specified by:
getSuccessorGeneratorin interfaceorg.api4.java.datastructure.graph.implicit.IGraphGenerator<PDPuzzleNode,java.lang.String>
-
move
public PDPuzzleNode move(PDPuzzleNode n, java.lang.String move)
Moves the empty tile to another location. The possible parameters to move the empty tiles are:lfor moving the empty space to the left.rightfor moving the empty space to the right.ufor moving the empty space upwards.d for moving the empty space downwards.- Parameters:
n- The PDPuzzleNode which contains the boardconfiguration.m- The character which indicates the specific moves. Possible characters are given above.
-
move
public PDPuzzleNode move(PDPuzzleNode n, int y, int x)
The actual move of the empty tile.- Parameters:
n- The node which contains the boardconfiguration.y- The movement on the y-axis. This value should be -1 if going upwards, 1 if going downwards. Otherwise it should be 0.x- The movement on the y-axis. This value should be -1 if going left, 1 if going right. Otherwise it should be 0.
-
-