-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolver.java
More file actions
56 lines (44 loc) · 1.32 KB
/
Copy pathSolver.java
File metadata and controls
56 lines (44 loc) · 1.32 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import java.io.FileNotFoundException;
public class Solver{
private int size;
private Board board;
private InfoPack info;
public static String inFileName;
public static String outFileName;
private static final int NOTHING = Board.NOTHING;
private static final int BLACK = Board.BLACK;
private static final int WHITE = Board.WHITE;
public Solver(String inFileName, String outFileName) throws ConflictException, FileNotFoundException {
// TODO Auto-generated constructor stub
Solver.inFileName = inFileName;
Solver.outFileName = outFileName;
this.info = HandleFile.inputFile(Solver.inFileName);
board = new Board(info);
}
private synchronized void Solving(Board b) throws ConflictException {
// TODO Auto-generated method stub
FillBoard fb = new FillBoard(b.clone());
b = fb.execute();
//b.printBoard();
Guess g = new Guess(b.clone());
//OK
b = g.execute();
System.out.println("Result is:");
b.printBoard();
HandleFile.outputFile(b.clone(), Solver.outFileName);
//board.printBoard();
}
public void run() {
// TODO Auto-generated method stub
try {
Solving(board.clone());
} catch (ConflictException e) {
e.printMsg();
System.out.println("Cannot solve it!");
}
//HandleFile.outputFile(board.clone(), outFileName);
}
public Board getOriginalBoard() {
return this.board;
}
}