sixstorm/sudokugenerator ? reverse-engineered prompt

Reverse engineered prompt

Build me a simple Python Sudoku generator that creates a full valid 9 by 9 board from scratch.

I want it to fill the grid one cell at a time, use random numbers, and keep checking that each number is valid for the row, column, and 3 by 3 box. If it gets stuck, it should try another number, and if nothing works it can backtrack or reset the row and keep going until it finishes a complete board.

Please make the code cleaner and easier to read than a rough first draft, and save the finished board to a text file the way this project already does. I’d also like it to print the generated Sudoku board nicely in the console so I can see it right away.

If you need to look up current Python best practices or a cleaner way to structure the generator, go ahead and do that.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab