public class Board { public Board(int[][] tiles) // construct a board from an N-by-N array of tiles where tiles[i][j] = tile in row i, column j public int hamming() // number of blocks out of place public int manhattan() // sum of Manhattan distances between blocks and goal public boolean isGoal() // is this board the goal board? public Board twin() // a board obtained by exchanging two adjacent blocks in the same row public boolean equals(Object y) // does this board equal y? public Iterable neighbors() // all neighboring boards public String toString() // string representation of the board in the output format specified above } public class Solver { public Solver(Board initial) // find a solution to the initial board public boolean isSolvable() // is the initial board solvable? public int moves() // return min number of moves to solve initial board; -1 if no solution public Iterable solution() // return sequence of boards in a shortest solution; null if no solution }