10 years agoDocumented constraints.diagonal test more better. master
Eevee [Wed, 7 Jan 2009 14:58:52 +0000 (09:58 -0500)] 
Documented constraints.diagonal test more better.

10 years agoRenamed integrity tests to standard.
Eevee [Wed, 7 Jan 2009 14:55:21 +0000 (09:55 -0500)] 
Renamed integrity tests to standard.

Given that the grid will only successfully solve in the first place if
it's valid, playing these down as "integrity" tests when the result
*must* be correct is silly.  Correctness should be explicitly tested
elsewhere, anyway.

10 years agoAdded a test for puzzles with diagonal constraints.
Eevee [Wed, 7 Jan 2009 14:54:16 +0000 (09:54 -0500)] 
Added a test for puzzles with diagonal constraints.

Created a TestCase subclass to use for tests, too.

10 years agoMiscellaneous cleanup.
Eevee [Wed, 7 Jan 2009 14:42:43 +0000 (09:42 -0500)] 
Miscellaneous cleanup.

Changed Grid.is_filled() to a property.
Removed Grid.check(), which didn't do anything anyway.
Cleaned up Grid.solve() slightly and fixed an egregious logic error.
Clarified Cell.normalize() docstring.

10 years agoImproved solving; should now solve all easy puzzles.
Eevee [Wed, 7 Jan 2009 14:30:23 +0000 (09:30 -0500)] 
Improved solving; should now solve all easy puzzles.

Grid.solve() now keeps trying its elimination methods until they stop
doing anything.
Also snuck in Constraint.is_linear, in preparation for solving by row/box

10 years agoRemoved some use of Grid._* in
Eevee [Wed, 7 Jan 2009 13:51:39 +0000 (08:51 -0500)] 
Removed some use of Grid._* in

10 years agoMoved Cell to its own file.
Eevee [Wed, 7 Jan 2009 13:49:40 +0000 (08:49 -0500)] 
Moved Cell to its own file.

Also added columns/boxes accessors for Grid.

10 years agoRenamed and CellConstraint.
Eevee [Wed, 7 Jan 2009 13:44:00 +0000 (08:44 -0500)] 
Renamed and CellConstraint.

They are now and Constraint, respectively.

10 years agoAdded a Diagonal constraint.
Eevee [Wed, 7 Jan 2009 13:40:03 +0000 (08:40 -0500)] 
Added a Diagonal constraint.

Also fixed a bug when rendering: value 1 would be shown as a space.

10 years agoAdded some real accessors.
Eevee [Tue, 6 Jan 2009 06:16:10 +0000 (22:16 -0800)] 
Added some real accessors.

Wrapped grid, size, box_height/width around the real values.
Added a method to fetch constraints.
Fixed the rendering code to use the above.

10 years agoRemoved distinction between Row/Box/Column.
Eevee [Fri, 19 Dec 2008 09:35:16 +0000 (01:35 -0800)] 
Removed distinction between Row/Box/Column.

CellConstraints now remember which cells they actually own, rather than
generating a list on the fly.
Grids are largely apathetic towards which constraints they actually have once
they exist.
Also swapped out proxies for ref()s and gave CellConstraint some real
properties to get around the ugliness of that.

10 years agoStarted merging cols/rows/boxes into "constraints".
Eevee [Thu, 18 Dec 2008 08:57:11 +0000 (00:57 -0800)] 
Started merging cols/rows/boxes into "constraints".

So far, this is mostly just renaming some things and inching the code in that

10 years agoReplaced set_naively with set(normalize=False).
Eevee [Wed, 17 Dec 2008 08:44:09 +0000 (00:44 -0800)] 
Replaced set_naively with set(normalize=False).

10 years agoMoved stringify cruft into a render module.
Eevee [Sat, 13 Dec 2008 05:10:35 +0000 (21:10 -0800)] 
Moved stringify cruft into a render module.

Called pseudoku.render; currently contains classes for rendering to a
single line, a simple grid of symbols, or an ascii-art grid.

10 years agoTurned original test puzzle into a real testcase.
Eevee [Sat, 13 Dec 2008 04:02:00 +0000 (20:02 -0800)] 
Turned original test puzzle into a real testcase.

Runnable via setuptools, too: python test

10 years agoMoved code out of lib/.
Eevee [Sat, 13 Dec 2008 03:56:57 +0000 (19:56 -0800)] 
Moved code out of lib/.

There's no non-code to protect it from, so not much point in the

10 years agoTurned into a real project.
Eevee [Sat, 13 Dec 2008 03:03:06 +0000 (19:03 -0800)] 
Turned into a real project.

Gave it a
Broke it into a main script and a couple modules.
Added a .gitignore for vim/python cruft.
Otherwise, works exactly the same.

10 years agoImproved creating a grid from data.
Eevee [Wed, 10 Dec 2008 02:50:02 +0000 (21:50 -0500)] 
Improved creating a grid from data.

Grid.from_lists is now a constructor that optionally takes explicit
height and width; without them, it attempts to guess the likely
dimensions of the grid and boxes.
Added a Grid.from_string that is similar but reads from a string.

10 years agoSimple Sudoku solver.
Eevee [Sun, 7 Dec 2008 00:16:48 +0000 (19:16 -0500)] 
Simple Sudoku solver.

Solves a 3x3 Sudoku grid hardcoded into it, as long as only simple
elimination is required.