mwg API
    Preparing search index...

    Function advanceToInput

    • Advance automatic actions with an explicit work budget. Input actors are never spent. Rules own actor removal and queue replacement. A returned cost is charged after act(), even if that action ends the game; return null when the action already handled its cost. Reaching the budget returns limit without another peek or action. The caller decides whether to resume, report a stalled simulation, or yield to its host.

      Type Parameters

      • Actor

      Parameters

      Returns TurnResult<Actor>

      import { advanceToInput, type TurnRules } from '@datamoc/mw_games/simulation';

      declare const rules: TurnRules<{ id: string; isPlayer: boolean }>;

      // runs monster turns automatically, stopping the moment the player needs to act
      const result = advanceToInput(rules, 1000);
      if (result.status === 'input') console.log('waiting on', result.actor.id);