I'm working on a simple multiplayer game that receives a random 4x4 matrix from a server and extracts a shape from it.
XXOO OXOO XXOX XXOO XOOX and XOOO XXXX OXXX
So in the first matrix the shape I want to parse is:
oo o oo
and the 2nd:
oo oo ooo
I know there must be an algorithm for this because I saw this kind of behavior on some puzzle games but I have no idea how to go about to detecting them or even where to start.
So my question is: How do I detect what shape is in the matrix and how do I differentiate
between multiple colors? (it doesn't come only in
O, it comes in a maximum of 4). Additionally, the shape must be a minimum of 4 blocks.