Checking Grid Array for line patterns
I'm working on a puzzle game that has a grid of blocks, 5 blocks wide and 6 blocks high. Sliding the blocks into rows or columns of 4 or more of the same type 'destroys' these blocks.
Now, the problem I'm running into is my code to check whether a (or multiple) line of 4,5 or 6 of the same blocks exists, and to handle that situation. It's turning into quite the code block, so I'm wondering if there's not a simpler way, maybe with regular expressions or string searching or ... At the moment I'm doing a loooot of if...elseif...elseif...elseif...end code.
Does anyone have any experience in this area?