package de.hsfulda.pmuw.oop; public enum NeighborPosition { NORTH(-1, 0), SOUTH(1, 0), EAST(0, 1), WEST(0, -1), NORTH_EAST(-1, 1), SOUTH_EAST(1, 1), SOUTH_WEST(1, -1), NORTH_WEST(-1, -1); private final int rowOffset; private final int columnOffset; NeighborPosition(int rowOffset, int columnOffset) { this.rowOffset = rowOffset; this.columnOffset = columnOffset; } int getIndex(int row, int column, int rowSize) { return (((row + rowOffset) * rowSize) + column + columnOffset); } }