Recursive Sudoku Solver
With a necessary quarantine period leaving me with several days of isolation with my laptop, I figured the best way to pass the time would be to revisit an older project that revolves around a pastime of Sudoku. This recursive sudoku solver was built in Eclipse using Java. It is based around a similar project from my previous ICS211 course I took in my freshman year surrounding data structures.
While the original was hardcoded to solve a handful of problems, had several bugs, and partially followed a proper code style guideline, this version now included a user interface where the user has the ability to input any sudoku problem to be solved via recursion.
The program can also detect unsolvable sudoku problems as well as invalid user input. Because of its proximity to the holidays, the program also included some ASCII art, and matching holiday themed music as the user interacts with the program.
This project also included my first introduction to the AppleScript Programming language in order to get the .jar file to properly run on a Mac. Getting the .jar file to open on
Mac took a small script shown below.
tell application "Terminal"
if not (exists window 1) then reopen
activate
set the bounds of the front window to {0, 0, 1100, 538}
-- x - x position in pixels
-- y - y position in pixels
-- w - width in pixels
-- h - height in pixels
do script "cd desktop" in front window
do script "cd SudokuSolver" in front window
do script "clear" in front window
do script "java -jar Sudoku.jar" in front window
end tell
While the input works as expected, the data inputting process can be tedious, and slow. As the program takes one number at a time to be stored in a 2D array, the input process would likely work better if the user could input data column by column or into an empty sudoku board. This small tweak is something I plan to do upon revisiting the project.
Source:
SudokuSolver