Suduku Puzzle Brute Force Generator   

Suduku Puzzle Brute Force Generator

by Bradley Jones

This Suduku puzzle generator was written (by me) in Turbo Pascal and Quick Pascal - Quick Pascal is not any quicker in this application. This is a brute force puzzle generator... That if left for a substantial amount of time, will generate the answer to every possible suduku puzzle combination. The method is simple:

Part A: Generate Combo files.
The generation of the combo files is as follows... Create a for next loop that counts from 123456789 to 987654321...
Then remove all iterations of anything that has either a 0 or a repeated digit.

Save combo to file as its generated if it passed the no zero and no repeated digit rule...

When saving to file arrange as follows:
Eg.
For the combo: 123456789
1
123
456
789
-----
Ie number the combo and seperate it with --- and arrange it in the order and lines shown. Do this for every sequential combo in the for next loop

Part B. Generate Puzzles
The program uses a nine level nested loop to try combos against each other... First copy the file generated in the combo file generator 9 times and name it accordingly. This is the order how I brute force... A spiral to the centre starting at the bottom right hand corner:

567
498
321

Or

555666777
555666777
555666777
444999888
444999888
444999888
333222111
333222111
333222111

Ie I put the first combo of the first combo file in position 1 Then the first combo of file 2 in position 2... Then I check position 2 against position 1 and if there are matches of numbers on the lines compared I try the next combo of file 2 until there are no matches. Then for position 3 I put the first combo of combo file 3 and compare to position 2 and position 1... When there are no matches I moove onto position 4 and so on to the centre... The program is set to end when the eof marker of every combo file is reached.

History

I was studying at Tafe with a guy who was also studying in my networking course as my partner .. he was training to be a TAFE Teacher... And was instructing a beginners programming class at Tafe. He told me that he wanted his students to be able to generate a suduku puzzle as a programming exercise. I told him that in order to do so they could add numbers randomly to a grid... But in order to know they had generated a puzzle that leads to only one possible answer... They should check the current numbers on the board against a complete list of answers puzzles to know if those numbers only lead to one possible answer... Once enuf numbers have been added the person can stop adding numbers to the grid.

Download Suduku!