Find actors next to others with same attributes?
I want to create a rule that finds actors that possess the same attributes. I have a grid of 60 actors. Some are black and some are gray. I want to be able to find black actors that are adjacent to other black actors and link them. For example if three black actors are adjacent to each other they would be linked in a chain of three. A sample grid of this situation is shown below.
The grid below would be a chain of 5 because 5 Black actors would be adjacent.
Within the overall grid there may be 15 instances of linked blocks. Should I make 15 game attributes to measure link length? Or should I use self attributes?
Also, is there a way I can quickly determine if a another black actor is next to any other black actors?