Class 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 Detail

      • dimension

        protected int dimension
    • Constructor Detail

      • PDPuzzleGenerator

        public PDPuzzleGenerator​(int[][] board,
                                 int emptyX,
                                 int emptyY)
    • Method Detail

      • getRootGenerator

        public org.api4.java.datastructure.graph.implicit.ISingleRootGenerator<PDPuzzleNode> getRootGenerator()
        Specified by:
        getRootGenerator in interface org.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 interface org.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.