File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 44import java .util .ArrayList ;
55
66public class Main {
7+ /*
8+ SUDOKU SOLVER
79
10+ This program uses Dynamic arrays to save empty points which are later
11+ used to determine heuristics which are minimum value remaining box;
12+
13+ Multithreading has also been used for efficiency and anti freezing of GUI
14+
15+ *Description of various classes used*
16+
17+ 1) Main
18+ Initializes static array of sudoku, points etc, intializes GUI as well
19+ 2) Solver
20+ This Class has the algorithm to solve sudoku, It aslo refreshes GUI after every step
21+ (Timer delay could be edited in this class)
22+ 3) guiController
23+ Initializes GUI and provides various functions to retrieve/display/refresh the GUI
24+ 4) sudokuInitializer
25+ This class allows input through Files
26+ It also has a commented function which could take array values via console
27+ (used only for debugging purpose)
28+
29+ */
830 static protected int [][] sudoku_array = new int [9 ][9 ]; //Stores the sudoku
931 static protected ArrayList <Point > points = new ArrayList <>(); //stores the EMPTY points
1032 static protected guiController gui = new guiController ();//Initializes program, calls sudokuInitializer as well
Original file line number Diff line number Diff line change 33import javax .swing .*;
44import java .io .*;
55import java .awt .Point ;
6+ import java .util .Arrays ;
67
78class sudokuInitializer {
89
@@ -46,7 +47,10 @@ void fileInput() throws IOException {
4647 String stt ;
4748 int i =0 ;
4849 while (((stt = br .readLine ())) != null ){ //while file has content
50+ stt = stt .replace ("," ,"" );
51+ System .out .println (stt );
4952 st .insert (0 ,stt );
53+ System .out .println (st );
5054 for (int j =0 ;j <st .length ();j ++){
5155 try {
5256 if (checkValidInput (st .charAt (j )+"" )) {
@@ -56,6 +60,7 @@ void fileInput() throws IOException {
5660 Main .points .add (new Point (i , j ));
5761 }catch (Exception E ){
5862 JOptionPane .showMessageDialog (null ,"Error in extracting data from file\n Exiting..." );
63+ E .printStackTrace ();
5964 System .exit (1 );
6065 }
6166 }
You can’t perform that action at this time.
0 commit comments