[olug] Programming Question
Travis Owens
openbook1441 at gmail.com
Thu Mar 6 22:11:36 UTC 2008
Hello all... in one of my classes as school, we're tasked with developing a
"Sudoku" like game using VB.NET (not my choice)
The instructor has reduced the scope from a 9x9 grid, to a 4x4 grid.
This isn't a requirement to the application at this point in the course, but
I am interested in it anyway, so....
I'm wanting to randomly generate solved boards, then blank out several of
the buttons on it. I'm having a problem figuring out the best way to keep
track of the possible values when selecting one randomly, assigning it to a
position on the board.
For those of you who may not understand Sudoku, my game board would be
arranged like so:
*1 | 2 3 | 4
--------------
3 | 4 2 | 1
2 | 1 4 | 3
--------------
4 | 3 1 | 2*
That would be one possible layout/solution to the board. The concepts are
simple to understand:
1. each button can increment 1-4.
2. each row must have 1-4 w/o duplicates (represented by blue)
3. same for each column (represented by *Italics*)
4. same for each quadrant (represented by highlights)
What I'm trying to achieve, would be a way to assign the value each of the
16 buttons, while keeping track of the remaining values available for all
three dimensions (Row/Column/Quadrant)
I have been looking at this so long, I can't seem to make headway on it
anymore... most likely, I'm over complicating my approach.
Currently, I can get to each button on the board by walking through 4 nested
loops of 2 counts each:
for 1 - 2 ( the Quadrant Column )
for 1 - 2 ( the Quadrant Row )
for 1 - 2 ( the column )
for 1 - 2 ( the row )
As I said above, I'm doing this in VB.NET, but if someone can provide an
understandable method of doing this, I'll see if I can convert it for my
purpose.
Any help would be greatly appreciated...
--
Travis Owens
Let every nation know, whether it wishes us well or ill, that we shall pay
any price, bear any burden, meet any hardship, support any friend, oppose
any foe, to assure the survival and the success of liberty. This much we
pledge and more. -- John F. Kennedy, inaugural speech, January 20, 1961
More information about the OLUG
mailing list