View Single Post
Old 05-30-2006, 03:46 AM   #4 (permalink)
teknomage1
Jack of all trades
 
teknomage1's Avatar
 
Join Date: Feb 2005
Location: Los Angeles
Posts: 598
teknomage1 is on a distinguished road
Send a message via AIM to teknomage1
Okay so applying a bit more brainpower to the problem, all sudoku puzzles are basicaly the same but with the numbers in a different order, so if you have one vaild solution, you can use those numbers as a template for any others. The easiest one I can see is:
Code:
1 2 3|4 5 6|7 8 9|
4 5 6|7 8 9|1 2 3|
7 8 9|1 2 3|4 5 6|

2 3 4|5 6 7|8 9 1|
5 6 7|8 9 1|2 3 4|
8 9 1|2 3 4|5 6 7|

3 4 5|6 7 8|9 1 2|
6 7 8|9 1 2|3 4 5|
9 1 2|3 4 5|6 7 8|
If you treat those numbers as indexes into an array where each digit only appears once, you can generate any random puzzle. Here're two examples:
Code:
array:[9, 8, 7, 6, 5, 4, 3, 2, 1]
9 8 7|6 5 4|3 2 1|
6 5 4|3 2 1|9 8 7|
3 2 1|9 8 7|6 5 4|

8 7 6|5 4 3|2 1 9|
5 4 3|2 1 9|8 7 6|
2 1 9|8 7 6|5 4 3|

7 6 5|4 3 2|1 9 8|
4 3 2|1 9 8|7 6 5|
1 9 8|7 6 5|4 3 2|

array:[3, 7, 2, 5, 1, 4, 9, 6, 8]
8 6 9|4 1 5|2 7 3|
4 1 5|2 7 3|8 6 9|
2 7 3|8 6 9|4 1 5|

6 9 4|1 5 2|7 3 8|
1 5 2|7 3 8|6 9 4|
7 3 8|6 9 4|1 5 2|

9 4 1|5 2 7|3 8 6|
5 2 7|3 8 6|9 4 1|
3 8 6|9 4 1|5 2 7|
__________________
Stop intellectual property from infringing on me
teknomage1 is offline   Reply With Quote