## 06-01 Sudoku Checker

• 0:00 - 0:08
For this first problem, we're going to be writing a program that checks Sudoku grids
• 0:08 - 0:13
to make sure that they are valid sub-grids, and if you haven't played Sudoku before we'll go over
• 0:13 - 0:16
• 0:16 - 0:21
which probably has a far more in-depth explanation than we could ever give here.
• 0:21 - 0:29
Sudoku is a game played by on a 9x9 grid, which will be representing as a list of lists
• 0:29 - 0:36
that contains 81 elements and each one of this 81 elements has to be a number between 0 and 9
• 0:36 - 0:41
including 0 and 9 and if either of this doesn't hold,
• 0:41 - 0:45
then we'll be returning none right away before we do anything else.
• 0:45 - 0:53
If we do pass those any checks, then we're going to return true if all of these hold,
• 0:53 - 0:57
which are the basic checks that go on in a Sudoku game.
• 0:57 - 1:01
Each number 1 through 9 occurs only once in each row.
• 1:01 - 1:09
It also occurs only once in each column and in each 3x3 sub-grid on the box on the board,
• 1:09 - 1:15
and it also occurs only once in each 3x3 sub-grid in the over all grid
• 1:15 - 1:18
and it might be clear with a bit of a picture.
• 1:18 - 1:23
Here you can see all nine 3x3 sub-grids.
• 1:23 - 1:29
Each of this should only have the number 1 through 9 once for each sub-grid.
• 1:29 - 1:34
Now, you can have zero in a valid sub-grid, it means it hasn't been encoded yet.
• 1:34 - 1:40
We don't have any solution, for instance, that has those numbers in it.
• 1:40 - 1:48
Your program would have to account for that, and I will give you a few examples before we expect.
• 1:48 - 1:56
First, we get an L form board where, see that this row doesn't have mine elements. It only has eight.
• 1:56 - 1:59
We should return none immediately.
• 1:59 - 2:03
This is a valid board with no zeros and it shouldt return true.
• 2:03 - 2:10
This is an invalid board that should return false, because it has the elements 1 through 9
• 2:10 - 2:15
either in more than once in a row or a column or a 3x3 sub-grid.
• 2:15 - 2:20
We need to check that is indeed the case for this one,
• 2:20 - 2:23
and then we have two that aren't finish.
• 2:23 - 2:27
One that's a fairly easy Sudoku puzzle appeared going solid by hand
• 2:27 - 2:30
and one that is actually quite difficult
• 2:30 - 2:36
to solve by hand at least for me and both of these should return true.
• 2:36 - 2:40
You can solve those piece with a valid different answers.
• 2:40 - 2:44
You're going to write this in the check_Sudoku function,
• 2:44 - 2:48
and give you these different statements to check them.
• 2:48 - 2:55
Now these are the only test cases we're going to be testing against for this problem set.
• 2:55 - 2:58
That's not really the point of this assignment though.
• 2:58 - 3:06
What I'd like you to do is go to the forums and post the code that
• 3:06 - 3:13
you used to solve this in the forums and we'll have a link to a specific forum post
• 3:13 - 3:17
in the instructor comments down below the video, so please check that.
• 3:17 - 3:21
I'd also like you to look at other people's code
• 3:21 - 3:29
and see if you can think of some fuzzers that would break these people's code.
• 3:29 - 3:34
Either a specific instances in those code or if you have a general purpose fuzzer
• 3:34 - 3:41
that would run well against general Sudoku checkers then go ahead and post that in the forums.
• 3:41 - 3:46
I'd really like you to think about what kind of inputs
• 3:46 - 3:50
and what kind of testing you would have to do in order to do this well.
• 3:50 - 3:52
I hope you had fun with this.
• 3:52 - 3:55
I hope there's a lot of great discussion on the forum about it,
• 3:55 - 4:00
and I look forward to seeing all of your solutions.
• 4:00 -
Okay, great. Have fun.
Tytuł:
06-01 Sudoku Checker
Opis:

06-01 Sudoku Checker

more » « less
Team:
Udacity
Projekt:
CS258: Software Testing
Duration:
04:05
 Udacity Robot edited angielski subtitles for cs258 hw3 01 q Sudoku Checker Amara Bot added a translation

# English subtitles

Incomplete

## Revisions Compare revisions

• API
Udacity Robot
• Amara Bot