-
Notifications
You must be signed in to change notification settings - Fork 156
Added English Tutorial for LOJ-1397: Sudoku Solver #400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Solution to 1397
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, good work. But you need to address a few changes.
The filename should be 1397/en.md
. That is, you should write these all up in a file named en.md
placed in a folder named 1397
.
The PR name should in the following format: "Added English Tutorial for LOJ-1397: Sudoku Solver".
Also, check out the comments I made at various lines of this document.
Update to resolve issues based on given suggestions
1397/en.md
Outdated
|
||
To summarise, | ||
|
||
In each iteration, we find an empty location. At the empty location, we place a value absent from the same row, box and column, and check if the current state of board can be solved. If it cannot be solved, we place 0 in the empty positions, otherwise we place the appropriate value and finally print the final state of the sudoku matrix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"we place 0 in the empty positions"
Very specific implementation detail. Just say that, if it cannot be solved, we output so.
1397/en.md
Outdated
|
||
###### Solution Approach | ||
|
||
Firstly we implement a basic sudoku solver with four important points: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
five points
1397/en.md
Outdated
|
||
2) To solve a sudoku we have to place a number at an empty position denoted by '.' in this question | ||
|
||
3) We use the isSafe function here to determine whether it is safe to place a particular number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whether it is safe to place a particular number
Define here what "safe" means.
1397/en.md
Outdated
|
||
4) If empty location found, we iterate from 1 to 9 and try to place that number in that empty position, checking whether it is safe to place the value in each iteration | ||
|
||
5) If the empty positions are such that the number of values that needs to be placed exceeds 9 for the given set of isSafe conditions which means we can't just place 1 to 9, then we can conclude that the Sudoku is not solvable and the empty positions remain as 0 denoting that it cannot be filled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the number of values that needs to be placed exceeds 9 for the given set of isSafe conditions which means
Implementation detail. A bit confusing if someone doesn't look at the source code. Simply chop this portion off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated a few things that the author didn't address, since rest of the things were good.
Solution to 1397