-
Re: Looping to put numbers in a 9x9 grid of Text Boxes
Hi AdmiralJonB,
Have you given up on this one?
I've rejigged my programme and it now makes 1,000,000 attempts in 28 minutes. That produced 9 unique grids containing 79 legitimate numbers. In each of those 9, the missing numbers were the same; 8 and 9. Also, the vacant slots were always the same, slot 9 on row1 and slot 6 on row 3.
Row 1 needed a 9 but the only vacant slot in that row was slot 9 and column 9 already had a 9 in it. Column 9 was missing an 8.
Row 3 needed an 8 in slot 6 but column 6 already had an 8. Column 6 was missin a 9.
It looks like there is a pattern to the vacant slots, which leads me to think that these puzzles can only, for all practical purposes, be generated using a predetermined pattern.
If you want to generate a grid which looks as if it is random then you could use my first posted code ( you could randomly generate the first line if you wished); carry on with the pattern and then do something like the following to the completed grid:
Replace all 3's with 0's
Replace all 7's with 3's
Replace all 2's with 7's
etc
Replace all ?'s with
replace all 0's with ?'s
I would assume that the random number system would eventually produce a legal grid, but how long it will take is anybody's guess.
-
1 Attachment(s)
Re: Looping to put numbers in a 9x9 grid of Text Boxes
Have any of you made any headway?
I started working on this last weekend, and this weekend I've achieved a 75% Success rate, building 3 good SODUKO setups for every Invalid setup.
Instead of Randomly assigning a number to a SQUARES cell {I've been calling every 3x3 set of cells in the SODUKOS overall 9x9 cell grid a SQUARE. I'm referencing each SQUARE 2 diminsionally, {0-2, 0-2}, and each SQUARE has the numbers 0-8 entries {Or, You could callthem 1 thru 9}, which can be in that SQUARES Cell_ROW 0 - 2, and CELL_COL 0-2}, I've been Randomly creating a CELL_ROW setup pattern for Each SQUARE number entry, on a SQUARE ROW By SQUARE ROW basis, then once thats been done, I've been randomly assigning each numbers CELL COLUMN location, on a SQUARE COLUMN by SQUARE Column basis.
Subject, of course, to a verification system.
Can't explain how I'm going about it much more than that, at least at this time. {8 PM, Sunday Night} But I'll be back sometime tomorrow. {Gotta Clean up my development project, get rid of the flotsom}
-Lou
BTW, What do you think of this setup sheet I Progied? {This sheet has a specific ROW assignment already applied} Each SQUARE contains 9 Cells. The Cells Number is in the upper left, its CELL ROW assignment is to the right of that, the Middle row of each cell contains the numbers 0 to 2, representing that the number has available for assignment the column 0 thru 2, and the bottom row in that cell is a space for the column that you eventually would assign it to.
Its a scratch sheet to help me visuallize what must be done once a number has been assigned a column.
SDequentially, for each SQUARE COLUMN:
Step 1: Find the first ROW in this Column that has unassigned cells. Assign an available column to an unassigned cell.
Step 2: Cross off that numbers other Possible Columns from the Middle Row.
Step 3: For each other SQUARE in that column, Cross off the chosen column from its corresponding numbers possible choices.
Step 4: For each Number in the Same SQUARE as the number thats just been assigned, Any Number that has the same ROW assignment must have the chosen column crossed off.
Step 5: For each SQUARE in this column, Inspect each set of 3 cells which have a particular ROW assignment. If Any 2 of those cells have 2 identical possible column choices, then the third cell with that same row assignment MUST BE the un_common column number. {cross off those two possible columns in the 3rd cells ROW of possible coilumns, leaving {hopefully} 1 column it MUST_BE}
Step 6: Once Steps 2 thru 5 have eliminated the possibles, any unassigned cell that has only 1 available choice left is a MUST_BE. Selecting One of these, Place its MUST_BE column value in that cells BOTTOM area, and repeat steps 2 thru 6, until you don't have any MUST_BE's left.
Then Go back and do STEP 1.
:wave:
-
Re: Looping to put numbers in a 9x9 grid of Text Boxes
HI,
I'm completely lost with that :eek: I assume you are saying you are looking for legitimate patterns. The problem posted in this thread is producing a legitimate puzzle using random number generation, which I think for all practical purposes is impossible.
There are probably several different patterns which will produce legitimate grids, which appears to be what you are working on, but I can't see it. Mind you it is 01:45 here!!!
-
Re: Looping to put numbers in a 9x9 grid of Text Boxes
Quote:
The problem posted in this thread is producing a legitimate puzzle using random number generation
I don't believe there's a difference.
Lets say you Generate the number "3" In the 3x3 SQUARE "A,B", in the SQUARES Cell "X, Y".
We Know 3 is going to be in that SQUARE anyways. What is Random is its cell position.
I'm generating the position randomly. The Progie is saying, "Ok. I've got this three, Where will it Go?"
Of Course you can't Put a number on top of another number, so the Position Generation has a Verification system, ONLY draw from available positions.]
Now, if a number has only 1 spot it can be put, well, you must put it in that spot.
:wave:
-Lou
-
Re: Looping to put numbers in a 9x9 grid of Text Boxes
Hi,
Yes, that is random within the 3 * 3 block. Are you saying that by continuing like that you have produced a complete, legitimate Sudoku 9 * 9 grid 75% of the time?
-
Re: Looping to put numbers in a 9x9 grid of Text Boxes
Hi,
I think that with this random number method, there is inevitably trouble. Let's say you go SQUARE by SQUARE, starting with the one in the top left. In the first cell, there are 9 possible numbers available, so your fraction of available numbers is 9/9, i.e. 1. The next cell has 8/9, then 7/9 etc. Hence you can always complete the first SQUARE, subject to the rule that 1-9 occur only once in that SQUARE.
Moving on to the next square (horizontally), in the first cell you now have 6/9 choices. By the time you've finished the 6th cell in this SQUARE, you've potentially used up all your choices, but of course you may not have depending on the numbers you've put in the above rows.
In the 3rd SQUARE, you start the first cell with 3/9 choices, and so can always complete the first row. But you may have 0/9 choices to fill in the 4th cell.
If you then go to the second row of SQUARES, you start the first cell with 6/9 choices. Filling in this SQUARE is like filling in the middle SQUARE in the top row. The second SQUARE is like filling in the 3rd SQUARE in the top row. The 3rd SQUARE in the middle row is even more difficult.
As for the final 3 SQUARES, you can complete the first 3 cells of the first SQUARE for certain, but that's about it. There are no guarantees thereafter.
Hence in each row of SQUARES, the number of potentially unfillable cells increases substantially.
A way around this would be to restrict the mini-rows of 3 cells within a SQUARE to hold particular combinations, i.e. if the first row of the first SQUARE contains 1,2,3, then make sure that 1,2,3 are in the same mini-row in the second and third SQUARES. That way you can't get cross-contamination of the rows, which is how the difficulties arise. Rearrangement of these from one row of SQUARES to the next would enable a complete grid to be formed. But then, essentially, you'd have a permutation of that original design that taxes described.
I find it difficult to believe that with a random number assignment and no pattern inbuilt that 75% of attempts generate a valid solution. But I'd certainly be interested to see it.
I suspect that whichever way it is tried, be it filling in rows, columns, SQUARES or number by number, it'll end up in this state. It may be possible to take corrective action as soon as a problem is spotted, e.g. even before the first row of SQUARES is completed, but by the lower portion of the grid there'll almost inevitably be trouble, unless somebody has found a cunning way around it.
zaza
-
Re: Looping to put numbers in a 9x9 grid of Text Boxes
Quote:
Originally Posted by taxes
Hi,
Yes, that is random within the 3 * 3 block. Are you saying that by continuing like that you have produced a complete, legitimate Sudoku 9 * 9 grid 75% of the time?
Yes.
Like I said, first I select the row assignments for the cells in the 3x3 SQUARES across 1 row of squares.
Consider a generic Row of 3 3x3 SQUARES.
The Number 1 will be assigned Row A in the first 3x3 SQUARE.
In the 2nd and 3rd, {ie... this Row N of 3 3x3 SQUARES has 3 SQUARE Columns, SQ_COL 0, 1 and 2, so each SQUARE has the coordinates {0,N}, {1,N} and {2,N}. Therefore the "First" 3x3 Square is that wich is in SQ_COL 0, and the 2nd and 3rd are those in this SQ_ROW=N, whose SQ_COL = 1 and 2}
Let me start again.
The Number 1 will be assigned CELL Row A in the first 3x3 SQUARE.
In the 2nd and 3rd, it must be one of the other 2 CELL Rows, B, or C.
Assigning CELL ROW b to the number 1 in the 2nd SQUARE forces the number 1 to be in CELL ROW c in the 3rd SQUARE.
Now, {a, b, c} is 1 of the 6 combinations that the set{0,1,2} can attain.
Lets list these sets:
C1 = {0,1,2}
C2 = {0,2,1}
C3 = {1,0,2}
C4 = {1,2,0}
C5 = {2,0,1}
C6 = {2,1,0}
The first number in one of those combinations is the CELL ROW assigned to a number in SQUARE 0 of a SQUARE ROW.
The Second is the Selected CELL ROW assigned to the same number in SQUARE 1 of a SQUARE ROW.
Which makes the 3rd one to be the Selected CELL ROW assigned to the same number in SQUARE 2 of a SQUARE ROW.
Now, in Square 0 of Row N, there can be only 3 numbers that can be assigned to the squares CELL ROW 0.
Similarly, 3 Numbers must be assigned CELL ROW 1 of SQUARE 0
and 3 numbers must be assigned CELL ROW 2 of SQUARE 0
Ditto for SQUARES {1, N} and {2, N} {Or, SQUARES 1 And 2 of SQUARE ROW N}
Since any Number must always be in a CELL ROW Once and only Once across ANY SQUARE ROW, then:
Since there are 9 numbers we are assigning CELL ROWS to, and the Assignments is represented by the combinations C1 thru C6, we see that if we draw D1 of C1, and D2 of C2, then D1+D2 = 3, {Again, because only 3 Numbers can be assigned CELL ROW 0 in SQUARE 0, and whatever CELL ROW those end up in in SQUARES 1 and 2, they MUST Form C1 OR C2, since C1 and C2 are the only C's that start with 0.
Similarly, if we say C3 and C4 are drawn D3 and D4 times, then D3+D4 = 3
Also, ... D5 + D6 = 3.
In SQUARE 1, 3 CELL ROW 0's must be assigned, 3 1's, and 3 2's.
So, since those assignments are the second number in the sets C1 thru C6, we see that
0 is assigigned D3 and D5 times, 1 is assigned D1 and D6 times, and 2 is assigned D2 and D4 times. resulting in the following three formulas:
D3+D5=3
D1+D6=3
D2+D4=3
Similarly, considering the third position, the CELL ROW assignements of the numbers in SQUARE 2:
D4+D6=3
D2+D5=3
D1+D3=0
Lets consolidate those formulas:
D1+D2=3
D3+D4=3
D5+D6=3
D3+D5=3
D1+D6=3
D2+D4=3
D4+D6=3
D2+D5=3
D1+D3=3
Lets set as many of these D's in terms of D1:
Code:
D1+D2=3 => D2=3-D1
D3+D4=3
D5+D6=3
D3+D5=3
D1+D6=3 => D6=3-D1
D2+D4=3
D4+D6=3
D2+D5=3
D1+D3=3 => D3=3-D1
Now, lets substitute:
Code:
D3+D4=3 => 3-D1+D4=3 => D4=D1
D5+D6=3 => D5+3-D1=3 => D5=D1
D3+D5=3 => 3-D1+D5=3 => D5=D1
D2+D4=3 => 3-D1+D4=3 => D4=D1
D4+D6=3 => d4+3-d1=3 => D4=D1
D2+D5=3 => 3-D1+D5=3 => D5=D1
So, in summary:
If we draw C1 D1 times, we automatically know how many the rest of the C's were drawn, from:
D2=3-D1
D3=3-D1
D4=D1
D5=D1
D6=3-D1.
We can therefore Say, Assigning to D1 a Randome Number between 0 to 3 will produce all the possible assignements that the generic numbers n1 thru n9 will be assigned, across the three SQUARES in SQUARE ROW N.
Lets say we randomly assign 1 to D1.
Therefore
C1 will be used 1 time
C2 will be used 2 times
C3 will be used 2 times
C4 will be used once.
C5 will be used once
and C6 will be used 2 times.
So, we have 9 C's that can be assigned to the numbers 1 thru 9.
We can assign them Randomly.
How about, for example:
2=C1
4=C2
1=C2
7=C3
6=C3
5=C4
9=C5
8=C6
3=C6
Therefore, in Square 0, we see that in its CELL ROW 0 exists the numbers 1,2, and 4
In Its CELL ROW 1 exists the numbers 5,6, and 7, and in its CELL ROW 2, 3,8,9.
Well, lets just say that:
Code:
CellRow SQUARE_0 SQUARE_1 SQUARE_2
0 1,2,4 6,7,9 3,5,8
1 5,6,7 2,3,8 1,4,9
2 3,8,9 1,4,5 2,6,7
Now, Doing this with the other 2 SQUARE ROWS will result in nonconflicting RANDOM row assignements for ALL Numbers in ALL the Squares.
Any Questions?
:)
-
Re: Looping to put numbers in a 9x9 grid of Text Boxes
Hi,
Nicely done so far. I'm guessing that having created all the rows, you then jiggle your choice of numbers so that you get the columns to match as well.
Actually, you didn't need to go into as much detail as that, because effectively what you've done is to pick a pair of numbers per row and keep these pairs together. There are only two ways to arrange these pairs:
First pair: SQ1 R1, SQ2 R2, SQ3 R3
or
First pair: SQ1 R1, SQ2 R3, SQ3 R2
The other pairs then have no choice as to which rows they're in to satisfy the conditions. In your example, the 3 pairs are (1,4), (6,7), (3,8), using the second pattern. So basically, you just have to pick 1 from 2, and the pattern is decided. The sorting out of columns is then a bit of jiggling, and of course you can assign the numbers as you choose.
Indeed, if you think about it in those terms, you can see that this is the only way it can be done:
Consider the first number in the first row of the first SQUARE. In the second SQUARE, it must go in the second or third row. Similarly for the second number in the first row of the first SQUARE.
The first and second numbers are in the first row of the first SQUARE by definition. If they are also both in the second row of the second SQUARE, then they must also both be in the third row of the third SQUARE by elimination, hence we have achieved pattern 1. Likewise if they are both in the third row of the second SQUARE then they must both be in the second row of the third SQUARE and we have achieved pattern 2.
If they are not both in the same row of the second SQUARE, then we consider the third number in the first row of the first SQUARE. This number in the second SQUARE must be in the same row as either the first or the second numbers, because there are only 2 rows left and there is one of them in each. Hence we have a pair in 2 out of the 3 SQUARES and hence a pair in the third as well.
So, the pairing of numbers is the only possible way for sudoku to be generated. Thus, subject to the successful jiggling of columns, this is indeed the foundation for creating sudoku by random numbers.
Nice one. :thumb:
zaza
-
Re: Looping to put numbers in a 9x9 grid of Text Boxes
Hi,
That is not producing the grid from random number generation. It is simply using a predetermined pattern, exactly as I set out in my earlier post, and as cited by Zaza on 06/04/2005 at 12.05 am. You may be randomly selecting which actual numbers to use in the first determined sequence, but from then on you are bound to a set pattern, although, as I previously posted, you can swap entire rows or entire columns, provided both the rows or columns swapped run through the same miniblocks of 3*3. You can also swap the numbers around, provided you swap ALL of the selected numbers around. You can, by this method, make the grid seem random, but you could never produce it by genuine, consistent random number generation.
Using a fully random number generation and discarding illegal numbers as they arise seems to have a maximum limit of 79 legal number selections. The missing slots seem to be the same in every case, i.e Row 2, column 9 and row 3 column 6. One of the missing numbers always seems to be a 9 and the other 6, 7 or 8. In half of the grids where 79 numbers have been produced, it is quickly possible to swap 2 or 3 numbers around to produce a legitimate grid, just by looking at them, but I can't generate the code to do this i.e. it is a visual solution rather than a logical one. In the other half it seems to be impossible to complete.
Post a grid generated by your system and I will see if I can tell you the pattern.
-
Re: Looping to put numbers in a 9x9 grid of Text Boxes
Heh.
Well, I guess we must disagree.
You Do agree that, if a number is in position 0 in the first square, then it must be in position 1 or 2 in the 2nd square, and in position 2 or 1 in the third?
Likewise, 1, {0,2} or {2,0}, or 2 {0,1} or {1,0}?
Now, you can randomly say that a number in the first square IS in position 0, 1, or 2. However, isn't it equally as random if you say K Numbers in Square 0 will be placed, not only at Cell Row 0, but k times throughout the whole row {0,1,2} and L times whroughout the whole SQUARE Row as {0, 2, 1}.
AND, once you've defined what K and L are, ALL the other sequences MUST be as I mathematically proven?
Its NOT creating a pattern. Its Selecting THE ONLY Viable pattern the possible rows could be from a random draw, and then assigning those draws randomly to the existing numbers to be placed?
-
Re: Looping to put numbers in a 9x9 grid of Text Boxes
Quote:
Originally Posted by taxes
Hi,
You may be randomly selecting which actual numbers to use in the first determined sequence, but from then on you are bound to a set pattern, although, as I previously posted, you can swap entire rows or entire columns, .
Point #1) That post had nothing to do with assigning columns. Assigning colomns is much more complex {Unless you do that first, then assign the rows. no differance.}
Point #2) Each row of SQUARES is independant from each other when it comes to assigning CELL ROWS! What does SQUARE ROW 1 care about how Its numbers were assigned to cell rows in the SQUARE ROW above it? THEY're INDEPENDENT. No Influence if the number 1 in the above SQUARE is assigned row 0,1, or 2! Row Choices don't influence ther SQUARE ROWS Above or below each other, when you hav'nt chosen CELL Columns yet.
So, You Randomly assign the rows per my method 3 times, per each of the three SQUARE ROWS that exist.
No "Shifting, flipping,or swapping" whatsoever!
:)
-
Re: Looping to put numbers in a 9x9 grid of Text Boxes
HI Guys,
I suggest we agree to differ on this one. We obviously have a different understanding of the meaning of "Random". Whilst I regard limiting a choice to certain numbers as being random within that range, I do not regard pre-selecting the actual numbers as being random. You obviously differ and are entitled to your view.
Even my view of "Random" would be challenged by most academics who would protest that once you limit the next choice you have departed from the selection being Random.
EDIT: I do agree that you have produced a method of creating legitimate grids and that it is probably the closest you can get to a truly random number generation, to do so. My Pattern suggestion is less Random than yours but will produce a legitimate grid every time.
-
Re: Looping to put numbers in a 9x9 grid of Text Boxes
Good Morning.
:wave:
A Number will always be in Rows 0, 1, and 2 in ALL three SQUARE ROWS.
So, That isn't capable of being random. As to which SQUARE in a ROW will it be in row 0, 1, or 2, well, that IS handled randomly, via which combination is randomly applied to it.
You can only have only 4 sets of unique combinations, and which of the four is being determined randomly.
Applying the drawn combinations to the numbers is being done randomly.
At what point is the Number:CellRow assignment using predetermined numbers?
BTW, You suggested that I attach some examples of my successes, to see if you can see the pattern. I'll attach them in a few hours back at work.
:)
-Lou
-
Re: Looping to put numbers in a 9x9 grid of Text Boxes
Quote:
Originally Posted by zaza
Hi,
Nicely done so far. I'm guessing that having created all the rows, you then jiggle your choice of numbers so that you get the columns to match as well.
....Nice one. :thumb:
zaza
Sorry, didn't see you up there above Taxes.
Thanks for the :thumb:
If you go back up there to where I posted my PDF, Thats where I explained basically my technique used in my progie for how I chose the column assignments, although presented in terms of how I used the scratch sheet in developing the column choosing technique.
I feel like there might be a more "Combination of 3" Method for assigning the columns, so next weekend, {and the upcoming days} I'll be looking at that.
:wave:
-Lou
-
1 Attachment(s)
Re: Looping to put numbers in a 9x9 grid of Text Boxes
Quote:
Originally Posted by taxes
Post a grid generated by your system and I will see if I can tell you the pattern.
Here's a ZIPPED PDF with 756 Successful generations after 1000 attempts.
:wave:
-Lou
-
Re: Looping to put numbers in a 9x9 grid of Text Boxes
Hi,
I think that the difference of opinion here is slightly misplaced. As I argued in my earlier post, any legitimate grid has to pick numbers pairwise for each of the three rows as you go across the SQUARES. In any legitimate grid, once generated, you can swap rows or columns within a SQUARE and still have a legitimate grid. This is obvious, because if you swap columns you are keeping the pairs in their rows, and similarly if you swap rows you are keeping the pairs in their columns.
However, I agree with taxes that this is not generating a grid RANDOMLY. There is some structure behind the method which helps to generate the pattern. I suggested another method earlier insofar as building the grid by moves so that it makes it easier to remove squares. My method would be more strugglesome to get a grid, but I bet it would be easier to remove squares and leave a solvable puzzle. This, however, is not the point.
The point is to generate it simply by putting random numbers in the cells, subject to the 3 rules, rather than working out the correlation between one cell and the next. Thus what we are effectively doing is reducing the probability of generating a successful grid by doing it randomly, rather than determining the positions of the numbers in the next SQUARE according to where they are in the first SQUARE.
In fact, given the method that NotLKH or SomethingElse (whatever your name is :ehh: ) has proposed, I reckon we can work out the probability of doing it randomly. Given that the pair method MUST be present if the grid is successful, once we've chosen the numbers in the first 3 cells of the first SQUARE, there are a limited number of possibilities as to where the numbers can go in the next SQUARE. The probability of a successful generation by a random number method is the number of ways of allocating numbers pairwise in all these rows (and columns) divided by the total permutations.
Worknig that out is another matter, but it's a start.
The random number generation will diverge from the pairwise generation if there are a pair of numbers in SQ1R1 and SQ2R2, and also a pair of numbers in SQ1R2 and SQ2R1. This means that there must be a duplicate in the third row. Even once this is past for the first row of SQUARES, there arises the problem that you are not deliberately generating pairs in the columns of SQUARES, so unless in generating the first SQUARE in the second row you also assign pairs columnwise to match up with the first SQUARE in the first row, you will cause an error in the first SQUARE in the third row.
Incidentally, taxes is correct in that once you have generated the pattern, and decided what the numbers will be in the first SQUARE, the rest are determined because the correlations persist throughout the grid.
The point of the RANDOM nature of this is that it will only achieve these pairs by chance, rather than deliberately.
Does that make sense?
zaza
-
Re: Looping to put numbers in a 9x9 grid of Text Boxes
Quote:
Originally Posted by zaza
Incidentally, taxes is correct in that once you have generated the pattern, and decided what the numbers will be in the first SQUARE, the rest are determined because the correlations persist throughout the grid.
The ROW assignment Does Indeed determine the row assignments of the numbers across a row by determining the Row assignments of the numbers in the first SQUARE of the row, if you are using my method, which is determining the ROW assignments of a number across three rows at one Assignment of the 3 rows on the number.
BUT, having determined the row assignments of the numbers in the first SQUARE ROW does not determine the row assignments in the 2nd and 3rd SQUARE ROWS. Those each are independant of each other.
BTW, It sounds like, if you were given the task to draw 52 cards randomly, you wouldn't remove the card from the stack after you drew it? In other words, if your draw affects the source of that which you are drawing from, you wouldn't program it to alter your source? You'd still allow that card to be drawn?
Or, alternatively, if you had a "magic" deck, that started with 18 cards, but some cards would magically disappear based on the sequence that the existing cards were drawn, and you knew the rules how they disappeared, and your task was to draw 9 random cards, you wouldn't simulate the changing of the deck as you drew the cards in your progie?
BTW, I'm NotLKH at work, and usually something else only when I'm at home.
-Back to work!
:)
-Lou
-
Re: Looping to put numbers in a 9x9 grid of Text Boxes
Hi Lou,
many thanks for your effort & input. There is a discernible pattern in the grids you posted but it was very difficult to spot. In all cases it is based on a pattern of 3 (not necessarily consecutive numbers numerically) and then swapping. In some cases the pattern of 3 is once removed and in others twice removed. When you first look at your grids they actually look as though they conform to a simple pattern, but then when you go into it they appear more and more random!!! Got any headache pills?
To summarise. I think you have produced an excellent method of creating these grids 'cos my pattern methods can be easily cracked. Well done
-
Re: Looping to put numbers in a 9x9 grid of Text Boxes
Quote:
Originally Posted by taxes
Hi Lou,
many thanks for your effort & input. There is a discernible pattern in the grids you posted but it was very difficult to spot. In all cases it is based on a pattern of 3 (not necessarily consecutive numbers numerically) and then swapping. In some cases the pattern of 3 is once removed and in others twice removed. When you first look at your grids they actually look as though they conform to a simple pattern, but then when you go into it they appear more and more random!!! Got any headache pills?
To summarise. I think you have produced an excellent method of creating these grids 'cos my pattern methods can be easily cracked. Well done
Thanks!
I figured you'd find a "pattern".
I'm not sure what you mean by Once or Twice "Removed", but what would "Third" Removed look like?
Would you surmise this "pattern" is inherently a result of my programming, or is this pattern you discern something you'd be able to see in any valid SODUKO Layout?
:)
-Lou
[EDIT]
Just had a thought.
If I gave you a data file of SODUKO generations, could you build a progie that automatically determines the "pattern" of each?
-
Re: Looping to put numbers in a 9x9 grid of Text Boxes
Hi,
By first & second removed I mean that the sequence moves one step of 3 forward or two steps. Three steps rempved would, in the case of a Soduko grid, mean you repeat the exact numbers which, of course, would not be permissible.
In the restricted random generation code I developed (which never produced a legitimate grid :blush: ) I could not detect any pattern, but whilst my largest number of attempts in any one session was in excess of 1,400,000 I never checked more than 4 for evidence of a pattern and even then I was looking for a pattern in the sequence of unfilled slots. Unless the pattern is clearly visual, it takes a long time to work it through, because there are always possible alternative adjustments to any pattern (or any grid for that matter).
Using my pattern generation programme, it was. of course, relatively easy to spot the pattern, even if I gave the computer many possible patterns to choose from.
Solving Soduko puzzles does not interest me. I was originally intrigued to see if, as the first post requested, it would be practically possible to use totally random number generation to produce a grid, but soon came to the conclusion that it would, statistically, take a lifetime. My eventual solution is far less random than yours. I might, out of interest, try producing code along the lines you suggested, but I don't intende to spend any more time on this at the moment.
The originator of this thread seems to have disappeared completely :wave:
-
Re: Looping to put numbers in a 9x9 grid of Text Boxes
Sorry for the late reply, but for some reason this site stopped notfifying me of replies :( Really sorry. I haven't given up on this topic, I just had a lot of work to do for exams and then sort of forgot... then I just suddenly remembered again and saw how many replies. Again I'm sooo sorry, and thanks for all your help and all, i'll read through everything now. I came up with a new idea that may work which i'm planning at the moment.
Oh, and yes I am planning a generator, and hopefully this new way I'm thinking of will be able to do the trick within a small amount of time. Once I get some code sorted out i'll post it. I might be making more edits to reply to some things here.
Edit: If anybody is reading this... My way at the moment isn't completely random at the moment but hopefully if i can figure this out, should be completely random, and fitting all the conditions of course.
-
Re: Looping to put numbers in a 9x9 grid of Text Boxes
-
Re: Looping to put numbers in a 9x9 grid of Text Boxes
Thanks, I'll have a look.
-
Re: Looping to put numbers in a 9x9 grid of Text Boxes
From the techniques I learned in building the msk files, I feel I could have applied them into building the base sudokus. {The base sudokus were the full pattern generated via a combination of random cell/number assignement, and then exhausting the must_bes that spun off of each assignment.}
I attained a 97% efficiency with building the base sudokus, but I didn't use any of, what I found out halfway, approx the 2nd submission of my msk files, were called naked and hiddin singles, doubles, triples, ...
Anytime my base sudoku generator failed, {3 % of the time} I just generated another.
THEN, I started my masking procedure.
I feel, if I backtrack into my code, and suppliment my base sudoku generators with these basic strategies, I could achieve 100% random base sudoku generation.
:wave:
-Lou
-
Re: Looping to put numbers in a 9x9 grid of Text Boxes
hi !
can anybody let me know about the complete source code for sudoku in VB.NET here !
thanx