code: public static void printSearch(Iterator<? extends Node<?,Point,?>> it, Maze2D maze) throws InterruptedException {
          Collection<Point> explored = new HashSet<Point>();
          while (it.hasNext()) {
              Node<?,Point,?> currentNode = it.next();
              if (currentNode.previousNode() != null) {
                  explored.add(currentNode.previousNode().state());
              }
              List<Point> statePath = new ArrayList<Point>();
              for(Node<?, Point, ?> current : currentNode.path()){
                  statePath.add(current.state());
              }
              //clearOutput(20);
              System.out.println(getMazeStringSolution(maze, explored, statePath));
              Thread.sleep(50);
              if (currentNode.state().equals(maze.getGoalLoc())) {
                  return;
              }
          }
      }
docs: Prints the maze and the result of the current iteration until the solution is found.
  
  @param it search iterator
  @param maze maze to perform the search
  @throws InterruptedException sleep exception between iterations