Skip to content

Commit 398c1e6

Browse files
committed
support for CSV file added
1 parent 27bd16a commit 398c1e6

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/com/company/Main.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,29 @@
44
import java.util.ArrayList;
55

66
public 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

src/com/company/sudokuInitializer.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import javax.swing.*;
44
import java.io.*;
55
import java.awt.Point;
6+
import java.util.Arrays;
67

78
class 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\nExiting...");
63+
E.printStackTrace();
5964
System.exit(1);
6065
}
6166
}

0 commit comments

Comments
 (0)