# Why am I getting downvotes for not working code when it's working code?

I've become a little frustrated with Code Review. They said my code does not output a valid Sudoku when it in fact does. Is it that people are confused of my code and don't realize that it's in fact working?

Generate any n^2 x n^2 Sudoku in poly-time

• Is it possible the downvotes were already there before the post got re-opened? Whoever cast them simply haven't revoked them. That's common. – Mast Jun 2 '19 at 12:22
• @Mast Half of the down-votes came in today -- after it had been reopened. – Peilonrayz Jun 2 '19 at 12:25
• @Mast No, because yesterday I had 1. But, I'm probably getting to worked up. I believed I confused users with my strange writing. The code indeed generates n^2 x n^2 valid Sudokus in poly-time. It's not impossible because latin squares can be generated in poly- time. Enter input as tuple [1,2,3,4,5,6,7,8,9]repl.it/repls/WrathfulYummyTransversal – Travis Wells Jun 2 '19 at 12:25
• @Peilonrayz Try yourself, here's a link to working code! repl.it/repls/WrathfulYummyTransversal Update enter input like a tuple [1,2,3,4,5,6,7,8,9] – Travis Wells Jun 2 '19 at 12:26
• After your question had been reopened you got 3 upvotes and one downvote. See yourself: codereview.stackexchange.com/posts/220967/timeline – Heslacher Jun 2 '19 at 16:52

Questions can be on-topic and still attract downvotes.

The general rule for downvotes is to cast them when:

This question does not show any research effort; it is unclear or not useful

That's the exact hovertext when you keep your mouse over the downvote arrow.

In theory (not in practice), downvotes have nothing to do with a question being off-topic or not. Close votes are not downvotes and vice versa. Questions can have many downvotes while still being on-topic and at times high-scoring questions get closed because they're not within the scope of the site.

Off-topic questions get closed, bad questions get downvotes. So, apparently, people think it's a bad enough question to warrant a downvote. All downvotes cast (the current score is (+4/-4) before the re-opening are probably (partially) related to the question being off-topic. The rest are, probably (we don't know for sure unless the downvoters answer your question themselves) related to the quality.

As you've indicated yourself, your writing style is a bit confusing. There are abbreviations you don't explain (SAT, is that a standardized acceptance test?) and your description is unclear:

Input should be like a tuple. [1,2,3....]

That's a list, tuples have braces ( ) instead of brackets [ ].

How would I know that my code indeed generate n! of all n^2 x n^2, and of course what are my mistakes in the code?

Did you test it? Do you have any code validation set-up currently?

If you know your writing style is confusing, consider clarifying the question so it's less confusing. But downvotes and close votes are separated.

• Yes, I've tested and it works. Confused tuples and lists! – Travis Wells Jun 2 '19 at 12:45
• People on Computer Science told me it works for n^2 to sudoku width. I've shared the algorithm before writing it up in a python script. – Travis Wells Jun 2 '19 at 12:48
• @TravisWells So the idea works, but does the implementation itself work as well? A mistake is easily made, that's why we test code and verify whether it works. – Mast Jun 2 '19 at 12:50
• Yes, the implementation works on Python 3. I'm at fault for confusing users. But, in the link it actually works for 9 x 9, 12 x 12, 10x10, 50 x 50. You'll have to enter it as a list. For bigger grids such as 10 x 10. You'll enter as [01,02,03,04....] for readability. – Travis Wells Jun 2 '19 at 12:52

https://repl.it/repls/WrathfulYummyTransversal is currently "Offline for maintenance" (which is why it's a good idea for why to include all the relevant code in the question itself).

Right now I can't tell if all the code is there or not, but assuming that it is I just read it briefly and noticed "There's no way this can generate a Sudoku puzzle" (Yes, I read your question as "Sudoku puzzle" - perhaps incorrectly). And even if it's just generating a grid, I read your code again and felt that there's no way that this can generate a random or even more than a single grid. So I felt that the question was unclear and misleading and the code uninteresting. Therefore, I personally down-voted.

I would strongly recommend to read Simon's guide for posting a good question for the future.

• Yes, not more than a single grid, because its sequential not O(n!). But it can generate 9! out of all possible 9 x 9. And 12! of all 12 x 12.... If you don't believe then try it yourself. If you think its misleading, then give me a chance to explain. I'm shocked that no one sees that this code works. – Travis Wells Jun 2 '19 at 20:43
• May you, give me that chance and run it yourself? When making an input make sure you include brackets or it won't be a valid output. Here's a link to my answer-codereview.stackexchange.com/a/221537/194047 And, a link to online python. Just copy and paste code.-onlinegdb.com/online_python_compiler – Travis Wells Jun 2 '19 at 20:51
• @TravisWells I didn't downvote because of not working though, if I would consider your code to be completely not working then I would have closed the question. I down-voted because I found the question unclear and misleading. The instructions in the program is also unclear (especially on the first line when you expect input without prompting the user for anything specific). See codereview.meta.stackexchange.com/a/6429/31562 for ways to improve your question(s). – Simon Forsberg Jun 3 '19 at 12:20
• I've fixed that with help from code-review. The lack of instructions of input caused another user to generate an invalid Sudoku! That I found frustrating! Because, I tried to explain that in the question. It, being unclear I suspect people thought it was generating arbitrary Sudokus with 1-solution in poly-time. If it did that, I would have patented it and become rich. But, it only generates valid pre-solved Sudokus in poly-time. – Travis Wells Jun 3 '19 at 22:29
• If you want, here's a link to improved code working. repl.it/repls/TubbyPrestigiousFirm – Travis Wells Jun 3 '19 at 22:35