Wednesday, January 7, 2015

SudokuGen

     One of my friend's friend (I just met him recently) shared some code with me which turned out to be a Sudoku puzzle generator in Java. I don't really know or like Java but it gave me motivation to try my hand at making my own. My algorithm is different from his and I don't really know much about Sudoku generation but enough trial and error and my method works pretty well now. The one big difference from what his has and mine doesn't is backtracking, mine just retries from scratch if it hits a dead end. After improving my algorithm a bit I then went to tackle adding backtracking but that was giving me more of a headache then it should've so I just gave up lol. After this one I have learned a bit and I might plan on making another one using a slightly different algorithm but it should allow me to implement backtracking easier.

As always leave any feedback or suggestions in the comments

UPDATE:
Got around to commenting my SudokuGen code (VB.Net) and modified a couple things as well:

OLD:
Finally here is the source to my Sudoku puzzle generator (VB.Net/Java), on my computer it generates 1000 Puzzles in about 45 seconds, it is by no means fast but fast enough for practical purposes I imagine.

Here are 1000 Sudoku solution outputs :

2 comments:

Anonymous said...

So when are you making this with that "new" algorythm you're talking about? ;P

TizzyT said...

Yes the new algorithm would make it easier for me to implement backtracking but that might be because I thought about for a while. I might get around to it soon maybe next week ???