constant/board_constants
library
Constants
-
kBoardGridSize
→ const int
-
Width/height of the board grid, in cells.
-
kCenterCell
→ const List<int>
-
The single center cell every piece is ultimately heading toward.
-
kHomeBaseOrigins
→ const List<List<int>>
-
Top-left
[row, col] origin of each player's 6x6 home base quadrant, in
the same player-index order as kStartIndices.
-
kHomeStretchCells
→ const List<List<List<int>>>
-
Each player's 5-cell colored home stretch, ordered from its entrance
(reached right after the 51st shared-path cell) to the cell adjacent to
the center. Indexed by player (0-3), in the same order as
kStartIndices.
-
kHomeYardSlots
→ const List<List<int>>
-
Local
[row, col] offsets (within a 6x6 home base) where a player's 4
waiting pieces sit before entering the board.
-
kPathCells
→ const List<List<int>>
-
The 52 cells of the shared outer path, listed in clockwise travel order
as
[row, col] pairs. Index 0 is player 0's start cell; index 13 is
player 1's; 26 is player 2's; 39 is player 3's (see kStartIndices).
-
kSafeIndices
→ const Set<int>
-
Indices into kPathCells that are designated "star"/safe cells. A piece
sitting on one of these cells (including any player's start cell) can
never be captured.
-
kStartIndices
→ const List<int>
-
Index into kPathCells where each of the 4 players enters the board.
Functions
-
globalCellOf(int playerIndex, int trackPosition)
→ int
-
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.
-
gridCellFor(int playerIndex, int trackPosition)
→ List<int>?
-
Resolves any non-home track position to a
[row, col] grid cell, for
rendering.
-
isSafeCellIndex(int globalIndex)
→ bool
-
Whether the given absolute index into kPathCells is a safe cell.