Miscellany
public text v1 · immutablepoint getHorizontalNeighbour(int row, int col) {
point neighbour;
if (col % 2 == 0) {
if (row % 2 == 0) {
neighbour.row = row - 1;
neighbour.col = col + 1;
}
else {
neighbour.row = row - 1;
neighbour.col = col - 1;
}
}
else {
if (row % 2 == 0) {
neighbour.row = row + 1;
neighbour.col = col + 1;
}
else {
neighbour.row = row + 1;
neighbour.col = col - 1;
}
}
return neighbour;
}