Class PuzzleSolution

java.lang.Object
  extended by PuzzleSolution

public class PuzzleSolution
extends java.lang.Object

PuzzleSolution searches the provided initial puzzle to find the shortest solution. The solved puzzle and list of moves are available via accessors.

Version:
2005-10-30, JDK 1.5.0.5, Eclipse 3.1.0, Windows XP, CS 340, Fall 2005, Instructor: Pat Troy, TA: Nitin Jindal
Author:
Michael Leonhard (mleonhar)

Field Summary
private  java.util.Set existingPuzzles
           
private  java.util.List puzzles
           
private  java.util.List solutionMoves
           
private  Puzzle solvedPuzzle
           
 
Constructor Summary
PuzzleSolution(Puzzle initialPuzzle)
          Constructor: searches for a solution to the initial puzzle.
 
Method Summary
private  void addPuzzle(Puzzle puzzle)
          Adds the puzzle to the search space, if it doesn't already exist there
 java.util.List getSolutionMoves()
          Accessor for solution moves
 Puzzle getSolvedPuzzle()
          Accessor for solved puzzle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

existingPuzzles

private java.util.Set existingPuzzles

solvedPuzzle

private Puzzle solvedPuzzle

solutionMoves

private java.util.List solutionMoves

puzzles

private java.util.List puzzles
Constructor Detail

PuzzleSolution

public PuzzleSolution(Puzzle initialPuzzle)
Constructor: searches for a solution to the initial puzzle.

Parameters:
initialPuzzle - the starting puzzle
Method Detail

getSolutionMoves

public java.util.List getSolutionMoves()
Accessor for solution moves

Returns:
list of PieceMove objects

getSolvedPuzzle

public Puzzle getSolvedPuzzle()
Accessor for solved puzzle

Returns:
solved puzzle object

addPuzzle

private void addPuzzle(Puzzle puzzle)
Adds the puzzle to the search space, if it doesn't already exist there

Parameters:
puzzle - the puzzle to be added