roll method
Implementation
LudoEngineRollResult roll(LudoGameState state, int diceValue) {
final moves = computeLegalMoves(
state, diceRules, diceValue,
teams: teams,
);
if (moves.isEmpty) {
return LudoEngineRollResult(
state: state.copyWith(
currentPlayerIndex: _nextPlayer(state, state.currentPlayerIndex),
phase: LudoTurnPhase.awaitingRoll,
legalMoves: const [],
clearDiceValue: true,
),
passed: true,
);
}
return LudoEngineRollResult(
state: state.copyWith(
diceValue: diceValue,
legalMoves: moves,
phase: LudoTurnPhase.awaitingPieceSelection,
),
passed: false,
);
}