
Testing of the program indicate that, on average, it takes less than 30 seconds to create a Sudoku sequence of numbers with an averageīail Out every 5 generations of sequences This text file (SudokuTest.txt) can then be transported to a Sudoku game and used as the source for the solved games. When the selected number of sequences is created the list of sequences is saved to a text file with each line being a string of 81 characters If this occurs the Bail Out button should be clicked to restart the process from the first row with a different set of random numbers. Out event is easy to see the program continuously loops with the same set of numbers over either 1 square or multiple squares. a sequence of Sudoku numbers have been created.Īt times there may be no solution to the current sequence of number and the display will show what I call a “Bail Out” event. This testing for conflict/no conflict continues until all 81 squares are populated, i.e. If all 9 numbers return a conflict then the process re-starts at the beginning of theĬurrent line. If there is a conflict then the next random number is selected. If there is no conflict the next square is selected and the process continues. Then, in turn, each square is filled with a randomly selected number (1-9) and interrogated to see if it conflicts with the same number in the current Numbers are then in turn transferred to the first row of a Sudoku array.

The programs flowchart is reasonably simple: I start by populating a ListBox with the numbers 1 to 9 then I randomly shuffle them.

Nor is there any “fuzzy logic” it just relies on chance: There is no mathematical wizardry involved, no artificial intelligence, That it works! It will consistently produce sequences of 81 numbers which are unique, original and logically sound Sudoku game solutions. The algorithm is not elegant nor do I use “best practice” programming techniques, but one important aspect of it is Which can then be transferred to a game program. It does not present a game that can be played but the solution of games The following code creates Sudoku Number Sequences at random.
