BettingStrategy

model.entities.customers.BettingStrategy
trait BettingStrategy[A <: Bankroll[A] & CustomerState[A]]

Defines the common interface and properties for all betting strategies.

Betting strategies are responsible for determining the bet amount and options, and for updating their internal state based on game outcomes.

Type parameters

A

The type of the entity (customer) that uses this strategy. It must have Bankroll and CustomerState capabilities.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class FlatBetting[A]
class MartingaleStrat[A]
class OscarGrindStrat[A]

Members list

Value members

Abstract methods

Returns the type of this betting strategy.

Returns the type of this betting strategy.

Attributes

Returns

The BetStratType for this strategy.

def placeBet(ctx: A): Bet

Generates a game-specific Bet object based on the strategy's current state and the customer's context.

Generates a game-specific Bet object based on the strategy's current state and the customer's context.

Value parameters

ctx

The customer entity's context.

Attributes

Returns

A Bet object ready to be placed in a game.

def updateAfter(ctx: A, result: Double): BettingStrategy[A]

Updates the internal state of the betting strategy based on the previous game round's result. This method typically returns a new instance of the strategy with updated parameters (e.g., for progressive strategies like Martingale).

Updates the internal state of the betting strategy based on the previous game round's result. This method typically returns a new instance of the strategy with updated parameters (e.g., for progressive strategies like Martingale).

Value parameters

ctx

The customer entity's context (can be used for contextual updates).

result

The outcome of the game round (positive for win, negative for loss, 0 for push).

Attributes

Returns

A new instance of the BettingStrategy with its state updated.

Concrete methods

protected def checkRequirement(ctx: A): Unit

Checks preconditions before placing a bet. Throws a require error if the bet amount exceeds bankroll or if the customer is not in a Playing state.

Checks preconditions before placing a bet. Throws a require error if the bet amount exceeds bankroll or if the customer is not in a Playing state.

Value parameters

ctx

The customer entity's context.

Attributes

Abstract fields

val betAmount: Double
val option: List[Int]