LudoBotController class

Wraps LudoController and automatically drives turns for any player index listed in botPlayerIndices.

Human players interact normally via rollDice and selectPiece. Bot players have their turns driven automatically after thinkDuration.

final controller = LudoBotController(
  players: players,
  botPlayerIndices: {1, 2, 3}, // seats 1-3 are bots, seat 0 is human
  thinkDuration: Duration(milliseconds: 300),
);

Use exactly like LudoController in the UI — it extends ChangeNotifier and exposes the same state, rollDice, selectPiece, reset, and dispose API.

Inheritance

Constructors

LudoBotController({required List<LudoPlayer> players, required Set<int> botPlayerIndices, LudoDiceRules diceRules = const LudoDiceRules(), int diceRoller()?, bool enableAudio = true, Duration thinkDuration = const Duration(milliseconds: 300), List<LudoTeam>? teams, LudoDiceRolledCallback? onDiceRolled, LudoPieceMovedCallback? onPieceMoved, LudoPieceCapturedCallback? onPieceCaptured, LudoTurnChangedCallback? onTurnChanged, LudoPlayerWonCallback? onPlayerWon, LudoTeamWonCallback? onTeamWon, LudoGameFinishedCallback? onGameFinished, Duration stepAnimationDuration = const Duration(milliseconds: 180)})

Properties

animatingPiece LudoPiece?
no setter
botPlayerIndices Set<int>
Set of player indices that are controlled by the bot.
final
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
innerController LudoController
Public accessor for the inner controller (used by LudoBoard).
no setter
isAnimating bool
no setter
isCurrentPlayerBot bool
True if the current player's seat is a bot.
no setter
isTeamsMode bool
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state LudoGameState
no setter
teams List<LudoTeam>?
no setter
thinkDuration Duration
How long the bot "thinks" before rolling or selecting a piece.
final

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
dispose() → void
Discards any resources used by the object.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
reset() → void
rollDice() int
For human players only. Throws if called during a bot turn.
selectPiece(int pieceId) Future<void>
For human players only. Throws if called during a bot turn.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited