import { TrainingEnvironment, imitationFromReplay } from '@datamoc/mwg/simulation';
declare const env: TrainingEnvironment<{ x: number }, number, never>;
const result = imitationFromReplay(env, {
actions: ['left', 'right'],
events: [{ frame: 0, action: 'right' }],
seed: 7,
});
console.log(result.samples[0].action); // 1: 'right'
Turns a persisted run into imitation targets: walks the recorded actions against the same seeded environment they were played on, and hands back the (observation, action) pairs a game's own trainer fits - the same shape the maze chase example fits, but sourced from how the game's own players played rather than a generated expert.
One recorded event is one environment step, so a turn-based game steps once per action taken; a tick-based game whose rule needs an explicit idle records one, since a frame without an event advances nothing here. The environment must expose exactly one agent (the recorded player); anything else that moves is part of the rule, the way the maze chase's ghosts are. A recorded action outside the list is a named error, not a skipped event: every sample after a skipped one would be off-trajectory.