refactor(core): derive score/undo/recycle from upstream session stats
Replace the bespoke WXP scoring engine with the upstream card_game/klondike session stats, eliminating duplicated state that could drift from the single source of truth. score()/undo_count()/recycle_count() now read session.stats(); the -15 undo penalty is configured as SessionConfig::undo_penalty and applied by the upstream score formula. Save schema bumped v4 -> v5 (the three counters are no longer persisted -- they are rebuilt by replaying the forward instruction history on load). - Remove GameState fields score, undo_count, recycle_count (#87) - Remove score_history / is_recycle_history undo journal (#86) - Remove KlondikeAdapter::apply_undo_score and the score_for_* helpers, plus pre_instruction_score_delta / will_flip_tableau_source (#84) These three issues are a single atomic change: each removed field/helper is consumed by the same draw/apply_instruction/undo/serde/PartialEq paths, so they cannot compile or pass tests in isolation. Behaviour changes (intentional): the escalating recycle penalty and per-step score floor are gone (upstream linear scoring, floored once at 0); recycle_count is now cumulative; undo_count resets across save/load. Refs #84, #86, #87 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -920,7 +920,7 @@ fn handle_move(
|
||||
changed.write(StateChangedEvent);
|
||||
if !was_won && game.0.is_won() {
|
||||
won.write(GameWonEvent {
|
||||
score: game.0.score,
|
||||
score: game.0.score(),
|
||||
time_seconds: game.0.elapsed_seconds,
|
||||
});
|
||||
// Delete the saved state — a won game should not be resumed.
|
||||
@@ -1117,7 +1117,7 @@ fn check_no_moves(
|
||||
// Only spawn the overlay if one does not already exist, and no other
|
||||
// modal scrim is currently open (global ModalScrim guard).
|
||||
if game_over_screens.is_empty() && scrims.is_empty() {
|
||||
spawn_game_over_screen(&mut commands, game.0.score, font_res.as_deref());
|
||||
spawn_game_over_screen(&mut commands, game.0.score(), font_res.as_deref());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user