* Create a new Solver. call the solve method to start solving the problem
*/
publicSolver(Boardboard)
publicSolver(Boardboard)
{
{
this.states=newPriorityQueue<>();
this.states=newPriorityQueue<>();
...
@@ -16,14 +20,42 @@ public class Solver {
...
@@ -16,14 +20,42 @@ public class Solver {
this.currentState=null;
this.currentState=null;
}
}
publicList<Move>solve()
/**
* Solve the problem
* @param resetBoard If the board should be in its initial state at the end of the algorithm
* @return A Queue of moves so that the first move in the list is the first move you should play at the beginning of the game. Or null if the game has no solutions.
*/
publicDeque<Move>solve(booleanresetBoard)
{
{
this.currentState=null;
this.states.add(newState(board,null,null));
// Executing A* until we find a solution or we explored all of the tree