# NEIGHBOR algorithm

What is the method used to determine neighbors?

I have a screenfull of clones of equal size (12x12) blocks of two colors. I want to determine the touching ones in order to group them into areas.

When I try NEIGHBOR logic, I get lists of neighbor clones of varying numbers for the corner pieces, even though the distribution is even:
BL: 7 (bottom left)
BR: 8
TL: 8
TR: 6
I don't understand why there is a difference.
Same kind of thing happens for the edge and center clones, where adjacent ones report different number of neighbors...

Any reason why after two days there has been no answers? This cannot be that complicated. Thx.

Can we see your project? Your screen shot doesn't look completely uniform. Maybe rounding issues?

Oh geez, so it's me again

The neighbors algorithm is dependent on the extent of the sprite that asks for them. I'm currently too lazy to look up the specifics in my code, but the rule is that there's some relationship between the sprite's area to the surrounding box that it scans for neighbors. The neighbors attribute is meant not so much to perform statistics on surrounding populations but to narrow-down potential collision candidates, or to find the nearest one. If you want a configurable circular view of "neighbors", you can use something like this:

Thanks @jens. Worked.