I was debugging my code and, for the life of me, couldn’t figure out what was wrong. When I finally found out what was wrong, my check for neighbors was failing when it shouldn’t. I decided to do a test and found some interesting results:
var t = this.getTile(0,0);
var t2 = this.getTile(0,1);
this.debug(t.neighbors.indexOf(t2));
I expect the debug output to be a positive number, but it’s yielding -1. This indicates that t.neighbors does not include tile (0,1), and therefore that (0,0) and (0,1) are not neighbors.
It’s a shame that I now have to implement my own check for neighbors manually.