Commit graph

54 commits

Author SHA1 Message Date
2529533661 Adjust possible_values_for_square to behave like dlx expects 2017-10-16 12:40:29 -07:00
3689ac6974 Move existing test file alongside the sudoku __init__.py 2017-10-16 12:40:00 -07:00
c9a86d0fdc Add dlx solver (this is still a WIP)
The solver builds the constraint matrix. I have not fully verified its correctness, nor does the thing actually do the thing yet.
2017-10-16 12:25:30 -07:00
137e4e6436 Add Sudoku.get() -> value of board at (x,y) 2017-10-16 12:24:02 -07:00
fba52c7f09 Add Sudoku.possible_values_for_square() 2017-10-16 12:23:42 -07:00
1186305712 Clean up puzzles.py interface 2017-10-12 12:29:49 -07:00
a7dda24015 Print stuff in backtracking module only; clean up the \r stuff 2017-10-11 20:53:10 -07:00
3b380b17d2 Take care of some edge cases in the backtracker 2017-10-11 20:25:11 -07:00
a9a331df91 Move actual square setter to _set 2017-10-11 20:24:09 -07:00
387ccacb8d Print some stuff after setting a value 2017-10-11 19:46:16 -07:00
d25a320c30 puzzle script takes an algorithm to use to solve the given puzzles 2017-10-11 19:45:46 -07:00
65f4453e78 Attempt #1 at a backtracking solver 2017-10-11 19:45:00 -07:00
189589c0e6 solve() takes a function that solves the puzzle 2017-10-11 19:44:41 -07:00
9ebabd4b56 Add square setter to Sudoku 2017-10-11 19:44:19 -07:00
7a0e31858f Add __repr__ to Sudoku 2017-10-11 19:43:42 -07:00
181bc7d61e Remove idx from peer set 2017-10-11 19:43:15 -07:00
f7b6fb053f Memoize possible_values set 2017-10-11 19:42:11 -07:00
1549269661 Mutable squares, immutable clues set 2017-10-11 19:41:32 -07:00
e329208db9 Rewrite the printer to be cleaner 2017-10-11 19:40:39 -07:00
77456d5114 Add solvers package 2017-10-11 16:07:33 -07:00
301a56904c Relative import Sudoku symbol 2017-10-11 16:05:10 -07:00
0976ec8bb5 Move puzzles back up a level 2017-10-11 16:04:14 -07:00
7809c38104 Allow specifying path to puzzles library
By default look in the current directory for a puzzles/ directory.
2017-10-11 16:03:49 -07:00
ed41930092 Oops broke the tests 2017-10-11 15:59:14 -07:00
c0021ac2c2 Make a sudoku package 2017-10-11 15:58:31 -07:00
f12263b197 Stub of a solve() method 2017-10-11 15:53:25 -07:00
b8eda77093 Bold clues when printing the board 2017-10-11 15:53:17 -07:00
9534f04a08 Print the whole grid -- fallout from changing the meaning of size 2017-10-11 15:52:53 -07:00
6da7c2ecd6 Store indexes of clues as a set 2017-10-11 15:52:27 -07:00
a34987e3db Print multiple indexes 2017-10-11 15:51:55 -07:00
e2eadf9da7 Allow selecting and printing puzzles from the library to the command line 2017-10-11 15:49:18 -07:00
ab927ee41d Move some stuff around; add some docstrings 2017-10-10 12:54:33 -07:00
a0594d1561 Add some doc strings 2017-10-10 12:51:33 -07:00
fb1066f716 Fix the board size parameter in a test 2017-10-10 12:51:27 -07:00
e5d00debc7 Rename square -> box 2017-10-10 12:51:11 -07:00
35647fc8c9 Change the meaning of size
- size is the size of one side of a square
- row_size is the length of the grid on one side
- grid_size is the area of the grid
2017-10-10 12:44:24 -07:00
a9a01d3fd4 Fix solved property 2017-10-10 11:59:29 -07:00
cf43b02aa9 Add test_peers(); fix up some errors found 2017-10-10 11:43:02 -07:00
00225aca44 Add peers and index_peers for a given (x,y) 2017-10-10 09:55:51 -07:00
19a9bc9d37 Tweak the str printing a bit 2017-10-10 09:55:34 -07:00
93a4fecb26 Add helpers to get rows, cols, and squares for particular coordinates 2017-10-10 09:55:09 -07:00
3017b1e923 Rename initial init attribute to board; make self.board -> _board 2017-10-10 09:53:55 -07:00
88f0e07c06 Copy pasta error 2017-10-09 15:03:33 -07:00
5a32743d7b Add initial arg to Sudoku.__init__() 2017-10-08 08:26:34 -07:00
eae05487b9 Add puzzles and puzzles.py from the old branch 2017-10-08 08:26:18 -07:00
5696c087d8 Add a TODO 2017-10-08 08:06:34 -07:00
b5ac48bc10 Little bit o' cleanup 2017-10-08 08:04:34 -07:00
3fabd4b420 Rough, probably incomplete solved property 2017-10-08 08:00:45 -07:00
5ebe1f58ff Add index_* properties for returning ranges of indexes 2017-10-08 07:56:56 -07:00
01428e3972 Fix squares; add dimension property; add some tests 2017-10-08 07:23:03 -07:00