-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBoard.java
13 lines (12 loc) · 898 Bytes
/
Board.java
1
2
3
4
5
6
7
8
9
10
11
12
13
public class Board {
public Board(int[][] blocks) // construct a board from an N-by-N array of blocks
// (where blocks[i][j] = block in row i, column j)
public int dimension() // board dimension N
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<Board> neighbors() // all neighboring boards
public String toString() // string representation of the board (in the output format specified below)
}