Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 976 Categories, Downloaded 30.160.117 Times

A Sudoku Solver in C 1.11

  Date Added: January 07, 2010  |  Visits: 1.665

A Sudoku Solver in C

Report Broken Link
Printer Friendly Version


Product Homepage
Download (168 downloads)

A Sudoku Solver in C is a console-based Linux program, written in C language, that solves Su Doku puzzles using deductive logic. It will only resort to trial-and-error and backtracking approaches upon exhausting its deductive moves. Puzzles must be of the standard 9x9 variety using the (ASCII) characters 1 through 9 for the puzzle symbols. Puzzles should be submitted as 81 character strings which, when read left-to-right will fill a 9x9 Sudoku grid from left-to-right and top-to-bottom. In the puzzle specification, the characters 1 - 9 represent the puzzle givens or clues. Any other non-blank character represents an unsolved cell. The puzzle solving algorithm is home grown. I did not borrow any of the usual techniques from the literature, e.g. Donald Knuths "Dancing Links." Instead I rolled my own from scratch as a personal challenge. As such, its performance can only be blamed on yours truly. Still, I feel it is quite fast. On a 333 MHz Pentium II Linux box it solves typical medium force puzzles in approximately 800 microseconds or about 1,200 puzzles per second, give or take. On an Athlon XP 3000 it solves about 6,600 puzzles per sec. (Solving time is dependent upon degree of difficulty, so YMMV.) Description of Algorithm: The puzzle algorithm initially assumes every unsolved cell can assume every possible value. It then uses the placement of the givens to refine the choices available to each cell. I call this the markup phase. After markup completes, the algorithm then looks for singleton cells with values that, due to constraints imposed by the row, column, or 3x3 region, may only assume one possible value. Once these cells are assigned values, the algorithm returns to the markup phase to apply these changes to the remaining candidate solutions. The markup/singleton phases alternate until either no more changes occur, or the puzzle is solved. I call the markup/singleton elimination loop the Simple Solver because in a large percentage of cases it solves the puzzle. If the simple solver portion of the algorithm doesnt produce a solution, then more advanced deductive rules are applied. Ive implemented two additional rules as part of the deductive puzzle solver. The first is subset elimination wherein a row/column/region is scanned for X number of cells with X number of matching candidate solutions. If such subsets (or tuples) are found in the row, column, or region, then the candidates values from the subset may be eliminated from all other unsolved cells within the row, column, or region, respectively. The next deductive rule examines each region looking for candidate values that exclusively align themselves along a single row or column, i.e. a vector. If such candidate values are found, then they may be eliminated from the cells outside of the region that are part of the aligned row or column. Note that each of the advanced deductive rules calls all preceeding rules, in order, if that advanced rule has effected a change in puzzle markup. Finally, if no solution is found after iteratively applying all deductive rules, then we begin trial-and-error using recursion for backtracking. A working copy is created from our puzzle, and using this copy the first cell with the smallest number of candidate solutions is chosen. One of the solutions values is assigned to that cell, and the solver algorithm is called using this working copy as its starting point. Eventually, either a solution, or an impasse is reached. If we reach an impasse, the recursion unwinds and the next trial solution is attempted. If a solution is found (at any point) the values for the solution are added to a list. Again, so long as we are examining all possibilities, the recursion unwinds so that the next trial may be attempted. It is in this manner that we enumerate puzzles with multiple solutions. Note that it is certainly possible to add to the list of applied deductive rules. The techniques known as "X-Wing" and "Swordfish" come to mind. On the other hand, adding these additional rules will, in all likelihood, slow the solver down by adding to the computational burden while producing very few results. Ive seen the law of diminishing returns even in some of the existing rules, e.g. in subset elimination I only look at two and three valued subsets because taking it any further than that degraded performance. Whats New in This Release: - Code optimization has resulted in a 30% increase in speed..

Requirements: No special requirements
Platforms: Linux
Keyword: C Is C Language Deductive In C Linux Program Puzzle Puzzles Solver Su Doku Puzzles Sudoku Sudoku Solver Written In
Users rating: 0/10

