Customer

model.entities.customers.Customer
case class Customer(id: String, position: Vector2D, direction: Vector2D, bankroll: Double, startingBankroll: Double, boredom: Double, frustration: Double, riskProfile: RiskProfile, customerState: CustState, betStrategy: BettingStrategy[Customer], favouriteGame: GameType, previousPosition: Option[Vector2D]) extends Entity, MovableWithPrevious[Customer], Bankroll[Customer], BoredomFrustration[Customer], StatusProfile, CustomerState[Customer], HasBetStrategy[Customer], ChangingFavouriteGamePlayer[Customer]

The Customer is an entity which moves around the casino and plays games.

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Player[Customer]
trait Movable[Customer]
trait Positioned
trait Entity
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

override def isPlaying: Boolean

Checks if the customer is currently in the Playing state.

Checks if the customer is currently in the Playing state.

Attributes

Returns

true if the customer is playing a game, false otherwise.

Definition Classes
override def play(game: Game): Customer

Attributes

Definition Classes
def random(): Customer
def randomizePosition(xRange: (Double, Double), yRange: (Double, Double)): Customer
override def stopPlaying: Customer

Attributes

Definition Classes
def withBankroll(newRoll: Double, update: Boolean): Customer

Returns a new instance of the entity with an updated bankroll value. This method must be implemented by concrete classes to ensure immutability.

Returns a new instance of the entity with an updated bankroll value. This method must be implemented by concrete classes to ensure immutability.

Value parameters

newBankroll

The new bankroll value.

update

A boolean flag, often used to differentiate initial setting from an update, though its specific use depends on the implementing class.

Attributes

Returns

A new instance of the entity with the new bankroll.

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.

def withBoredom(newBoredom: Double): Customer

Returns a new instance of the entity with an updated boredom level. This method must be implemented by concrete classes to ensure immutability.

Returns a new instance of the entity with an updated boredom level. This method must be implemented by concrete classes to ensure immutability.

Value parameters

newBoredom

The new boredom level.

Attributes

Returns

A new instance of the entity with the new boredom level.

Returns a new instance of the entity with the updated customer state. This method must be implemented by concrete classes to ensure immutability.

Returns a new instance of the entity with the updated customer state. This method must be implemented by concrete classes to ensure immutability.

Value parameters

newState

The new CustState for the customer.

Attributes

Returns

A new instance of the entity with the updated customer state.

def withDirection(newDirection: Vector2D): Customer

Returns a new instance of the entity with an updated direction. This method ensures immutability.

Returns a new instance of the entity with an updated direction. This method ensures immutability.

Value parameters

newDirection

The new direction vector for the entity.

Attributes

Returns

A new instance of the entity with the updated direction.

override def withFavouriteGame(gameType: GameType): Customer

Attributes

Definition Classes
def withFrustration(newFrustration: Double): Customer

Returns a new instance of the entity with an updated frustration level. This method must be implemented by concrete classes to ensure immutability.

Returns a new instance of the entity with an updated frustration level. This method must be implemented by concrete classes to ensure immutability.

Value parameters

newFrustration

The new frustration level.

Attributes

Returns

A new instance of the entity with the new frustration level.

def withId(newId: String): Customer
def withPosition(newPosition: Vector2D): Customer

Returns a new instance of the entity with an updated position. This method ensures immutability.

Returns a new instance of the entity with an updated position. This method ensures immutability.

Value parameters

newPosition

The new position for the entity.

Attributes

Returns

A new instance of the entity with the updated position.

Inherited methods

def addedDirection(addingDirection: Vector2D): Customer

Returns a new instance of the entity with its direction updated by adding a given vector to the current direction.

Returns a new instance of the entity with its direction updated by adding a given vector to the current direction.

Value parameters

addingDirection

The vector to add to the current direction.

Attributes

Returns

A new instance of the entity with the added direction.

Inherited from:
Movable
def bankrollRatio: Double

Calculates the ratio of the current bankroll to the starting bankroll. This is useful for tracking profit/loss relative to the initial investment.

Calculates the ratio of the current bankroll to the starting bankroll. This is useful for tracking profit/loss relative to the initial investment.

Attributes

Returns

The bankroll ratio (current bankroll / starting bankroll).

Inherited from:
Bankroll

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.

Inherited from:
HasBetStrategy
def changeState(newState: CustState): Customer

Changes the customer's state to a new specified state. This is a convenience method that delegates to withCustomerState.

Changes the customer's state to a new specified state. This is a convenience method that delegates to withCustomerState.

Value parameters

newState

The new CustState to apply.

Attributes

Returns

A new instance of the entity with the updated customer state.

Inherited from:
CustomerState
def getGameOrElse: Option[Game]

Returns an Option containing the Game object if the customer is currently Playing, otherwise returns Option.empty.

Returns an Option containing the Game object if the customer is currently Playing, otherwise returns Option.empty.

Attributes

Returns

An Option[Game] representing the game the customer is playing, if any.

Inherited from:
CustomerState
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.

Inherited from:
HasBetStrategy
def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product
def updateAfter(result: Double): Customer

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.

Inherited from:
HasBetStrategy
def updateBankroll(netValue: Double): Customer

Updates the entity's bankroll by adding a netValue. The netValue can be positive (gain) or negative (loss). A requirement ensures the bankroll does not drop below zero.

Updates the entity's bankroll by adding a netValue. The netValue can be positive (gain) or negative (loss). A requirement ensures the bankroll does not drop below zero.

Value parameters

netValue

The amount to add to the current bankroll.

Attributes

Returns

A new instance of the entity with the updated bankroll.

Throws
IllegalArgumentException

if the new bankroll would be negative.

Inherited from:
Bankroll
def updateBoredom(boredomGain: Double): Customer

Updates the entity's boredom level by adding a boredomGain. The new boredom level is clamped between 0.0 and 100.0.

Updates the entity's boredom level by adding a boredomGain. The new boredom level is clamped between 0.0 and 100.0.

Value parameters

boredomGain

The amount to add to the current boredom level. Can be positive or negative.

Attributes

Returns

A new instance of the entity with the updated boredom level.

Inherited from:
BoredomFrustration
def updateFrustration(frustrationGain: Double): Customer

Updates the entity's frustration level by adding a frustrationGain. The new frustration level is clamped between 0.0 and 100.0.

Updates the entity's frustration level by adding a frustrationGain. The new frustration level is clamped between 0.0 and 100.0.

Value parameters

frustrationGain

The amount to add to the current frustration level. Can be positive or negative.

Attributes

Returns

A new instance of the entity with the updated frustration level.

Inherited from:
BoredomFrustration