public static String getPrettyPath(List<Puzzle> path, int size) {
        // Print each row of all states
        StringBuffer output = new StringBuffer();
        for (int y = 0; y < size; y++) {
            String row = "";
            for (Puzzle state : path) {
                int[][] board = state.getMatrixBoard();
                row += "| ";
                for (int x = 0; x < size; x++) {
                    row += board[y][x] + " ";
                }
                row += "|  ";
            }
            row += "\n";
            output.append(row);
        }
        return output.toString();
    }
public static String getPrettyPath ( List < Puzzle > path , int size ) { StringBuffer output = new StringBuffer ( ) ; for ( int y = 0 ; y < size ; y ++ ) { String row = "" ; for ( Puzzle state : path ) { int [ ] [ ] board = state . getMatrixBoard ( ) ; row += "| " ; for ( int x = 0 ; x < size ; x ++ ) { row += board [ y ] [ x ] + " " ; } row += "|  " ; } row += "\n" ; output . append ( row ) ; } return output . toString ( ) ; }
Prints a search path in a readable form.

@param path List of puzzle states of the path.
@param size Size of the puzzle state (8 for 8-puzzle)
@return String representing all the transitions from initial to goal.