ogarcia / opensudoku

Open Source Sudoku game for Android.
GNU General Public License v3.0
328 stars 144 forks source link

Generate random sudoku #54

Closed wuniversales closed 4 years ago

wuniversales commented 4 years ago

It would be nice to be able to generate a random sudoku.

To do this you simply have to use random numbers and check that in the same row, or line, they are not repeated. This would generate the solution of a sudoku. Then you simply have to hide numbers according to the level of difficulty.

More or less that is the idea, obviously the levels of difficulty are indicative, perhaps he has to show more numbers, or less.

Greetings and good application

rogerm4242 commented 4 years ago

FWIW, I was able to generate random sudoku with Hodoku.

http://hodoku.sourceforge.net/en/index.php

I made a simple, hackish python script to convert the puzzles so they can be imported into OpenSudoku.

https://bitbucket.org/rogerm4242/hodoku-to-opensudoku/src/master/

I really like Hodoku's puzzle generator / solver. It allows you to make puzzles that are guaranteed to be solvable. You can also choose the difficulty level and techniques needed to solve the puzzles.

This could be made much more elegant, but I only use it once every couple of years. It allows me to generate a list of a thousand or so random puzzles and does what I want.

Edit: Hodoku is an open source java application. Maybe it's generator code functions could be imported into OpenSudoku?? (I am not a developer, so maybe not)

ogarcia commented 4 years ago

In Open Sudoku web you can generate puzzles without problem.

rogerm4242 commented 4 years ago

Thanks ogarcia, Somehow I missed that option before.

Open Sudoku is a great app. I really like the new option to highlight cells with similar values!