Skip to content

checkDeterminism ​

Function of @v12-engine/engine/testing

ts
export declare function checkDeterminism(make: () => World | Promise<World>, options: DeterminismOptions): Promise<DeterminismReport>;

Makes a world twice with make (the same seed, the same commands given in it, as a replay would) and runs them side by side, comparing their fingerprints every tick and their states (and the order each player's entities are filed in) every every ticks; with from, a third is saved at that tick and a fourth loaded from the save, and the two run on side by side. Says, for each, the first tick and thing it differs at, or that it does not. A test of a game's own systems: one that reads Math.random, the clock, or the order of something unordered is found here

const report = await checkDeterminism(() = makeMyGame(1), ticks: 1800, from: 300, rules ) expect(report).toEqual( twice: null, fromSave: null )