HasBetStrategy

model.entities.customers.HasBetStrategy

Defines a contract for entities that possess a betting strategy.

This trait facilitates the integration of dynamic betting behaviors into entities that manage their own bankroll and customer state. It ensures that such entities can place bets, update their strategy based on outcomes, and change strategies.

Type parameters

T

The concrete type of the entity that extends this trait. It must also have Bankroll, CustomerState, and be able to provide a new instance with a changed betting strategy.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Customer
Self type
T

Members list

Value members

Abstract methods

def withBetStrategy(newStrat: BettingStrategy[T]): T

Abstract method to be implemented by concrete entities. It provides a way to return a new instance of the entity with an updated betting strategy, typically implemented using case class's copy method.

Abstract method to be implemented by concrete entities. It provides a way to return a new instance of the entity with an updated betting strategy, typically implemented using case class's copy method.

Value parameters

newStrat

The new BettingStrategy to be set.

Attributes

Returns

A new instance of the entity with the new strategy.

Concrete methods

def changeBetStrategy(newStrat: BettingStrategy[T]): T

Changes the entity's current betting strategy to a new one.

Changes the entity's current betting strategy to a new one.

Value parameters

newStrat

The new BettingStrategy to adopt.

Attributes

Returns

A new instance of the entity with the changed betting strategy.

def placeBet(): Bet

Delegates the bet placement to the current betting strategy. The current entity instance is passed as context to the strategy.

Delegates the bet placement to the current betting strategy. The current entity instance is passed as context to the strategy.

Attributes

Returns

A Bet object representing the placed bet.

def updateAfter(result: Double): T

Updates the entity's betting strategy based on the outcome of a game round. The current strategy's updateAfter method is called, and the entity is returned with the updated strategy (maintaining immutability).

Updates the entity's betting strategy based on the outcome of a game round. The current strategy's updateAfter method is called, and the entity is returned with the updated strategy (maintaining immutability).

Value parameters

result

The outcome of the game round (e.g., money won/lost, 0 for push).

Attributes

Returns

A new instance of the entity with the updated betting strategy.

Abstract fields