From b434d87ee4deb9cc07af1be79d90b874fa139321 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Sun, 10 Mar 2019 20:40:54 +1300 Subject: 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. --- TODO | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 TODO (limited to 'TODO') diff --git a/TODO b/TODO new file mode 100644 index 0000000..1d87a91 --- /dev/null +++ b/TODO @@ -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 */ + -- cgit v1.1