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 whilestate.phase == LudoTurnPhase.awaitingPieceSelection, so there is always at least one legal move. Returning a move that is not instate.legalMovesmakes 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