-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.java
More file actions
80 lines (71 loc) · 1.97 KB
/
main.java
File metadata and controls
80 lines (71 loc) · 1.97 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/**
* multithreaded Sudoku solver program
* Takes file input via code in readFile() method in solver class
* Checks for errors in the input file using 4 threads
* Two threads check rows and columns
* Thread three checks all 3x3 sub-grids for errors after the first two have completed
* @author: Kevin Hewitt
* @date: 3/9/2017
* @version: 1.5
*
* [WARNING]: CONTAINS DISGUSTING QUANTITIES OF FOR LOOPS
* [WARNING]: Please disregard from code review. I know it sucks.
*/
public class main
{
public static void main(String args[])
{
solver sudokusolver = new solver();
sudokusolver.readFile();
Thread t1 = new Thread()
{
@Override
public void run()
{
sudokusolver.checkColumns(0,0);
}
};
Thread t2 = new Thread()
{
@Override
public void run()
{
sudokusolver.checkRows(0,0);
}
};
Thread t3 = new Thread()
{
@Override
public void run()
{
sudokusolver.check3x3(0, 0);
sudokusolver.check3x3(3, 0);
sudokusolver.check3x3(6, 0);
sudokusolver.check3x3(0, 3);
sudokusolver.check3x3(3, 3);
sudokusolver.check3x3(6, 3);
sudokusolver.check3x3(0, 6);
sudokusolver.check3x3(3, 6);
sudokusolver.check3x3(6, 6);
}
};
t1.start();
t2.start();
try{
t1.join();
t2.join();
}
catch (Exception e) {
System.out.println("Something occurred with threads 1 or 2");
e.printStackTrace();
}
try{
t3.join();
}
catch (Exception e) {
System.out.println("Something occurred with thread 3");
e.printStackTrace();
}
sudokusolver.printPuzzle();
}
}