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.

@FunctionalInterface public interface BotStrategy
Decision-oriented strategy contract for a DiceChess webhook bot.

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 Details

    • onTurn

      TurnAction onTurn(TurnContext context)
      Chooses the complete turn and whether to offer a draw.
      Parameters:
      context - the authenticated turn context
      Returns:
      the turn action; never null
    • onDrawDecision

      default DrawAction onDrawDecision(DrawDecisionContext context)
      Decides whether to accept an opponent's pending draw offer.

      The default explicitly declines, so adding the draws capability without an override never accepts a draw accidentally.

      Parameters:
      context - the authenticated, pre-roll draw-decision context
      Returns:
      the draw action; never null
    • onDoubleOpportunity

      default DoubleOfferAction onDoubleOpportunity(DoubleOpportunityContext context)
      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 doubling capability 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

      default DoubleResponseAction onDoubleDecision(DoubleDecisionContext context)
      Decides whether to accept or decline an opponent's pending stake double offer.

      The default explicitly declines, so adding the doubling capability without an override never accepts a double accidentally.

      Parameters:
      context - the authenticated, pre-roll double-decision context
      Returns:
      the double response action; never null