Closed chrisawad closed 2 years ago
Checking in on this. I've been playing generated games for a while now with this code. Seems to work well. The games are harder than the very hard generated ones on the website which is a good thing imo. Out of about 100 uniquely generated games, maybe 16 were too hard but I'm averaging 3-6 min to solve the rest.
I do think it's worth adding "gen_num_empty_cells" to the prefs and defaulting to an easier level before release and more advanced players can increase it as needed. It's already reading from the prefs, so just need someone to add add it to the prefs layout and we're set.
Have a baby daughter and full time software gig, so my effort stop here. :)
I'm migrating Open Sudoku development from GitHub to GitLab. To make the migration as clean as possible I'm going to close this PR. If you are still interested in it, please open it again in GitLab following the contributing guide.
Thank you very much for your understanding.
Guess we're not interested in a game generator? Maybe the GameGeneratorTask needs improvement but the refactor to support game generation should at least be merged so someone can easily make a better implementation without having to work on all these other changes to support it.
Having a puzzle generator integrated in the application is interesting, but it must be done with a good algorithm that is fast, with difficulty selector and allows to generate not only one puzzle but several (even the user can choose the number by creating a new folder).
Right now the web generator does all that (except being able to select the number of puzzles, although it is possible that it will implement it because it is trivial), so I prefer that when it is merged it will be with all the features fully implemented.
Added GameGeneratorTask which generates a new game and imports it into the Generated folder. Also added the "New" button to the TitleScreenActivity which generates a very hard game and jumps you right into it.
The generation logic was designed by me and can be sped up with optimizations to the solver (which I am not going to do). It might take a few seconds on an the emulator, but its pretty fast on modern phones.
Did not add config to customize number of empty cells the "New" button generates, but feel free to add. Just have to add the config key called "gen_num_empty_cells" or maybe its better to have "Easy", "Intermediate", "Hard" and "Very Hard".
Right now its generating games with ~60 empty cells (roughly because we allow <60 even though we ask for 60 empty cells -- its best effort generation without having to redo the whole board which can take a long time and we're all about speed aren't we ;)).