-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcliDriver.java
37 lines (36 loc) · 1.2 KB
/
cliDriver.java
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
import java.io.*;
public class cliDriver {
public static void main(String[] args) {
sudoku9 ob = new sudoku9();
System.out.println("[+] Welcome to cli sudoku 9x9\n[+] Input:");
String s[] = new String[9];
int A[][][]= new int[9][9][10];
try{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
for(int i=0;i<9;i++){
s[i]=in.readLine();
for(int j=0;j<9;j++){
A[i][j][0]=Integer.parseInt(""+s[i].charAt(j));
}
}
ob.PrepareArray(A);
ob.main1(A);
if(!ob.checkComplete(A))
do{
ob.acceptAnAssumedValue(A);
ob.PrepareArray(A);
ob.main1(A);
}while(!ob.checkComplete(A));
//printing solved puzzle
System.out.println("[+] Solved puzzle is:");
for(int i=0;i<9;i++){
for(int j=0;j<9;j++){
System.out.print(A[i][j][0]+" ");
}
System.out.println();
}
}catch(Exception e){
System.out.println("[-] Input Error");
}
}
}