Changed calcAdjacencies to work for any size board