Ticker

model.Ticker
See theTicker companion object
case class Ticker(currentTick: Double, targetFramerate: Double, slotInterval: Double, rouletteInterval: Double, blackjackInterval: Double, spawnInterval: Double)

Manages timing and scheduling for different simulation events and game types.

The Ticker provides a centralized timing system that coordinates when different game types should process rounds and when customer spawning should occur. It converts time intervals specified in seconds to tick-based scheduling using the target framerate, ensuring consistent timing regardless of actual frame rates.

Each game type can have its own update frequency, allowing for realistic timing where slot machines might update more frequently than roulette games, which take longer to complete a round in real casinos.

Value parameters

blackjackInterval

time in seconds between blackjack rounds

currentTick

the current simulation tick counter

rouletteInterval

time in seconds between roulette rounds

slotInterval

time in seconds between slot machine rounds

spawnInterval

time in seconds between customer spawning events

targetFramerate

the desired frames per second for the simulation

Attributes

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

Members list

Value members

Concrete methods

def blackjackTick: Double

Calculates the tick interval for blackjack updates.

Calculates the tick interval for blackjack updates.

Attributes

Returns

number of ticks between blackjack rounds

def isGameReady(gameType: GameType): Boolean

Checks if a specific game type is ready to process its next round.

Checks if a specific game type is ready to process its next round.

Uses modulo arithmetic to determine if the current tick aligns with the game's scheduled update interval. This ensures games update at their intended frequencies regardless of the overall simulation speed.

Value parameters

gameType

the type of game to check

Attributes

Returns

true if the game should process a round on this tick

def isReadyToSpawn: Boolean

Checks if the simulation is ready to spawn new customers.

Checks if the simulation is ready to spawn new customers.

Attributes

Returns

true if customers should be spawned on this tick

def rouletteTick: Double

Calculates the tick interval for roulette updates.

Calculates the tick interval for roulette updates.

Attributes

Returns

number of ticks between roulette rounds

def slotTick: Double

Calculates the tick interval for slot machine updates.

Calculates the tick interval for slot machine updates.

Attributes

Returns

number of ticks between slot machine rounds

def spawnTick: Double

Calculates the tick interval for customer spawning.

Calculates the tick interval for customer spawning.

Attributes

Returns

number of ticks between spawning events

def update(): Ticker

Advances the ticker by one simulation tick.

Advances the ticker by one simulation tick.

Attributes

Returns

new Ticker instance with incremented tick counter

def withCurrentTick(currentTick: Double): Ticker

Creates a new Ticker with a specific current tick value.

Creates a new Ticker with a specific current tick value.

Useful for resetting the simulation time or jumping to a specific point in the simulation timeline.

Value parameters

currentTick

the new current tick value

Attributes

Returns

new Ticker instance with updated tick counter

def withFramerate(newFramerate: Double): Ticker

Creates a new Ticker with an updated target framerate.

Creates a new Ticker with an updated target framerate.

Changing the framerate affects all tick calculations, allowing for dynamic adjustment of simulation speed while maintaining consistent timing relationships between different game types.

Value parameters

newFramerate

the new target frames per second

Attributes

Returns

new Ticker instance with updated framerate

def withSpawnTick(noTicks: Double): Ticker

Creates a new Ticker with updated spawn timing.

Creates a new Ticker with updated spawn timing.

Allows dynamic adjustment of customer spawning frequency by specifying the desired number of ticks between spawn events.

Value parameters

noTicks

the desired number of ticks between spawning events

Attributes

Returns

new Ticker instance with updated spawn interval

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product