import java.util.Scanner; import java.io.*; import javax.swing.JFileChooser; public class Sudoku { static int baseSize; //the side length of a box, usually 3 static int gridSideLength; //the side length of the grid, usually 9 static int[][] grid; //the Sudoko board or grid static int guesses = 0; //number of guesses made /** * Read a file with the starting Sudoku grid. The first int is the base (box) side length. */ static void readFile() { File file = null; JFileChooser fileopen = new JFileChooser(); // Ask the user to select a puzzle file int ret = fileopen.showDialog(null, "Select puzzle file to open"); if (ret == JFileChooser.APPROVE_OPTION) { file = fileopen.getSelectedFile(); System.out.println("Input puzzle selected: " + file); } // Open the file and read in the puzzle try { Scanner scanner = new Scanner(file); baseSize = scanner.nextInt(); gridSideLength = baseSize *baseSize; grid = new int [gridSideLength] [gridSideLength]; for (int row = 0;row