RouletteGame

model.entities.games.RouletteGame
case class RouletteGame(id: String, position: Vector2D, gameState: GameState, gameHistory: GameHistory, lastRoundHasPlayed: Boolean) extends 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

Graph
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

Members list

Value members

Concrete methods

override def gameType: GameType

Returns the specific type of this game

Returns the specific type of this game

Attributes

Definition Classes
override def play[B <: Bet](bet: B): Result[BetResult, String]

Processes a bet according to the game's rules.

Processes a bet according to the game's rules.

Value parameters

bet

the bet to be processed, must match the game's expected bet type

Attributes

Returns

Success with BetResult if bet is valid, Failure with error message otherwise

Definition Classes

Inherited methods

def bankroll: Double

Returns the total bankroll (cumulative gains) for this game

Returns the total bankroll (cumulative gains) for this game

Attributes

Inherited from:
Game

Returns the bottom-left corner coordinates of this entity.

Returns the bottom-left corner coordinates of this entity.

Attributes

Returns

the position vector representing the bottom-left corner

Inherited from:
Collidable

Returns the bottom-right corner coordinates of this entity.

Returns the bottom-right corner coordinates of this entity.

Attributes

Returns

the position vector representing the bottom-right corner

Inherited from:
Collidable

Returns the center point of this entity's bounding rectangle.

Returns the center point of this entity's bounding rectangle.

Attributes

Returns

the position vector representing the geometric center

Inherited from:
Collidable
final def collidesWith[E <: Positioned](other: E): Boolean

Checks if this entity collides with another positioned entity.

Checks if this entity collides with another positioned entity.

Performs axis-aligned bounding box collision detection by checking for overlap on both horizontal and vertical axes. Both overlaps must be true for a collision to be detected.

Value parameters

other

the other positioned entity to check collision against

Attributes

Returns

true if the entities' bounding boxes overlap

Inherited from:
Collidable
final def contains(point: Vector2D): Boolean

Checks if a point is contained within this entity's bounds.

Checks if a point is contained within this entity's bounds.

Uses inclusive bounds checking on the left and top edges, and exclusive on the right and bottom edges to prevent edge overlap issues.

Value parameters

point

the 2D point to test for containment

Attributes

Returns

true if the point is within this entity's rectangular bounds

Inherited from:
Collidable

Returns the gains from the most recent round for current players

Returns the gains from the most recent round for current players

Attributes

Inherited from:
Game
def isFull: Boolean

Returns true if the game has reached its maximum player capacity

Returns true if the game has reached its maximum player capacity

Attributes

Inherited from:
Game
def lock(id: String): Result[Game, Game]

Attempts to lock the game for a specific player.

Attempts to lock the game for a specific player.

Value parameters

id

the player's unique identifier

Attributes

Returns

Success with updated game if lock successful, Failure with unchanged game otherwise

Inherited from:
Game
def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product
def setPlaying(isPlaying: Boolean): Game

Attributes

Inherited from:
Game

Returns the top-left corner coordinates of this entity.

Returns the top-left corner coordinates of this entity.

Attributes

Returns

the position vector representing the top-left corner

Inherited from:
Collidable

Returns the top-right corner coordinates of this entity.

Returns the top-right corner coordinates of this entity.

Attributes

Returns

the position vector representing the top-right corner

Inherited from:
Collidable
def unlock(id: String): Result[Game, Game]

Attempts to unlock the game for a specific player.

Attempts to unlock the game for a specific player.

Value parameters

id

the player's unique identifier

Attributes

Returns

Success with updated game if unlock successful, Failure with unchanged game otherwise

Inherited from:
Game
def updateHistory(customerId: String, gain: Double): Game

Updates the game history with a new gain/loss entry for a customer.

Updates the game history with a new gain/loss entry for a customer.

Value parameters

customerId

the customer's unique identifier

gain

the monetary gain (positive) or loss (negative)

Attributes

Returns

new game instance with updated history

Inherited from:
Game
def vertices: Seq[Vector2D]

Returns all four corner vertices of this entity's bounding rectangle.

Returns all four corner vertices of this entity's bounding rectangle.

Attributes

Returns

sequence containing topLeft, topRight, bottomLeft, and bottomRight vertices

Inherited from:
Collidable

Concrete fields

override val height: Double
override val width: Double