diff options
author | David Phillips <david@sighup.nz> | 2019-03-10 20:40:54 +1300 |
---|---|---|
committer | David Phillips <david@sighup.nz> | 2019-03-10 21:16:19 +1300 |
commit | b434d87ee4deb9cc07af1be79d90b874fa139321 (patch) | |
tree | 15975834fdf5dd9ecc766b225d0476f830b104df /TODO | |
parent | 6bc7fdab077b1877f71b69f4b2c1e8046a302e9b (diff) | |
download | sudoku-b434d87ee4deb9cc07af1be79d90b874fa139321.tar.xz |
Fix the implementation
A number of things wrong with the quickie code initially committed,
chiefly not mutating the caller's copy of the board when that was the
intention. This commit fixes this and produces a working solver for all
boards that can be solved without exploration/uncertainty.
Diffstat (limited to 'TODO')
-rw-r--r-- | TODO | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -0,0 +1,17 @@ +The solver can only solve when at least one cell can be solved with certainty +at each step of the process until repeating this eventually results in a solved +board. +The next step here is to allow exploration/trail of possible solutions. +Presumably, would want to keep a copy of the board just before each "guess" +that's taken to be able to easily roll back if failure. + +This would probably work really nicely as a recursive call: + + board = get_fresh_board(board) + solve_all_certainties(board) + for each possible board as cand_board: + solution = solve_all_certainties(cand_board) + if complete(solution) + success + /* we should have solution presuming board was solvable */ + |