refactor: delete solitaire_data::solver wrapper; solve via card_game directly
Remove the standalone solver wrapper module. Its thin shaping — build a solve-budgeted Session, run card_game::Session::solve(), extract the first useful move — moves onto the domain type in solitaire_core as GameState::solve_first_move() / GameState::solve_fresh_deal(), with the budget consts and the SolveOutcome alias re-exported from solitaire_core. Solving is deterministic, IO-free game logic, so core (which already owns GameState and exposes session().solve()) is its correct home; solitaire_data is the persistence/sync layer and never should have owned it. Consumers now call the core API directly: - engine: pending_hint (solve_first_move), game_plugin + play_by_seed_plugin (solve_fresh_deal), input_plugin (budget consts) - assetgen: gen_seeds + gen_difficulty_seeds (solve_fresh_deal) The solver tests move to solitaire_core. cargo test --workspace and clippy --workspace --all-targets -- -D warnings both green. Resolves the "delete the solver" directive — card_game provides the solver. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -26,7 +26,6 @@ use bevy::prelude::*;
|
||||
use bevy::tasks::{AsyncComputeTaskPool, Task, futures_lite::future};
|
||||
use solitaire_core::KlondikeInstruction;
|
||||
use solitaire_core::game_state::GameState;
|
||||
use solitaire_data::solver::try_solve_from_state;
|
||||
|
||||
use crate::card_plugin::CardEntity;
|
||||
use crate::events::{HintVisualEvent, InfoToastEvent, StateChangedEvent};
|
||||
@@ -66,7 +65,7 @@ impl PendingHintTask {
|
||||
// Winnable (`Ok(Some)`) carries the first move on a winning path;
|
||||
// unwinnable (`Ok(None)`) and inconclusive (`Err`) both fall back
|
||||
// to the live-state heuristic so H always produces feedback.
|
||||
match try_solve_from_state(&state, moves_budget, states_budget) {
|
||||
match state.solve_first_move(moves_budget, states_budget) {
|
||||
Ok(Some(first_move)) => HintTaskOutput::SolverMove(first_move),
|
||||
Ok(None) | Err(_) => HintTaskOutput::NeedsHeuristic,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user