License: Freeware Size: 25.6 KB
A SUDOKU SOLVER IN C RELATED
Business  -  GoldenPod 0.6
GoldenPod is a podcast client (or podcast aggregator, or podcatcher, feel free to pick whichever name you want) written in perl. It supports multiple ways to work. GoldenPod supports reading configuration files in ~/.goldenpod/ and then saving...
18.43 KB  
Libraries  -  Exceptions in C 0.1.5
Exceptions in C implements fully-functional nested exceptions with these constructs: try except on throw Also, it allows to define various datatypes for exception object (default is int, can be anything from char * to struct foo *)....
15.36 KB  
Libraries  -  Conjury::C 1.004
Conjury::C is a Perl Conjury with C/C++ compilers, linkers and archivers. SYNOPSIS c_object Source => Isource-file>, Directory => Idirectory>, Includes => [ Idir1>, Idir2>, ... ], Defines => { Ivar1> => Ival1>, Ivar2> => Ival2>, ... },...
33.79 KB  
Code Management Tools  -  Java for C++ 0.4
Java for C++ is a tool to generate C++-wrapper-classes for existing Java-classes. This tool reads a list of Java class names and creates source code for C++-classes to wrap them. The implementation of the wrapper classes uses JNI (Java Native...
44.03 KB  
Programming  -  SMUSHcode 20030211
SMUSHcode project is a functional (as opposed to procedural) scripting language interpreter, written in Java. Completely documentated. SMUSHcode started life in 1997 as a term project for a "Compilers and Translators" class. Originally written...
43.01 KB  
Utilities  -  TOS 0.0.0.2
TOS is an experimental operating system kernel which is written in our strictly and statically typed assembly language, TALK. Today, computers (PCs, cell-phones, etc.) are widely used in the world and their network become one of the...
17.41 KB  
Network & Internet  -  VerliHub 0.9.8c RC2
VerliHub is a Direct Connect protocol server (Hub), runs on almost all OS (except some problems with Windows), written in c++, relatively very low cpu-ram-bandwidth usage, and many useful features. Accepts (numerous useful) plugins. Uses MySQL...
696.32 KB  
Games  -  Ts Kreator 1.1
Ts Kreator is a zone editor for Tempora Sanguinis 2(a mud based on dalemud) based on LeU Kreator written in c++ with qt4
376.54 KB  
Audio Tools  -  libbeep 0.666
libbeep is a way to get music from your PC beeper in any Linux program. This is how to use it: su make There you have it, a library ready to compile into your own alarm clock, midi player or whatever. The library is dropped into /usr/lib. A...
7.17 KB  
Utilities  -  Fuduntu 14.12
Fuduntu is a light hearted and fun Linux distribution that earns its name by its design to fit somewhere in-between Fedora and Ubuntu. It is designed to be asthetically pleasing, and is optimized for Netbook and other portable computers. Fuduntu...
911 MB  
NEW DOWNLOADS IN GAMES, PUZZLES
Games  -  Forge Of Empire 3
In the browser game Forge of Empires you can build your own city and experience all of history from its perspective - from the stone age on through the centuries. Explore new technologies that ring in a new era. Leave a mark with unique,...
4.26 MB  
Games  -  Text Text Revolution 0.11
Text Text Revolution is a clone of the popular Dance Dance Revolution game, done entirely in text mode, with ncurses. It supports pydance's (formerly pyDDR) .step file format (which has now been superceeded by the .dance format), and plans to...
40.96 KB  
Games  -  JediMUD 1.0
JediMUD is a Multi User Dungeon (MUD) game. In other words, it's a text-based role-playing game with users from all over the world. During your travels, you will encounter characters run by real people, challenge the computer-generated...
92.16 KB  
Games  -  WorldForge::Eris 1.3.18
Eris is designed to simplify client development (and promote code reuse) by providing a common system to deal with the back-end Atlas tasks. Notably, Eris encapsulates most of the work in getting Atlas entities available on your client, logging...
583.68 KB  
Games  -  SportsPHool for Linux 1.0
SportsPHool is a PHP/MySQL-based sports pick 'em application, similar to the pick 'em games on ESPN and other sports sites. SportsPHool will track winners/losers, play against the spread, run multiple sports games, and build dynamic graphs.
368.64 KB  
Puzzles  -  xJigsaw 2.1.0
xJigsaw combines xpuz 2.6 with a simple gui that allows easy creation of jigsaw puzzles from image types jpeg,png,bmp,tiff or gif. The puzzles can be played from with xJigsaw, or stand-alone executable puzzles can be created that will run...
3.24 MB  
Puzzles  -  BrisKola 1.0.0
BrisKola is a clone of the Italian card game Briscola. This is a classic Italian game, surely one of the most popular, thanks to the simplicity of the rules and the modest skills required to players. Even being a traditional...
8.19 MB  
Puzzles  -  Pushover 0.0.3
Pushover is a fun puzzle game originally published by Ocean in 1992. In this game you control an ant that can walk along platforms that are connected with ladders. On those platforms are dominos that need to fall according to some rules.
20.63 MB  
Puzzles  -  Simon Tatham's Portable Puzzle Collection 0.61
Simon Tatham's Portable Puzzle Collection is an assortment of single-player puzzle games for Linux users. It contains a reimplementation of Minesweeper where every puzzle is guaranteed to be solvable, a number of logic puzzles originally invented...
2.26 MB  
Puzzles  -  XBomb 2.2a
XBomb project is a minesweeper game with triangular, square and hexagonal grids. The simplest is the hexagonal grid, next is the traditional square grid and the most complex is the triangular grid. For each of the different grid shapes...
20.48 KB