Sudoku solver

 

Introduction

Since 2005 the Sudoku puzzle has become very popular in the Netherlands. Many magazines and newspapers publish a Sudoku to entertain their readers. For the people who do not know what a Sudoku puzzle is I will give a short explanation. A Sudoku puzzle consists of a grid of 9 by 9 squares. Initially, part of these squares contain digits in the range 1 to 9; the other squares are empty. The challenge is to fill all squares with digits (in the range 1 to 9), such that each horizontal line, each vertical line and the pre-defined 3×3 squares contains each digit 1 to 9 exactly once. The 3×3 squares are indicated by the fat lines. Here is an example of a Sudoku puzzle:
picture of a Sudoku puzzle

As a software engineer I accepted the challenge to write a program that could solve a Sudoku puzzle. Since the number of squares to be filled in is rather big to use a brute force approach, my challenge was to come up with an efficient solution.

Sudoku solver

In December 2005 I wrote the Sudoku Solver in 4 evenings. The result is a Java application that has the user interface as shown here:
picture of the user interface

Download

If anyone wants to use this application for his/her own benefits, please feel free to download the application. Click here to download version 0.3 of the Sudoku Solver. This zip file contains sudoku.jar together with the sources and build file to build this jar file.

Requirements

To run the Sudoku Solver a J2SE 1.4 (or higher) Run-Time is required. Java Run-Times can be downloaded from Sun’s website.

Running the application

Note that you must unzip sudoku.zip before you can run the Sudoku Solver. Once you have unzipped this file, you can run the application by typing the following command on the command prompt:
java -jar sudoku.jar

If you have questions about this application, don’t hesitate to contact me.

Releases

release date notes
0.3 December 20, 2005 Resize the SudokuPanel when the parent container is resized.
Replaced jar file by zip file containing the jar file, the sources and the build file for Ant.
0.2 December 19, 2005 Solves puzzles in a separate thread that can be terminated. (not tested, because all puzzles I tried were solved very quickly on my computer!)
Improved brute force implementation.
0.1 December 12, 2005 First version of Sudoku Solver. It can solve most (all?) Sudoku Puzzles.
© 2011 Sanders blog Suffusion theme by Sayontan Sinha