Quote:Original post by ChaosX2Quote:Original post by Tom Knowlton
Here is what I have come up with, so far:
public bool AreNeighbors(Click from, Click to)
{
if((Math.Abs(from.col - to.col) <=1) && (Math.Abs(from.row - to.row) <=1))
{
return true;
}
else
{
return false;
}
}
This seems to work from my testing so far.
So it looks like a grid can be it's own neighbor?
I test for this before passing in the values, but yes, according to my logic, this could happen. Nice catch.