TriggerDSL

utils.TriggerDSL
object TriggerDSL

Object containing the Domain-Specific Language (DSL) for defining dynamic triggers.

This DSL allows for the creation of clear, readable, and composable conditions used within the simulation's decision-making logic, such as in the DecisionManager.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
TriggerDSL.type

Members list

Type members

Classlikes

trait Trigger[A]

Represents a generic trigger condition.

Represents a generic trigger condition.

A Trigger takes an entity context and evaluates to a boolean, indicating whether the condition is met.

Type parameters

A

The type of the entity (context) on which the trigger evaluates.

Attributes

Supertypes
class Object
trait Matchable
class Any

Value members

Concrete methods

def Always[A]: Trigger[A]

Creates a trigger that always evaluates to true. Useful for default actions or conditions that are always met.

Creates a trigger that always evaluates to true. Useful for default actions or conditions that are always met.

Type parameters

A

The entity type (can be any type as evaluation is constant).

Attributes

Returns

A Trigger instance that always returns true.

def BoredomAbove[A <: BoredomFrustration[LazyRef(...)]](p: Double): Trigger[A]

Creates a trigger that evaluates to true if the entity's boredom level is greater than or equal to 'p'.

Creates a trigger that evaluates to true if the entity's boredom level is greater than or equal to 'p'.

Type parameters

A

The entity type, which must have BoredomFrustration capabilities.

Value parameters

p

The boredom percentage threshold (0.0 - 100.0).

Attributes

Returns

A Trigger instance.

def BrRatioAbove[A <: Bankroll[LazyRef(...)]](r: Double): Trigger[A]

Creates a trigger that evaluates to true if the entity's bankroll ratio (current bankroll / starting bankroll) is greater than or equal to 'r'. This is typically used for "take-profit" conditions.

Creates a trigger that evaluates to true if the entity's bankroll ratio (current bankroll / starting bankroll) is greater than or equal to 'r'. This is typically used for "take-profit" conditions.

Type parameters

A

The entity type, which must have Bankroll capabilities.

Value parameters

r

The bankroll ratio threshold.

Attributes

Returns

A Trigger instance.

def BrRatioBelow[A <: Bankroll[LazyRef(...)]](r: Double): Trigger[A]

Creates a trigger that evaluates to true if the entity's bankroll ratio (current bankroll / starting bankroll) is less than or equal to 'r'. This is typically used for "stop-loss" conditions.

Creates a trigger that evaluates to true if the entity's bankroll ratio (current bankroll / starting bankroll) is less than or equal to 'r'. This is typically used for "stop-loss" conditions.

Type parameters

A

The entity type, which must have Bankroll capabilities.

Value parameters

r

The bankroll ratio threshold.

Attributes

Returns

A Trigger instance.

def FrustAbove[A <: BoredomFrustration[LazyRef(...)]](p: Double): Trigger[A]

Creates a trigger that evaluates to true if the entity's frustration level is greater than or equal to 'p'.

Creates a trigger that evaluates to true if the entity's frustration level is greater than or equal to 'p'.

Type parameters

A

The entity type, which must have BoredomFrustration capabilities.

Value parameters

p

The frustration percentage threshold (0.0 - 100.0).

Attributes

Returns

A Trigger instance.

def Losses[A <: Bankroll[LazyRef(...)] & CustomerState[LazyRef(...)] & HasBetStrategy[LazyRef(...)]](n: Int): Trigger[A]

Creates a trigger that evaluates to true if the entity's loss streak is greater than or equal to 'n'.

Creates a trigger that evaluates to true if the entity's loss streak is greater than or equal to 'n'.

This trigger is specific to entities using Martingale or OscarGrind betting strategies.

Type parameters

A

The entity type, which must have Bankroll, CustomerState, and HasBetStrategy capabilities.

Value parameters

n

The minimum number of losses in a streak to trigger.

Attributes

Returns

A Trigger instance.

Extensions

Extensions

extension [A](a: Trigger[A])
infix def &&(b: Trigger[A]): Trigger[A]

Composes two triggers with a logical AND operation. Both triggers must evaluate to true for the combined trigger to be true.

Composes two triggers with a logical AND operation. Both triggers must evaluate to true for the combined trigger to be true.

Value parameters

b

The right-hand side Trigger.

Attributes

Returns

A new Trigger representing the logical AND.

def unary_!: Trigger[A]

Negates the result of a trigger (logical NOT operation).

Negates the result of a trigger (logical NOT operation).

Attributes

Returns

A new Trigger representing the logical NOT.

infix def ||(b: Trigger[A]): Trigger[A]

Composes two triggers with a logical OR operation. At least one trigger must evaluate to true for the combined trigger to be true.

Composes two triggers with a logical OR operation. At least one trigger must evaluate to true for the combined trigger to be true.

Value parameters

b

The right-hand side Trigger.

Attributes

Returns

A new Trigger representing the logical OR.