|
-
Sep 5th, 2011, 10:48 AM
#5
Thread Starter
Addicted Member
Re: Solving sudoku like puzzle with .NET
 Originally Posted by ThomasJohnsen
So your process is:
1) Put all of {1, 2, ..., 9} into 9 boxes randomly, 1 in each.
2) Compare box-values in 6 horizontal, 5 vertical and 8 diagonal directions to ensure that 2 values aren't neighbours. If they are: go to 1)
(which is likely the slowest possible approach of solving this problem).
It dosen't get much more simple than that. Randomly filling the boxes can be achieved through a list of references to the boxes, that is shuffled and filled with {1, 2, ..., 9} in order. Writing 19 if-sentences to compare box-values cannot be all that complicated either. I fail to see a problem here.
Would i just assign the values at random to three arrays and compare values of, for example, arr1(1) & arr2(1). I'm having trouble determining how to make the comparison in all the places being as they can't touch in any manner.
Also, how can I pick only one integer from a string at random and then remove the value from the string of possible random choices until the loop completes circuit, so i don't end up with the same number in more than one box?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|