-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolver.java
More file actions
52 lines (41 loc) · 1.21 KB
/
Copy pathSolver.java
File metadata and controls
52 lines (41 loc) · 1.21 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
import java.io.FileNotFoundException;
public class Solver{
private Board board;
private InfoPack info;
public String inFileName;
public String outFileName;
public Solver(String inFileName, String outFileName) throws ConflictException, FileNotFoundException {
// TODO Auto-generated constructor stub
this.inFileName = inFileName;
this.outFileName = outFileName;
this.info = HandleFile.inputFile(this.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(), this.outFileName);
//board.printBoard();
}
public void run() throws ConflictException {
// TODO Auto-generated method stub
try {
Solving(board.clone());
} catch (ConflictException e) {
//e.printMsg();
//System.out.println("Cannot solve it!");
throw new ConflictException(e.msg);
}
//HandleFile.outputFile(board.clone(), outFileName);
}
public Board getOriginalBoard() {
return this.board;
}
}