Matrix scacanning - sequences detection
Hi!
I´m on a personal game project willing to implement a Collumns-like game. However, I´ve been facing some problems with score handling ´cause Collumns rules differ from Tetris rules. I can´t simply scan for filled lines. I have to look for sequences of objects (pieces) of the same kind or color.
I am representing the grid where the pieces fall in as a bidimensional matrix. But I just can´t figure out what kind of sacanning or calculation I should use to spot sequences of three or more alike pieces. Also, there is the "combo" problem, that happens when numerous sequences are completed at the same time in different directions.
Does anybody knows a smart way to look for these sequences in a matrix?
Thanx already!
Rogers -|_|-
Rogers -|_|-
Yes, but I suspect it''s a bit beyond what you need. It''s a technique deceloped to discover sequences in gene expression data expressed as matrices.
You''d be better off taking a ''dumb'', brute force approach. Much less effort to understand and for such a small problem it''s doable in finite time.
Cheers,
Timkin
You''d be better off taking a ''dumb'', brute force approach. Much less effort to understand and for such a small problem it''s doable in finite time.
Cheers,
Timkin
quote:
Original post by Timkin
It''s a technique deceloped to discover sequences in gene expression data expressed as matrices.
Hehehe... the first application for biological computers: Tetris.
Don''t listen to me. I''ve had too much coffee.
Here is a simple approach:
you check your whole grid for 3 pieces of same kind, and this in the 3 direction, rigth, down, diagonally.
When you find one, you place 1 in another temporary matrix. Then, the result could be something like this:
..........
..1111.1..
.......1..
...1...1..
..111.....
.11111....
Then, simply take all the pieces above a 1 one down.
[edited by - misterX on August 8, 2002 11:02:49 AM]
you check your whole grid for 3 pieces of same kind, and this in the 3 direction, rigth, down, diagonally.
When you find one, you place 1 in another temporary matrix. Then, the result could be something like this:
..........
..1111.1..
.......1..
...1...1..
..111.....
.11111....
Then, simply take all the pieces above a 1 one down.
[edited by - misterX on August 8, 2002 11:02:49 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement