• Create Account

### #ActualOlof Hedman

Posted 30 October 2012 - 04:20 PM

You need to iterate through your pattern and test it ID by ID at position (0,0), then move to (1,0) do the same, etc, for all positions.
As soon as you find a mismatch, you can move on, so maybe not as slow as you think.

Though!
If a pattern appeared, it must contain the newly placed tile right?
So you don't have to check through the whole array, only in a box roughly 2x the size of your pattern, around the position where the user clicks.

### #3Olof Hedman

Posted 30 October 2012 - 04:16 PM

You need to iterate through your pattern and test it ID by ID at position (0,0), then move to (1,0) do the same, etc, for all positions.
As soon as you find a mismatch, you can move on, so maybe not as slow as you think.

Though!
If a pattern appeared, it must contain the newly placed tile right?
So you don't have to check through the whole array, only in a box 2x the size of your pattern, around the position where the user clicks.
(once for every id in your pattern, so 9 tests in your example)

### #2Olof Hedman

Posted 30 October 2012 - 04:15 PM

You need to iterate through your pattern and test it ID by ID at position (0,0), then move to (1,0) do the same, etc, for all positions.
As soon as you find a mismatch, you can move on, so maybe not as slow as you think.

Though!
If a pattern appeared, it must contain the newly placed tile right?
So you don't have to check through the whole array, only in a box 2x the size of your pattern, around the position where the user clicks.

### #1Olof Hedman

Posted 30 October 2012 - 04:14 PM

You need to iterate through your pattern and test it ID by ID at position (0,0), then move to (0,1) do the same, etc.
As soon as you find a mismatch, you can move on, so maybe not as slow as you think.

Though!
If a pattern appeared, it must contain the newly placed tile right?
So you don't have to check through the whole array, only in a box 2x the size of your pattern, around the position where the user clicks.

PARTNERS