mwg API
    Preparing search index...

    Class TrainingEnvironment<State, Command, Event>

    Seeded, UI-free reset/step adapter over a game's existing SimulationRule. Observations and rewards use a fixed agent roster within each episode. A null action is legal only when all actions for that agent are masked. The rule owns idle semantics. No presentation events or command journal are retained.

    import { TrainingEnvironment } from '@datamoc/mwg/simulation';
    const env = new TrainingEnvironment({ observationVersion: 'counter-v1',
    initial: () => ({ x: 0 }), observe: s => [{ input: [s.x], mask: [true] }],
    command: (_s, actions) => actions[0],
    rule: s => ({ state: { x: s.x + 1 }, events: [], status: 'ready' }),
    rewards: () => [1],
    }, { maxSteps: 10 });
    env.reset(7);
    const frame = env.step([0]);
    const checkpoint = env.snapshot();
    env.restore(checkpoint); // resumes state and RNG, without replaying reset

    Type Parameters

    • State
    • Command
    • Event
    Index
    maxSteps: number
    observationVersion: string