From 831b26ed75321093ffd0c844f6a951d1ae5918c6 Mon Sep 17 00:00:00 2001 From: pommicket Date: Mon, 18 Aug 2025 11:25:22 -0400 Subject: Stop process when solve returns moves --- quacker/macondo.cpp | 3 ++- quacker/macondo.h | 1 + quacker/quacker.cpp | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/quacker/macondo.cpp b/quacker/macondo.cpp index a6d5d9d..ef7372b 100644 --- a/quacker/macondo.cpp +++ b/quacker/macondo.cpp @@ -92,8 +92,9 @@ bool Macondo::useForSimulation() const { void Macondo::gotMoves(const Quackle::MoveList &moves) { m_moves = moves; m_anyUpdates = true; - if (moves.size() == 1) + if (m_isSolving && moves.size() > 0) { emit setCandidateMove(&moves[0]); + } } void Macondo::positionChanged(const Quackle::GamePosition *position) { diff --git a/quacker/macondo.h b/quacker/macondo.h index a95a5a7..ede3487 100644 --- a/quacker/macondo.h +++ b/quacker/macondo.h @@ -28,6 +28,7 @@ public: return any; } bool isRunning() const; + bool isSolving() const { return m_isSolving; } signals: void runningSolver(); void stoppedSolver(); diff --git a/quacker/quacker.cpp b/quacker/quacker.cpp index d3945ac..cf1b4c7 100644 --- a/quacker/quacker.cpp +++ b/quacker/quacker.cpp @@ -1271,6 +1271,11 @@ void TopLevel::incrementSimulation() if (m_macondo->anyUpdates()) { updateMoveViews(); updateSimViews(); + if (m_macondo->isSolving()) { + // stop after solver gives us moves + simulate(false); + return; + } } // check again in 100ms m_simulationTimer->start(100); -- cgit v1.2.3