gridCellFor function
Resolves any non-home track position to a [row, col] grid cell, for
rendering.
trackPositionin0..50-> a cell on the shared path.trackPositionin51..55-> a cell in the player's home stretch.trackPositionof56(finished) -> kCenterCell.
Returns null for a piece still at home (trackPosition < 0) — callers
should use kHomeBaseOrigins / kHomeYardSlots for those instead.
Implementation
List<int>? gridCellFor(int playerIndex, int trackPosition) {
if (trackPosition < 0) return null;
if (trackPosition >= 56) return kCenterCell;
if (trackPosition < 51) {
return kPathCells[globalCellOf(playerIndex, trackPosition)];
}
return kHomeStretchCells[playerIndex][trackPosition - 51];
}