Skip to content

update: Adding inner box checks to Sudoku#37

Open
TheMj0ln1r wants to merge 1 commit intoRareSkills:mainfrom
TheMj0ln1r:sudoku/inner-box-checks
Open

update: Adding inner box checks to Sudoku#37
TheMj0ln1r wants to merge 1 commit intoRareSkills:mainfrom
TheMj0ln1r:sudoku/inner-box-checks

Conversation

@TheMj0ln1r
Copy link
Copy Markdown

Current Sudoku test cases are not explicitly checking the inner box checks of the solution.

Valid Inner Boxes

Question:          Solution:
[1, 0, 0, 0]      [1, 4, 3, 2]
[0, 2, 0, 0]      [3, 2, 1, 4]
[0, 0, 3, 0]      [4, 1, 3, 2]
[0, 0, 0, 4]      [2, 3, 4, 1]
Box 0 (top-left):     Box 1 (top-right):
[1, 4]                [3, 2]
[3, 2]                [1, 4]
Values: {1,2,3,4} ✓   Values: {1,2,3,4} ✓

Box 2 (bottom-left):  Box 3 (bottom-right):
[4, 1]                [3, 2]
[2, 3]                [4, 1]
Values: {1,2,3,4} ✓   Values: {1,2,3,4} ✓

Invalid Inner Boxes

Question:          Solution:
[1, 0, 0, 0]      [1, 2, 3, 4]
[0, 1, 0, 0]      [2, 1, 4, 3]
[0, 0, 1, 0]      [3, 4, 1, 2]
[0, 0, 0, 1]      [4, 3, 2, 1]
Box 0 (top-left):     Box 1 (top-right):
[1, 2]                [3, 4]
[2, 1]                [4, 3]
Values: {1,2,2,1} - Invalid ; Values: {3,4,4,3}  - Invalid

Box 2 (bottom-left):  Box 3 (bottom-right):
[3, 4]                [1, 2]
[4, 3]                [2, 1]
Values: {3,4,4,3} - Invalid   Values: {1,2,2,1} - Invalid

Because of no such test case to check inner boxes the invalid sudoku will still pass the test.

This makes sudoko a bit more hard puzzle, a good challenge for solvers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant