fbsim-core JavaScript & TypeScript API - v1.0.0-beta.2
    Preparing search index...

    Class GameSimulator

    A WASM-friendly wrapper around the core GameSimulator type.

    Provides methods to simulate plays, drives, or full games. Mirrors the Rust GameSimulator API, accepting teams, context, and a mutable game reference as parameters.

    Index

    Constructors

    Methods

    • Returns void

    • Simulates until the current drive is complete.

      Mutates the game in place and returns the updated GameContext.

      Arguments

      • home - The home team
      • away - The away team
      • context - The current game context
      • game - The game log (mutated in place)
      • rng - The random number generator

      Parameters

      Returns GameContext

    • Simulates the next play.

      Mutates the game in place and returns the updated GameContext. Call game.getLatestPlay() to inspect the play that was simulated.

      Arguments

      • home - The home team
      • away - The away team
      • context - The current game context
      • game - The game log (mutated in place)
      • rng - The random number generator

      Parameters

      Returns GameContext