model.entities.games

Members list

Type members

Classlikes

trait Bet

Base trait for all betting operations in casino games.

Base trait for all betting operations in casino games.

Defines the common interface that all bet types must implement, ensuring every bet has an associated monetary amount.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class BlackJackBet
class RouletteBet
class SlotBet
case class BlackJackBet(amount: Double, minimumValue: Int) extends Bet

Represents a bet placed on a blackjack game with a minimum hand value strategy.

Represents a bet placed on a blackjack game with a minimum hand value strategy.

BlackJack bets include a minimum value parameter that likely represents the minimum hand value the player is aiming to achieve or stand on.

Value parameters

amount

the monetary amount being wagered

minimumValue

the minimum card value threshold for the betting strategy

Attributes

Throws
IllegalArgumentException

if minimumValue is not positive

Supertypes
trait Serializable
trait Product
trait Equals
trait Bet
class Object
trait Matchable
class Any
Show all
case class BlackJackGame(id: String, position: Vector2D, gameState: GameState, gameHistory: GameHistory, lastRoundHasPlayed: Boolean) extends Game

Implementation of a blackjack game.

Implementation of a blackjack game.

Blackjack supports up to 7 players and uses a minimum value strategy for decision making. Uses BlackJackStrategy for game logic.

Value parameters

gameHistory

historical record of gains and losses

gameState

current player state and capacity

id

unique identifier for this blackjack game

position

2D coordinates in the simulation space

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Game
trait Entity
trait Collidable
trait Positioned
trait Sized
class Object
trait Matchable
class Any
Show all

Factory object for creating blackjack strategy builders.

Factory object for creating blackjack strategy builders.

Provides a convenient entry point for constructing blackjack betting strategies using the builder pattern.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
case class BlackJackStrategyBuilder(betAmount: Option[Double], minimumVal: Option[Int], condition: Option[() => Boolean])

Builder for constructing blackjack betting strategies.

Builder for constructing blackjack betting strategies.

Uses the builder pattern to configure bet amounts, minimum hand values, and conditions before creating the final strategy instance.

Value parameters

betAmount

optional bet amount (defaults to 0.5 if not specified)

condition

optional execution condition function

minimumVal

optional minimum hand value threshold (defaults to 17 if not specified)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class BlackJackStrategyInstance(betAmount: Double, minimumValue: Int, condition: () => Boolean) extends GameStrategy

Executable blackjack strategy instance.

Executable blackjack strategy instance.

Implements simplified blackjack logic where both dealer and player draw cards until reaching their respective thresholds. Player wins if dealer busts (>21) or if player has higher value ≤21. Blackjack (21) pays 3x, other wins pay 2x.

Value parameters

betAmount

the amount being wagered

condition

function determining if the strategy should execute

minimumValue

the minimum hand value the player will accept

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait GameStrategy
class Object
trait Matchable
class Any
Show all
object Blackjack extends GameType

Game type representing blackjack games

Game type representing blackjack games

Attributes

Supertypes
trait GameType
class Object
trait Matchable
class Any
Self type
Blackjack.type
class Gain(from: String, of: Double)

Represents a single monetary gain or loss record for a specific customer.

Represents a single monetary gain or loss record for a specific customer.

Encapsulates the result of a game round, tracking which customer participated and the monetary outcome. Positive values represent gains (winnings) while negative values represent losses.

Value parameters

from

the unique identifier of the customer who played

of

the monetary amount gained (positive) or lost (negative)

Attributes

Supertypes
class Object
trait Matchable
class Any
trait Game(val id: String, val position: Vector2D, val gameState: GameState, val gameHistory: GameHistory, val lastRoundHasPlayed: Boolean) extends CollidableEntity

Abstract base trait for all casino games in the simulation.

Abstract base trait for all casino games in the simulation.

Represents a game entity that can be positioned in 2D space, maintains player state, tracks game history, and supports collision detection. Games can be locked/unlocked by players and process bets according to their specific game rules.

