Hello,
First time posting a question:
I am trying to code a simple Sudoku game that is 4x4 instead of the 9x9, such that it has 4 rows and 4 columns that are divided into 4 2x2 sections.
I can generate random numbers fine, but I need to code it so that no number in a row, column and section are duplicated.
The variable for the individual tiles is Dim'd As Integer, and set up as follows:
Dim int13A As Integer
The design is: int(Row)(Column)(Section) so "int13A" is located at Row 1, Column 3,
Section A.
My code for each array is this, with appropriate names for each:
Dim arrRow1(3) As Integer
arrRow1(0) = int11A
arrRow1(1) = int12A
arrRow1(2) = int13B
arrRow1(3) = int14B
Array.Sort(arrRow1)
If arrRow1(0) = 1 And arrRow1(1) = 2 And arrRow1(2) = 3 And arrRow1(3) = 4 Then
blnRow1 = True
Else
blnRow1 = False
End If
I have a
Do - Loop Until blnValidGrid = True that looks for True for each row 1-4, then each column 1-4 and then each block 1-4; if all return true, I get the blnValidGrid = True. If not, it regenerates the grid and attempts to validate again.
I am missing something somewhere cause it just goes into an infinite loop... :(
Any thoughts??
Thanks,
Hank