Sudoku solver: Difference between revisions
Jump to navigation
Jump to search
(first draft based on own thinking) |
mNo edit summary |
||
Line 105: | Line 105: | ||
|} | |} | ||
===Procedure=== | |||
# Go through all pairs of cells (using two for loops). | |||
## Test for the rules with this pair. | |||
### If the other cell is known for sure, remove all inconsistent hypotheses from the other cell. | |||
# Go back to the beginning. | |||
== Rationale == | == Rationale == | ||
Line 115: | Line 121: | ||
==See also== | ==See also== | ||
* [[:file:Sudoku solver.ANA]] (a draft solver using Analytica) | |||
==Keywords== | ==Keywords== |
Revision as of 14:10, 23 September 2012
Moderator:Jouni (see all) |
This page is a stub. You may improve it into a full page. |
Upload data
|
Question
How to describe a sudoku and the sudoku rules in Opasnet so that it can be solved automatically?
Answer
You need the following tables.
Cell | Result | Description |
---|---|---|
Row: All; Column: All | 1,2,3,4,5,6,7,8,9 | For all row and column locations it applies that the plausible hypotheses are a single integer between 1 and 9 (unless more information is available). |
Row | Column | Area |
---|---|---|
1 | 1 | A |
1 | 2 | A |
1 | 3 | A |
1 | 4 | B |
… | ||
2 | 1 | A |
… | ||
4 | 1 | D |
… | ||
9 | 9 | I |
Property1 | Condition1 | Property2 | Condition2 | Rule | Description |
---|---|---|---|---|---|
Row | Same | Column | Different | Same integer not allowed | Two cells with the same row and different column are not allowed to have the same integer. |
Row | Different | Column | Same | Same integer not allowed | Two cells with the different row and same column are not allowed to have the same integer. |
Area | Same | Column | Different | Same integer not allowed | Two cells with the same area and different column are not allowed to have the same integer. |
Area | Same | Row | Different | Same integer not allowed | Two cells with the same area and different row are not allowed to have the same integer. |
Row | Column | ||||||||
---|---|---|---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | |
1 | 8 | ||||||||
2 | 3 | 6 | |||||||
3 | 7 | 9 | 2 | ||||||
4 | 5 | 7 | |||||||
5 | 4 | 5 | 7 | ||||||
6 | 1 | 3 | |||||||
7 | 1 | 6 | 8 | ||||||
8 | 8 | 5 | 1 | ||||||
9 | 9 | 4 |
Procedure
- Go through all pairs of cells (using two for loops).
- Test for the rules with this pair.
- If the other cell is known for sure, remove all inconsistent hypotheses from the other cell.
- Test for the rules with this pair.
- Go back to the beginning.
Rationale
Dependencies
Formula
See also
- file:Sudoku solver.ANA (a draft solver using Analytica)
Keywords
References
Related files
<mfanonymousfilelist></mfanonymousfilelist>