LudoBotController constructor

LudoBotController({
  1. required List<LudoPlayer> players,
  2. required Set<int> botPlayerIndices,
  3. LudoDiceRules diceRules = const LudoDiceRules(),
  4. int diceRoller()?,
  5. bool enableAudio = true,
  6. Duration thinkDuration = const Duration(milliseconds: 300),
  7. List<LudoTeam>? teams,
  8. LudoDiceRolledCallback? onDiceRolled,
  9. LudoPieceMovedCallback? onPieceMoved,
  10. LudoPieceCapturedCallback? onPieceCaptured,
  11. LudoTurnChangedCallback? onTurnChanged,
  12. LudoPlayerWonCallback? onPlayerWon,
  13. LudoTeamWonCallback? onTeamWon,
  14. LudoGameFinishedCallback? onGameFinished,
  15. Duration stepAnimationDuration = const Duration(milliseconds: 180),
})

Implementation

LudoBotController({
  required List<LudoPlayer> players,
  required this.botPlayerIndices,
  LudoDiceRules diceRules         = const LudoDiceRules(),
  int Function()? diceRoller,
  bool enableAudio                = true,
  this.thinkDuration              = const Duration(milliseconds: 300),
  List<LudoTeam>? teams,
  // Forward all callbacks
  LudoDiceRolledCallback?    onDiceRolled,
  LudoPieceMovedCallback?    onPieceMoved,
  LudoPieceCapturedCallback? onPieceCaptured,
  LudoTurnChangedCallback?   onTurnChanged,
  LudoPlayerWonCallback?     onPlayerWon,
  LudoTeamWonCallback?       onTeamWon,
  LudoGameFinishedCallback?  onGameFinished,
  Duration stepAnimationDuration  = const Duration(milliseconds: 180),
}) : _scorer = const LudoMoveScorer(),
     _inner  = LudoController(
       players:              players,
       diceRules:            diceRules,
       diceRoller:           diceRoller,
       enableAudio:          enableAudio,
       teams:                teams,
       onDiceRolled:         onDiceRolled,
       onPieceMoved:         onPieceMoved,
       onPieceCaptured:      onPieceCaptured,
       onTurnChanged:        onTurnChanged,
       onPlayerWon:          onPlayerWon,
       onTeamWon:            onTeamWon,
       onGameFinished:       onGameFinished,
       stepAnimationDuration: stepAnimationDuration,
     ) {
  // Listen to inner controller and re-notify our own listeners so the
  // board / dice widgets rebuild correctly.
  _inner.addListener(_onInnerChanged);
  // Kick off bot if the first player happens to be a bot.
  _scheduleBotTurnIfNeeded();
}