# Sudoku Solver: Solve Soduku puzzle game

 Info Screenshots View files (20) Download .zip Reputation Support forum (6) Blog Links
 Last Updated Ratings Unique User Downloads Download Rankings 2009-02-11 (7 years ago) 63% Total: 4,395 This week: 1 All time: 623 This week: 1,016
 Version License Categories sudoku 1.0 GNU General Publi... PHP 5, Games, Artificial intelligence
Description Author

Sudoku is a puzzle that has become very popular recently and has been published in many newspapers.

Sudoku is a number puzzle where you are presented with a grid of size 9 by 9, that is subdivided in 9 blocks of 3 by 3. Some fields in the grid contain a digit from 1 to 9. The objective is to fill in the rest of the fields such that each row, column and block will contain all digits exactly once. A good Sudoku has a single solution.

This class attempts to use the same strategies that a human player would use to solve a Sudoku puzzle. It can solve many Sudoku puzzles but not all, because it only uses logic and refrains from brute-force solving.

You can interactively influence the solution process to try out rules of your own. You can easily enter a Sudoku puzzle and save it to try it again later. PHP 5 is required.

Innovation Award
 September 2005 Number 8Prize: One subscription to the PHP Magazine There are games that were meant to be played only by human players. Multi-player games need more than one human player to be available. Sometimes it is not possible to have more human player available. In that case, it would be interesting if the human player could play with a computer based player. The challenge of implementing games that need to have computer based players is that they usually need to emulate human intelligence to make human-computer games almost as interesting as human-human games. This class implements an educative example of the use of artificially intelligence to demonstrate how a computer can emulate human intelligence to accomplish similar tasks. This example can be useful for those that are interested in learning how to apply artificial intelligence techniques to solve problems on which it is interesting that a computer plays the role of human being, in games or in other more serious types of applications. Manuel Lemos
Name: Classes: Ghica van Emde Boas is available for providing paid consulting. Contact Ghica van Emde Boas . 1 package by Ghica van Emde Boas The Netherlands 72 646 19 in The Netherlands 833 23 in The Netherlands
Innovation award

Nominee: 1x

Details
 ```1. To use the sudoku solver, just unpack the package to a directory of your choice. 2. Place the examples in a local directory on your client. 3. !!! Create a subdirectory of the directory where you put the Sudoku Solver classes, call it temp, and make sure you can move uploaded files (the Sudoku examples) to this directory, by making it writable. 4. Start the solver by executing the sudoku.php script. A PHP4 version can be found in the sudoku4 subdirectory (note point 3 also) =========================================================================================== Summary of changes made by Mike Diplock - Feb. 2009 I have attached the files I changed to implement the x-wing solution ( http://www.palmsudoku.com/pages/techniques-8.php ) and I have also attached three puzzles that require the x-wing solution. I found that the array_diff function acting on objects does not work in php 5.2.8 due to changes in _to_string() so I have modified getRCB to actually ignore certain fields when it builds the array rather than doing the diff afterwards. I have completely rewritten the group check as I couldn't work out how the old method worked and it seemed overly complicated. I have implemented it here using a combinadic algorithm which is more efficent and was also required for the x-wing solution. =========================================================================================== Ton Meuleman - added the checkGrouping solution, March 2007 =========================================================================================== original author: Ghica van Emde Boas, Sept. 2005 ```
 Screenshots
 Files
File Role Description
sudoku4 (6 files)
DLX.class.php Class new solution rule
NumberField.class.php Class NumberField class
open-easy1.txt Data Easy example
open-hard1.txt Data Hard example
puzzle1.txt Example puzzle requiring x-wing
puzzle2.txt Example puzzle requiring x-wing
puzzle3.txt Example puzzle requiring x-wing
Solver.class.php Class Solver class
sudoku-help.html Doc. Help and Documentation
Sudoku.class.php Class User interface class
sudoku.css Data Style sheet
sudoku.php Appl. Starter script

 Files / sudoku4
File Role Description
NumberField.class.php Class PHP4 Numberfield class
Solver.class.php Class PHP4 Solver class
sudoku-help.html Doc. PHP4 help file
Sudoku.class.php Class PHP4 Sudoku class
sudoku.css Data PHP4 Numberfield class
sudoku.php Aux. PHP4 Numberfield class