SourceFiles.org - Use the Source, Luke
Home | Register | News | Forums | Guide | MyLinks | Bookmark

Related Sites

Latest News
  General News
  Reviews
  Press Releases
  Software
  Hardware
  Security
  Tutorials
  Off Topic


Back to files

Overview

Ssuds (Simple Sudoku Solver) is a simple program that solves Sudoku puzzles, in which the object is to fill a 9 * 9 grid (composed of nine 3 * 3 grids) with the digits 1 - 9 in such a way that each row, column, and component 3 * 3 grid contains each digit exactly once; some cells are initially given.

Usage

When run, the program accepts up to nine lines of input, which become the initial grid. All non-digit characters are ignored, as are all characters following a '' (on the same line). Any line containg no digits (before a '') does not count toward the nine line total. '0' indicates a blank cell; trailing zeroes may be omitted from any line. Any omitted lines (i.e. if EOF is encountered) will be zeroed out. It may be easiest to create a file with the initial pattern and then to run Ssuds with input redirection ('ssuds < file'). Note that Ssuds understands the output of Ssudg (Simple Sudoku Generator), so one can run 'ssudg | ssuds'.

Output

Ssuds prints the initial grid (the result of parsing its input) followed by as many valid solutions as it finds.

Logic

The program alternates between making simple logical deductions (e.g. if a certain cell can't be 1,2,3,4,5,6,7 or 9 it must be 8, or if cells 1,2,3,4,6,7,8 and 9 of a certain sub-grid can't be 4 then cell 5 must be 4) and, when none are available, making (slightly educated) guesses. Any solutions found through this process are sent to stdout.


Other Sites

Discussion Groups
  Beginners
  Distributions
  Networking / Security
  Software
  PDAs

About | FAQ | Privacy | Awards | Contact
Comments to the webmaster are welcome.
Copyright 2006 Sourcefiles.org All rights reserved.