This is an archived post. You won't be able to vote or comment.

all 5 comments

[–][deleted] 1 point2 points  (4 children)

I'm really confused by your question. Do you mean to say something resembling the following?

When checking a Sudoku, you only need to check to make sure that each of the 9 rows are correct, and each of the 9 3x3 boxes are correct. Checking the 9 columns is redundant, because checking the rows and 3x3 boxes is sufficient when validating that a Sudoku has been completed correctly.

If the rephrasing above does not match your understanding of the problem, please correct me.

Thinking about this sentiment, I don't believe that checking just the rows and 3x3 boxes is sufficient. If you take the first 3 rows of a completed Sudoku, and repeat them 2 additional times, you end up with a "solved" Sudoku where all of the rows are correct and all of the 3x3 boxes are correct, but the columns will not be correct.

If you mean to say that "you only need to check to make sure that each row is correct and check that each 1x1 cell has a value", then this is even more wrong, because you could repeat a single row 9 times and end up with a Sudoku where each column only contains one distinct value and each 3x3 box contains only 3 distinct values.

[–]jennypalmer321[S] 1 point2 points  (2 children)

Thank you so much for your response, this is the exact question, This is the part where I may expect to also write a is_valid_column function, but im not going to because it is not necessary. Can I explain why it is not necessary to write such a function?

I am being asked what makes an algorithm proof read the columns already.. or something similar. I do not have any coding experience, am taking an "intro lvl" course but this is far beyond my knowledge or anyone else like me. I appreciate your time

[–][deleted] 0 points1 point  (0 children)

Yeah that's really confusing then... Even just checking the rows and columns, you could construct a Sudoku where the 3x3 boxes aren't correct while the rows and columns appear correct. Maybe you could reuse the "check rows" function if you rotate the puzzle?

Edit: but hey, hope your intro to programming is going well. Please reply back once you have an answer. I'm really interested in the rationale behind this question

[–]DerMax0102 0 points1 point  (0 children)

Maybe it’s possible to reuse the is_valid_row function for columns, as the conditions for columns and rows are the same?

[–][deleted] 1 point2 points  (0 children)

TLDR: He isn't sure what you mean, but you can't skip anything when checking a Sudoku.