LudoBotStrategy class abstract

Decides which legal move a bot plays.

Implement this to plug your own AI into LudoController.botStrategy:

class AlwaysFirstBot extends LudoBotStrategy {
  const AlwaysFirstBot();
  @override
  LudoLegalMove chooseMove(LudoGameState state) => state.legalMoves.first;
}
Implementers

Constructors

LudoBotStrategy()
const
LudoBotStrategy.forDifficulty(LudoBotDifficulty difficulty)
Returns the built-in strategy for difficulty.
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

chooseMove(LudoGameState state) → LudoLegalMove
Picks one of state.legalMoves. Called only while state.phase == LudoTurnPhase.awaitingPieceSelection, so there is always at least one legal move. Returning a move that is not in state.legalMoves makes the controller fall back to the first one.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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