[olug] Programming Question
Sam Tetherow
tetherow at shwisp.net
Thu Mar 6 22:47:41 UTC 2008
Classic AI method would be to process using recursion assuming that VB
supports pass value. It would be similar to the classic 8 queens
problems which is usually used in textbooks for recursion.
Process goes like this:
1. Check to see if the board is full. If yes print and exit else goto 2.
2. Pick an empty square and put a random value in it.
3. Check to see if the value is valid for the quadrant and the row. If
yes recurse else pick a new value. If no value is valid return.
Sam Tetherow
Sandhills Wireless
Travis Owens wrote:
> 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...
>
>
>
More information about the OLUG
mailing list