Interface BotStrategy
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
The turn callback is the single required operation, so this remains a functional interface
and can be implemented with a lambda. Optional decision kinds use safe default methods; a bot
that opts into the draws webhook capability overrides onDrawDecision(DrawDecisionContext). A bot
that opts into the doubling capability overrides onDoubleOpportunity(DoubleOpportunityContext) and/or
onDoubleDecision(DoubleDecisionContext).
A CustomHandlerServer can invoke one strategy concurrently for different games.
Implementations that keep mutable state must therefore provide their own synchronization.
-
Method Summary
Modifier and TypeMethodDescriptiondefault DoubleResponseActiononDoubleDecision(DoubleDecisionContext context) Decides whether to accept or decline an opponent's pending stake double offer.default DoubleOfferActionDecides whether to offer a stake double before rolling on this bot's turn.default DrawActiononDrawDecision(DrawDecisionContext context) Decides whether to accept an opponent's pending draw offer.onTurn(TurnContext context) Chooses the complete turn and whether to offer a draw.
-
Method Details
-
onTurn
Chooses the complete turn and whether to offer a draw.- Parameters:
context- the authenticated turn context- Returns:
- the turn action; never
null
-
onDrawDecision
Decides whether to accept an opponent's pending draw offer.The default explicitly declines, so adding the
drawscapability without an override never accepts a draw accidentally.- Parameters:
context- the authenticated, pre-roll draw-decision context- Returns:
- the draw action; never
null
-
onDoubleOpportunity
Decides whether to offer a stake double before rolling on this bot's turn.The default explicitly proceeds to roll without offering a double, so adding the
doublingcapability without an override never offers a double accidentally.- Parameters:
context- the authenticated, pre-roll double-opportunity context- Returns:
- the double offer action; never
null
-
onDoubleDecision
Decides whether to accept or decline an opponent's pending stake double offer.The default explicitly declines, so adding the
doublingcapability without an override never accepts a double accidentally.- Parameters:
context- the authenticated, pre-roll double-decision context- Returns:
- the double response action; never
null
-