Class SlotEngine

java.lang.Object
com.csse3200.game.components.slot.SlotEngine

public class SlotEngine extends Object
Slot machine engine to generate random outcomes for UI and trigger corresponding effects.

Flow: 1) Roll trigger (default 80%). 2) If triggered, pick an event by weights and return triple reels of that event id. Otherwise, return a non-triple reels array. 3) Effect handling

* Output for UI: * - SpinResult#getReels(): int[3] of ids in [0..7] * - SpinResult#isEffectTriggered(): boolean * - SpinResult#getEffect(): Optional<Effect>

  • Constructor Details

    • SlotEngine

      public SlotEngine()
      Construct with default config and RNG.
    • SlotEngine

      public SlotEngine(SlotEngine.SlotConfig config, Random random)
      Construct with injected config and RNG.
    • SlotEngine

      public SlotEngine(SlotMachineArea area)
  • Method Details

    • setSlotMachineArea

      public void setSlotMachineArea(SlotMachineArea area)
    • spin

      public SlotEngine.SpinResult spin()
      Perform one spin: - If triggered: return triple reels and call effect. - If not triggered: return non-triple reels with NONE.
      Returns:
      SpinResult consumable by UI.
    • applyEffect

      public void applyEffect(SlotEngine.SpinResult res)