Remove score_history from GameState #86

Closed
opened 2026-06-11 03:15:41 +00:00 by Quaternions · 1 comment

score_history: Vec is vestigial. Undo penalty is correctly tracked in the upstream SessionStats type.

score_history: Vec<i32> is vestigial. Undo penalty is correctly tracked in the upstream SessionStats type.
Owner

Resolved in commit 372b642.

score_history: Vec<i32> is removed, along with its sibling is_recycle_history. These existed as an undo journal for the old hand-rolled score, which was path-dependent (clamped to >=0 at every step) and therefore could not be reconstructed from the move history — the journal was the only way undo() could restore the pre-move score.

With scoring delegated to the upstream session, undo() restores the board via session.undo() and the score is re-derived from session.stats(), so the journal is no longer needed.

Caveat worth recording: upstream does NOT roll back the inner stat counts on undo (it only restores the board + increments undos). A live game's score and the same game reloaded from disk can therefore differ once undos are involved, because the saved forward history excludes undone moves. Accepted as part of the migration.

Resolved in commit 372b642. `score_history: Vec<i32>` is removed, along with its sibling `is_recycle_history`. These existed as an *undo journal* for the old hand-rolled score, which was path-dependent (clamped to >=0 at every step) and therefore could not be reconstructed from the move history — the journal was the only way `undo()` could restore the pre-move score. With scoring delegated to the upstream session, `undo()` restores the board via `session.undo()` and the score is re-derived from `session.stats()`, so the journal is no longer needed. Caveat worth recording: upstream does NOT roll back the inner stat counts on undo (it only restores the board + increments `undos`). A live game's score and the same game reloaded from disk can therefore differ once undos are involved, because the saved forward history excludes undone moves. Accepted as part of the migration.
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/Ferrous-Solitaire#86