calcIndex more flexable to board size