From 15fb752e8502f0b5c7e5f579dd3ff0eb8baabf3b Mon Sep 17 00:00:00 2001 From: pommicket Date: Thu, 21 Aug 2025 21:49:21 -0400 Subject: Fix various bugs with Macondo moves --- quacker/macondo.cpp | 5 +---- quacker/macondo.h | 4 ---- quacker/macondobackend.cpp | 2 +- quacker/quacker.cpp | 11 ++--------- 4 files changed, 4 insertions(+), 18 deletions(-) diff --git a/quacker/macondo.cpp b/quacker/macondo.cpp index a222126..f732b32 100644 --- a/quacker/macondo.cpp +++ b/quacker/macondo.cpp @@ -1,6 +1,5 @@ /* TODO: -- save options - detect Macondo crashing? - configurable max plies - other peg/endgame options @@ -118,7 +117,6 @@ bool Macondo::simulate() { } if (isRunning()) stop(); - clearMoves(); MacondoSimulateOptions options; return m_backend->simulate(options, m_movesFromKibitzer); } @@ -132,7 +130,6 @@ void Macondo::solve() { bool wasSolving = m_isSolving; if (isRunning()) stop(); - clearMoves(); if (wasSolving) { emit stoppedSolver(); } else { @@ -183,7 +180,7 @@ bool Macondo::useForSimulation() const { } void Macondo::gotMoves(const Quackle::MoveList &moves) { - m_moves = moves; + m_game->currentPosition().setMoves(moves); m_anyUpdates = true; if (m_isSolving && moves.size() > 0) { emit setCandidateMove(&moves[0]); diff --git a/quacker/macondo.h b/quacker/macondo.h index 83eb031..9c85987 100644 --- a/quacker/macondo.h +++ b/quacker/macondo.h @@ -20,9 +20,6 @@ public: void stop(); // should Macondo be used for simulations? bool useForSimulation() const; - inline const Quackle::MoveList &getMoves() const { return m_moves; } - inline bool hasMoves() const { return !m_moves.empty(); } - inline void clearMoves() { m_moves.clear(); } // returns whether there have been any updates to moves since last time anyUpdates() was called. inline bool anyUpdates() { bool any = m_anyUpdates; @@ -55,7 +52,6 @@ private: QPushButton *m_solve; Quackle::Game *m_game; MacondoBackend *m_backend; - Quackle::MoveList m_moves; Quackle::MoveList m_movesFromKibitzer; int m_tilesUnseen = 93; int m_viewingPlyNumber = 0; diff --git a/quacker/macondobackend.cpp b/quacker/macondobackend.cpp index bc046c9..d123b95 100644 --- a/quacker/macondobackend.cpp +++ b/quacker/macondobackend.cpp @@ -417,7 +417,7 @@ void MacondoBackend::timer() { data = m_process->readAllStandardOutput(); anyNewOutput |= data.size() != 0; m_processOutput.append(data); - printf("%.*s",data.size(), data.constData()); + //printf("%.*s",data.size(), data.constData()); fflush(stdout); } const char *dots = updateDots(anyNewOutput); diff --git a/quacker/quacker.cpp b/quacker/quacker.cpp index 32486e0..c54e08a 100644 --- a/quacker/quacker.cpp +++ b/quacker/quacker.cpp @@ -401,7 +401,7 @@ void TopLevel::setCandidateMove(const Quackle::Move *move, bool *carryOnPtr) // a check if we have simulation results -- but we don't want to send out // a moves changed signal if we don't have results because // we just sent out a position changed signal - if (m_simulator->hasSimulationResults() || m_macondo->hasMoves()) + if (m_simulator->hasSimulationResults()) updateMoveViews(); } @@ -622,10 +622,7 @@ void TopLevel::updatePositionViews() void TopLevel::updateMoveViews() { Quackle::MoveList list; - if (m_macondo->hasMoves()) { - list = m_macondo->getMoves(); - } - else if (m_simulator->hasSimulationResults()) + if (m_simulator->hasSimulationResults()) { list = m_simulator->moves(/* prune */ true, /* sort by win */ true); } @@ -1047,7 +1044,6 @@ void TopLevel::commitTopChoice() void TopLevel::ensureUpToDateSimulatorMoveList() { m_simulator->setIncludedMoves(m_game->currentPosition().moves()); - m_macondo->clearMoves(); } void TopLevel::simulate(bool startSimulation) @@ -1112,7 +1108,6 @@ void TopLevel::clearSimulationResults() return; m_simulator->resetNumbers(); - m_macondo->clearMoves(); updateMoveViews(); updateSimViews(); @@ -1286,8 +1281,6 @@ void TopLevel::incrementSimulation() // check again in 100ms m_simulationTimer->start(100); } else { - // clear Macondo moves to make way for Simulator moves - m_macondo->clearMoves(); m_simulator->simulate(m_plies); m_simulationTimer->start(0); -- cgit v1.2.3