Dipl.-Informatiker
Besir Kadrioski
[beʃiɾ]

Softwarearchitekt und Entwickler

J.-C.-Schneider-Str. 12
72147 Nehren

Mobil: +49 (0) 157 30478209
Fest: +49 (0) 7473 2701577

E-Mail: besir@kadrioski.de

Interessen

Künstliche Intelligenz, Software-Entwicklung, Open-Source und Webprogrammierung. Faible für technische Spielereien, mechanische Tastaturen und Kaffeezubereitung :-)

Beispielprojekte

vericonf

Produkt-Konfigurator am Beispiel der LKW Baureihe Actros von Mercedes Benz:

http://iqludo-tools.de:8091/vericonf

verimed

Berechnung von Interaktionen zwischen Medikamenten:

http://iqludo-tools.de:8093/verimed

vereakt

Erkennung von möglichen Gefahren durch chemische Reaktionen:

http://iqludo-tools.de:8092/vereakt

Sonstiges

Sudoku (english)

Some time ago I wrote a logic based solver for constraint problems and wanted to see how it performs in comparison to dedicated solutions for harder puzzles like Sudoku. After searching the internet Norvigs article Solving Every Sudoku Puzzle came up quickly. Norvigs Sudoku solver is written in python. Variable ordering, constraint propagation and full house rule are used as techniques. Both, reading and rewriting to Java, was a great joy for me, so I decided to share my version.

Download

sudoku.jar (Sudoku solver, Java sources and classes)

top95.txt (collection of 95 hard Sudoku puzzles, for testing. Taken from here)

Run Sudoku Solver

You can run the Sudoku Solver as standalone applicaton. In order to do so, just drop following line into your console (Java required):

java -jar sudoku.jar 4.....8.5.3..........7......2.....6.....8.4......1.......6.3.7.5..2.....1.4......

if everything is fine, you should receive a solution for your sudoku puzzle as shown below.

4 1 7 | 3 6 9 | 8 2 5

6 3 2 | 1 5 8 | 9 4 7

9 5 8 | 7 2 4 | 3 1 6

------+-------+------

8 2 5 | 4 3 7 | 1 6 9

7 9 1 | 5 8 6 | 4 3 2

3 4 6 | 9 1 2 | 7 5 8

------+-------+------

2 8 9 | 6 4 3 | 5 7 1

5 7 3 | 2 9 1 | 6 8 4

1 6 4 | 8 7 5 | 2 9 3


9ms

In order to solve a batch of puzzles pass them as a file. Place top95.txt file from above into the working directory and run:

java -cp sudoku.jar sudoku.Sudoku95

you should see the solutions printed into your console, one by one.

Using the Java Sudoku Solver as library

You may use the Sudoku Solver for your Java projects. In this case just follow two simple steps.

  1. add sudoku.jar as library to your projects's class path
  2. insert Code Snippet in to your Code as shown below

Sudoku sudoku = new Sudoku();

sudoku.solve("4.....8.5.3..........7......2.....6.....8.4......1.......6.3.7.5..2.....1.4......");

System.out.println(sudoku.getSolution().toStringGrid());

That's it, enjoy! :-)