Value parameters

gameHistory

historical record of all gains and losses

gameState

current state including players and capacity

id

unique identifier for the game instance

position

2D coordinates of the game in the simulation space

Attributes

Supertypes
trait Entity
trait Collidable
trait Positioned
trait Sized
class Object
trait Matchable
class Any
Show all
Known subtypes
object GameBuilder

Factory object for creating game instances with default configurations.

Factory object for creating game instances with default configurations.

Provides convenient methods to create games with auto-generated IDs and appropriate default settings for player capacity and initial state.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
case class GameHistory(gains: List[Gain])

Maintains the complete history of all gains and losses for a game.

Maintains the complete history of all gains and losses for a game.

Tracks all monetary transactions that have occurred during the game's lifetime, providing methods to calculate overall performance and add new entries. The history is immutable - updates create new instances.

Value parameters

gains

chronological list of all gain/loss records

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object GameResolver

Resolves game interactions between customers and games in the simulation.

Resolves game interactions between customers and games in the simulation.

The GameResolver is responsible for processing all active games by identifying playing customers, executing their bets, and updating game histories with the results. It handles the coordination between customer actions and game state updates in each simulation tick.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
case class GameState(currentPlayers: Int, maxAllowedPlayers: Int, playersId: List[String])

Represents the current state of player occupancy for a game.

Represents the current state of player occupancy for a game.

Tracks the number of players currently engaged with a game, enforces capacity limits, and maintains a list of player identifiers. This immutable data structure ensures thread-safe state management and provides methods for adding and removing players with proper validation.

Value parameters

currentPlayers

the number of players currently in the game

maxAllowedPlayers

the maximum capacity of players for this game

playersId

the list of unique identifiers for all current players

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
trait GameStrategy

Base trait for all game strategy implementations.

Base trait for all game strategy implementations.

Defines the common interface that all game strategies must implement to execute betting logic and return results.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait GameType

Marker trait representing different types of casino games.

Marker trait representing different types of casino games.

Used for type-safe identification and categorization of game implementations.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Blackjack
object Roulette
object SlotMachine
object Roulette extends GameType

Game type representing roulette games

Game type representing roulette games

Attributes

Supertypes
trait GameType
class Object
trait Matchable
class Any
Self type
Roulette.type
case class RouletteBet(amount: Double, targets: List[Int]) extends Bet

Represents a bet placed on a roulette game with specific number targets.

Represents a bet placed on a roulette game with specific number targets.

Roulette bets allow players to wager on one or more numbers on the wheel. All target numbers must be valid roulette numbers (0-36).

Value parameters

amount

the monetary amount being wagered

targets

the list of roulette numbers (0-36) being bet on

Attributes

Throws
IllegalArgumentException

if any target is outside the valid range (0-36)

Supertypes
trait Serializable
trait Product
trait Equals
trait Bet
class Object
trait Matchable
class Any
Show all
case class RouletteGame(id: String, position: Vector2D, gameState: GameState, gameHistory: GameHistory, lastRoundHasPlayed: Boolean) extends Game

Implementation of a roulette game.

Implementation of a roulette game.

Roulette allows up to 6 players to bet on numbers 0-36. Uses RouletteStrategy for game logic and bet processing.

Value parameters

gameHistory

historical record of gains and losses

gameState

current player state and capacity

id

unique identifier for this roulette game

position

2D coordinates in the simulation space

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Game
trait Entity
trait Collidable
trait Positioned
trait Sized
class Object
trait Matchable
class Any
Show all

Factory object for creating roulette strategy builders.

Factory object for creating roulette strategy builders.

Provides a convenient entry point for constructing roulette betting strategies using the builder pattern.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
case class RouletteStrategyBuilder(betAmount: Option[Double], targets: Option[List[Int]])

Builder for constructing roulette betting strategies.

Builder for constructing roulette betting strategies.

Uses the builder pattern to configure bet amounts, target numbers, and conditions before creating the final strategy instance.

