private Tile GetNeighbor(Tile target, Neighbors neighbor)
{
Tile tile = null;
int col = target.col;
int row = target.row;
switch (neighbor) {
case Neighbors.UpperLeft:
if (col > 0 && row > 0) {
tile = tiles [col - 1, row - 1];
}
break;
case Neighbors.Above:
if (row > 0) {
tile = tiles [col, row - 1];
}
break;
case Neighbors.UpperRight:
if (col < 7 && row > 0) {
tile = tiles [col + 1, row - 1];
}
break;
case Neighbors.Left:
if (col > 0) {
tile = tiles [col - 1, row];
}
break;
case Neighbors.Right:
if (col < 7) {
tile = tiles [col + 1, row];
}
break;
case Neighbors.LowerLeft:
if (col > 0 && row < 7) {
tile = tiles [col - 1, row + 1];
}
break;
case Neighbors.Below:
if (row < 7) {
tile = tiles [col, row + 1];
}
break;
case Neighbors.LowerRight:
if (col < 7 && row < 7) {
tile = tiles [col + 1, row + 1];
}
break;
}
return tile;
}