head	1.5;
access;
symbols;
locks
	paulmck:1.5; strict;
comment	@# @;


1.5
date	2006.11.23.06.38.55;	author paulmck;	state Exp;
branches;
next	1.4;

1.4
date	2006.04.28.11.44.14;	author paulmck;	state Exp;
branches;
next	1.3;

1.3
date	2006.04.28.08.53.06;	author paulmck;	state Exp;
branches;
next	1.2;

1.2
date	2006.04.17.05.48.44;	author paulmck;	state Exp;
branches;
next	1.1;

1.1
date	2006.04.17.00.29.54;	author paulmck;	state Exp;
branches;
next	;


desc
@@


1.5
log
@ckpt
@
text
@Sudoku solver.

INPUT FORMAT

Input format is lines, with first character of "#" or "-" indicating a
comment and with "*" indicating a "charmap" line.  Lines beginning with
other characters contain initial input values.  Comment lines are ignored,
and will not be discussed further.

Lines containing cell contents each specify a row of the puzzle, with
each position containing either a character that denotes the initial
contents of the cell or a space character.  Between each position character
is a space character.  It is legal to hand this program all-blank input,
but it might take a bit longer to solve (the better

A puzzle can optionally contain a charmap line, but if present, it
must precede all other non-comment lines.  A charmap line is a list
of characters, for example, "*123456789" would denote the standard
9x9 Sudoku, while "*0123456789ABCDEF" would denote the standard 16x16
Sudoku, and "*123456789ABCDEFG" would denote a zero-averse 16x16 Sudoku.
Putting a "#", "-", or "*" in a charmap line gets you what you deserve.

The default for square Sudoku puzzles is:

	*123456789ABCDEFGHIJKLMNOPQURSTU

For circular Sudoku puzzles:

	*1234567890ABCDEFGHIJKLMNOPQURST

For circular diametrical Sudoku puzzles:

	*0123456789ABCDEFGHIJKLMNOPQURST


BACKTRACKING

It turns out that taking free choices first on entries with the smallest
number of possibilities greatly speeds things up, since this is most
likely to force cascading eliminations.  However, this complicates
strategies avoiding duplicate backtracking, since the quantity tracking
the current place is a pair, [#bits,position].  Or a triple if the
position itself is represented as a row/column pair.  However, this
does not necessarily move monotonically, since cascading eliminations
can force a cell that was considered (and rejected) earlier to become
a good candidate.
@


1.4
log
@First cut at multiple-solution identification
@
text
@@


1.3
log
@HTML output
@
text
@@


1.2
log
@arguments to control twins, triplets, and backtracking
@
text
@@


1.1
log
@in-puzzle charmap
@
text
@d3 44
a46 5
Input format is lines, with first character of "#" indicating a comment
and with "*" indicating a "charmap" line.  A charmap line is a list
of characters, for example, "*123456789" would denote the standard 9x9
Sudoku, while "*0123456789ABCDEF" would denote the standard 16x16 Sudoku,
and "*123456789ABCDEFG" would denote a zero-averse 16x16 Sudoku.
@
