I am making a game like Lumines Remastered (Lumines Remastered Nintendo Switch Gameplay - YouTube) and I was pretty much successful in it. But, I got stuck in one place in clearing the pieces.
I have a 2d Array grid of 16x10 and each individual pieces are stored in it.
I was successful in finding all the matching pieces using the flood fill algorithm and storing every same color matching pieces in a separate list. Now, the condition is I only want to delete the pieces that are in combination of squares with others and not the individual ones.
For example:-
Like this. 1 is in square combination and I only want to delete them.
But,
2 in this image is also a valid square (so, 1 & 2 combined should get deleted). I quite can’t seem to figure out how to check for square combination. Any suggestions and ideas would be great.