diff options
author | pommicket <pommicket@gmail.com> | 2025-08-21 12:01:39 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2025-08-21 12:01:39 -0400 |
commit | ab035c5da2d0dee7a2bdbb121045b9b1e97ffa13 (patch) | |
tree | 9a6d3da364ae30e2678a66e2e9a1dfab31b30a48 | |
parent | 36dd3c3fbaa4273df4b8428eb9054263ff2feb56 (diff) |
Show PEG outcomes on hover
-rw-r--r-- | move.h | 3 | ||||
-rw-r--r-- | quacker/macondobackend.cpp | 5 | ||||
-rw-r--r-- | quacker/movebox.cpp | 7 |
3 files changed, 14 insertions, 1 deletions
@@ -59,6 +59,9 @@ public: int startrow = 0; int startcol = 0; + // Human-readable outcomes for pre-endgame solving + std::string outcomes; + // returns whether this is not a Nonmove bool isAMove() const; diff --git a/quacker/macondobackend.cpp b/quacker/macondobackend.cpp index e30c65a..052aa68 100644 --- a/quacker/macondobackend.cpp +++ b/quacker/macondobackend.cpp @@ -359,6 +359,7 @@ static Quackle::Move extractPreEndgameMove(const string &moveStr) { move.equity = parseEquity(words[2]); else move.equity = -999 + 0.01 * move.win; // ensure moves are still sorted by win% + move.outcomes = outcomes; return move; } @@ -428,6 +429,10 @@ void MacondoBackend::timer() { emit statusMessage("Finished solving pre-endgame."); Quackle::MoveList moves = extractPreEndgameMoves(m_processOutput); if (!moves.empty()) { + Quackle::GamePosition &position = m_game->currentPosition(); + for (Quackle::Move &move: moves) { + position.scoreMove(move); + } // at this point the GCG is definitely fully loaded removeTempGCG(); emit gotMoves(moves); diff --git a/quacker/movebox.cpp b/quacker/movebox.cpp index ae6c2f5..9370fdb 100644 --- a/quacker/movebox.cpp +++ b/quacker/movebox.cpp @@ -262,7 +262,12 @@ QTreeWidgetItem *MoveBox::createItem(const Quackle::Move &move) item->setText(LeaveColumn, QuackleIO::Util::letterStringToQString(QuackleIO::Util::arrangeLettersForUser(m_rack - move))); item->setText(WinPercentageColumn, formatWinPercentage(move.win)); item->setText(EquityColumn, formatValuation(move.equity)); - + if (!move.outcomes.empty()) { + // show Macondo pre-endgame outcomes when item is hovered over + for (int column = 0; column < m_treeWidget->columnCount(); column++) { + item->setToolTip(column, QString::fromStdString(move.outcomes)); + } + } return item; } |