engine!: remove the dead reconstructState export

Its only consumer was the wrapper's Undo handling, deleted when the
tentative-turn model replaced destructive undo; nothing in the engine or
the viewer sources references it anymore (full replays go through
wrapper.replay). Removing a public API is fine for the 2.0.0 major.
This commit is contained in:
coyotte508 2026-08-16 21:31:01 +00:00
commit 511ce1728a
2 changed files with 2 additions and 25 deletions

View file

@ -1,5 +1,5 @@
export { availableMoves, AvailableMoves } from './src/available-moves';
export { currentPlayers, ended, move, moveAI, reconstructState, setup, stripSecret } from './src/engine';
export { currentPlayers, ended, move, moveAI, setup, stripSecret } from './src/engine';
export { Phase } from './src/gamestate';
export type { GameState, Player, PointCard } from './src/gamestate';
export { GameEventName, LogItem } from './src/log';

View file

@ -1,5 +1,5 @@
import assert from 'assert';
import { chunk, cloneDeep, groupBy, isEqual, range, zip } from 'lodash';
import { chunk, groupBy, isEqual, range, zip } from 'lodash';
import seedrandom from 'seedrandom';
import { availableMoves } from './available-moves';
import pointCards from './cards';
@ -882,29 +882,6 @@ export function scores(G: GameState): number[] {
return ended(G) ? G.players.map((p) => p.money) : G.players.map((_) => 0);
}
export function reconstructState(initialState: GameState, log: LogItem[]): GameState {
const G = cloneDeep(initialState);
for (const item of log) {
switch (item.type) {
case 'event': {
break;
}
case 'phase': {
break;
}
case 'move': {
move(G, item.move, item.player);
break;
}
}
}
return G;
}
function playerBefore(player: Player, G: GameState) {
return player.id === 0 ? G.players[G.players.length - 1] : G.players[player.id - 1];
}