globalCellOf function

int globalCellOf(
  1. int playerIndex,
  2. int trackPosition
)

Resolves a piece's relative track position (must be in 0..50, i.e. on the shared path — see LudoPiece.isOnSharedPath) for playerIndex to an absolute index into kPathCells.

Implementation

int globalCellOf(int playerIndex, int trackPosition) {
  return (kStartIndices[playerIndex] + trackPosition) % kPathCells.length;
}