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 int
dimension
-
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()
PDPuzzleNode
move(PDPuzzleNode n, int y, int x)
The actual move of the empty tile.PDPuzzleNode
move(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:
getRootGenerator
in 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:
getSuccessorGenerator
in 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:l
for moving the empty space to the left.right
for moving the empty space to the right.u
for 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.
-
-