-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPuzzleChecker_MiS.java
More file actions
29 lines (24 loc) · 894 Bytes
/
PuzzleChecker_MiS.java
File metadata and controls
29 lines (24 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*************************************************************************
@mseskar
@12/21/17
*************************************************************************/
public class PuzzleChecker_MiS {
public static void main(String[] args) {
// for each command-line argument
for (String filename : args) {
// read in the board specified in the filename
In in = new In(filename);
int N = in.readInt();
int[][] tiles = new int[N][N];
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
tiles[i][j] = in.readInt();
}
}
// solve the slider puzzle
Board initial = new Board(tiles);
Solver solver = new Solver(initial);
System.out.println(filename + ": " + solver.moves());
}
}
}