1. You have a square of N*N.
2. Any cell can only have one of four values: 3,2,1 and 0.
3. A cell and it's neighbors in (row-1,row+1) or (col-1,col+1) must equal 5.
I want to fill N*N randomly with the above rules. I have a problem though, I think that once I enter the first three values, the entire grid fixed. Consider:
30???????
1????????
?????????
..
The first same-row and first same-column will determine the entire array. I am hoping this isn't true. Does anyone see any flaw in this? What I really want to do is just randomly start scattering values around, and eventually merge it to fit the rules. But I don't think it's possible.
302...repeating
122...repeating
131...repeating
...repeating
Now we don't always end up with that exact 3x3 block repeating. For example, I could have done:
31...
2...
...
But then I would have had another fixed pattern. Basically, pick any spot, and left+right+here = 5, up+down+here = five, and any other random spot has to do the same. From anywhere, anything you can reach from 2 hops in a straight line from where you are, counting where you are, is five.
If I had taken the start of the second pattern block, and stuck it at [X10,Y10][X11,y10][X10,y11] for the three numbers, it would be impossible for it to merge with the first pattern, due to the trio locking you into whatever pattern, right?
[edit]
Showing a failure for the two patterns to ever merge:Now I cheated a bit here for the sake of fitting this on one screen. But I don't think it's possible for that red block to be a part of this grid, having entered the green blocks first.Code:302??????????? 122??????????? 131??????????? ?????????????? ?????????????? ??????????31?? ??????????2???
[/edit]
[edit2]
Actually, it's more like: The first two consecutive numbers lock the third. The first three consecutive numbers are forever locked. The first horizontal lock and vertical lock lock the 3x3 set. The locked set locks the entire array. See:
3cc
r
r
I have 11 or 02 or 20 as possible options for rr or cc. But once I pick one, I'm screwed. There will be lucky coincidences, and I can get it down to 1 garbage space, but I need zero garbage spaces. I was also hoping to actually get more than a 3x3 block repeated. I was trying for huge blocks, but it looks like that's just impossible with the rules I have.
[/edit]
Am I missing anything obvious here?
Quzah.