mwg API
    Preparing search index...

    Class Suggester

    Wraps a decision function as a throttled, non-mutating hint source.

    import { Suggester } from '@datamoc/mwg/ai';
    import type { AIDecision, AIDecisionInput } from '@datamoc/mwg/ai';

    declare const module: { decide(agent: string, input: AIDecisionInput): AIDecision };
    declare const input: AIDecisionInput;
    const hints = new Suggester((perception) => module.decide('player', perception), { every: 30 });
    const fresh = hints.update(input); // null on the 29 throttled frames between hints
    const current = hints.latest; // never null between updates
    Index
    • Drops the held suggestion: a scene change, a menu opened, a turn ended.

      Returns void

    • Runs the decider on its turn and returns the fresh suggestion; null on the throttled calls between, where latest keeps the previous suggestion. A decision with status idle (nothing to suggest) is still a suggestion: the UI reads decision.action.

      Parameters

      Returns AI.AIDecision | null