LudoBotController class

Legacy bot controller, kept for source compatibility.

Bots are now built into LudoController:

LudoController(players: players, botPlayers: {1, 2, 3});
Inheritance
Annotations
  • @Deprecated('Use LudoController(botPlayers: ...) instead. ' 'LudoBotController will be removed in 1.0.0.')

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), LudoBotDifficulty botDifficulty = LudoBotDifficulty.medium})

Properties

animatingPiece → LudoPiece?
no setterinherited
autoMoveDelay → Duration
Delay before an automatic single-choice move, so the rolled value is visible first.
finalinherited
autoMoveSingleChoice → bool
When a human rolls and every legal move leads to the same result (a single legal move, or several pieces stacked on the same cell), play it automatically after autoMoveDelay.
finalinherited
botDifficulty ← LudoBotDifficulty
Switches every bot to the built-in strategy for difficulty.
no getterinherited
botPlayerIndices → Set<int>
Same as botPlayers.
no setter
botPlayers → Set<int>
Seats currently played by the bot.
no setterinherited
botStrategy ↔ LudoBotStrategy
The strategy bots use to pick moves. Can be swapped at any time.
getter/setter pairinherited
botThinkDuration → Duration
How long a bot waits before rolling or picking a piece.
finalinherited
canRoll → bool
Whether a human may call rollDice right now.
no setterinherited
canSelectPiece → bool
Whether a human may call selectPiece right now.
no setterinherited
diceRules → LudoDiceRules
finalinherited
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
innerController → LudoController
Returns this controller; kept for compatibility.
no setter
isAnimating → bool
no setterinherited
isCurrentPlayerBot → bool
Whether the player to move is a bot.
no setterinherited
isPaused → bool
Whether automatic play (bots and auto-moves) is suspended.
no setterinherited
isTeamsMode → bool
no setterinherited
onDiceRolled → LudoDiceRolledCallback?
finalinherited
onGameFinished → LudoGameFinishedCallback?
finalinherited
onPieceCaptured → LudoPieceCapturedCallback?
finalinherited
onPieceMoved → LudoPieceMovedCallback?
finalinherited
onPlayerWon → LudoPlayerWonCallback?
finalinherited
onTeamWon → LudoTeamWonCallback?
finalinherited
onTurnChanged → LudoDiceRolledCallback?
finalinherited
onTurnForfeited → LudoPlayerWonCallback?
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
state → LudoGameState
no setterinherited
stepAnimationDuration → Duration
Delay between each cell while a piece moves. Duration.zero commits moves immediately (useful for tests and simulations).
finalinherited
teams → List<LudoTeam>?
no setterinherited
thinkDuration → Duration
Same as botThinkDuration.
no setter

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.
inherited
isBot(int playerIndex) → bool
Whether playerIndex is played by the bot.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
pause() → void
Suspends bots and automatic moves, and blocks rollDice and selectPiece until resume is called. A move already animating finishes normally.
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
Starts a new game with the same players, teams, and bot seats.
inherited
restore(LudoGameState state) → void
Replaces the current game with state — e.g. one saved earlier with LudoGameState.toJson. Bot seats outside the new player range are dropped.
inherited
resume() → void
Resumes play after pause.
inherited
rollDice() → int
Rolls the dice for the current (human) player and returns the value.
inherited
selectPiece(int pieceId) → Future<void>
Moves pieceId using the current roll, animating it one cell at a time. Completes once the move is committed.
inherited
setBot(int playerIndex, bool isBot) → void
Hands playerIndex over to the bot (true) or to a human (false) — e.g. when a player leaves mid-game.
inherited
suggestMove() → LudoLegalMove?
The move the hard bot would play now, for showing a hint to a human. null unless a piece selection is pending.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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