Hi.
I'm coding a game in PHP to enhance my programming abilities. The idea of a game is to build lines of five or more blocks of the same color, which will then disappear. The board is at this point 10x10 places in size.
There are five colors, plus one multicolored (can be any of the five, depending on the situation) and one which serves as obstacle and cannot be removed.
The problem now is that I'd have to find an effective method to calculate the rows of unique color. If we assume that the playfield is in an array or something similar in the form of:
1111111111
1111111111
1111111111
1111111111
1111111111
1111111111
1111111111
1111111111
1111111111
1111111111
where each number marks one place, either free or occupied by a block of definitive color (1 for blue, 2 for red, etc.) what would be the best way to find the rows of five or more?
The idea of the game is not mine, BTW, but I'm trying to code a version that would work in a browser, just to see if it can be done. But here's where I'm stuck.
Thanks,
A.