So I'm making a game with elements of a match-3 puzzler (e.g. Columns, Bejeweled, Tetris Attack). However, I don't know where to begin in terms of creating an algorithm that lets me detect matches and clear them efficiently.
These are the assumptions about my game;
- Blocks of a like color can be matched horizontally, vertically, or diagonally in sets of at least 3.
- Blocks are held within a grid. They do not move horizontally.
- However, blocks do move vertically due to gravity.
- This is an action game, therefore we have to check up on the grid each frame.
- Due to the design of my game, however, we only need to check for matches if at least one block was falling in the previous frame.
Any tips? I'm using Python and PyGame.