Value parameters

betAmount

optional bet amount (defaults to 0.5 if not specified)

targets

optional list of target numbers (defaults to List(0) if not specified)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class RouletteStrategyInstance(betAmount: Double, targets: List[Int], condition: () => Boolean) extends GameStrategy

Executable roulette strategy instance.

Executable roulette strategy instance.

Implements roulette logic with a 37-number wheel (0-36). Winning pays based on the number of targets bet on: payout = betAmount * 37 / targets.size.

Value parameters

betAmount

the amount being wagered

condition

function determining if the strategy should execute

targets

the list of numbers being bet on

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait GameStrategy
class Object
trait Matchable
class Any
Show all
case class SlotBet(amount: Double) extends Bet

Represents a bet placed on a slot machine game.

Represents a bet placed on a slot machine game.

Slot bets are simple wagers with only an amount, as slot machines typically don't require additional betting parameters.

Value parameters

amount

the monetary amount being wagered

Attributes

Throws
IllegalArgumentException

if amount is not positive

Supertypes
trait Serializable
trait Product
trait Equals
trait Bet
class Object
trait Matchable
class Any
Show all
object SlotMachine extends GameType

Game type representing slot machine games

Game type representing slot machine games

Attributes

Supertypes
trait GameType
class Object
trait Matchable
class Any
Self type
case class SlotMachineGame(id: String, position: Vector2D, gameState: GameState, gameHistory: GameHistory, lastRoundHasPlayed: Boolean) extends Game

Implementation of a slot machine game.

Implementation of a slot machine game.

Slot machines are single-player games that accept simple monetary bets. Uses SlotStrategy for game logic and payout calculations.

Value parameters

gameHistory

historical record of gains and losses

gameState

current player state (max 1 player)

id

unique identifier for this slot machine

position

2D coordinates in the simulation space

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Game
trait Entity
trait Collidable
trait Positioned
trait Sized
class Object
trait Matchable
class Any
Show all
object SlotStrategy

Executes the strategy and returns the betting result.

Executes the strategy and returns the betting result.

Attributes

Returns

BetResult indicating win (Success) or loss (Failure) with monetary amounts

Supertypes
class Object
trait Matchable
class Any
Self type
case class SlotStrategyBuilder(betAmount: Option[Double], condition: Option[() => Boolean])

Builder for constructing slot machine betting strategies.

Builder for constructing slot machine betting strategies.

Uses the builder pattern to configure bet amounts and conditions before creating the final strategy instance.

Value parameters

betAmount

optional bet amount (defaults to 0.5 if not specified)

condition

optional execution condition function

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class SlotStrategyInstance(betAmount: Double, condition: () => Boolean) extends GameStrategy

Executable slot machine strategy instance.

Executable slot machine strategy instance.

Implements slot machine logic where winning requires all 5 generated numbers to be identical. Winning pays 10x the bet amount.

Value parameters

betAmount

the amount being wagered

condition

function determining if the strategy should execute

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait GameStrategy
class Object
trait Matchable
class Any
Show all
object dsl

Domain Specific Language (DSL) for game strategy creation.

Domain Specific Language (DSL) for game strategy creation.

Provides a fluent, readable interface for constructing game strategies using a natural language-like syntax. The DSL abstracts the direct factory method calls and enables more expressive code when building betting strategies.

Example usage:

val strategy = use(SlotStrategy).bet(10.0).when(true)
val rouletteStrategy = use(RouletteStrategy).bet(5.0).on(List(1, 2, 3)).when(true)
val blackjackStrategy = use(BlackJackStrategy).bet(20.0).accept(18).when(true)

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
dsl.type

Types

type BetResult = Result[Double, Double]

Type alias representing the result of a bet operation.

Type alias representing the result of a bet operation.

Uses the Result type to handle both successful wins (with Double payout) and losses (with Double loss amount).

Attributes

Value members

Concrete fields

Game's types present in the current implementation

Game's types present in the current implementation

Attributes