summaryrefslogtreecommitdiff
path: root/quacker
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2025-08-22 17:05:28 -0400
committerpommicket <pommicket@gmail.com>2025-08-22 17:05:28 -0400
commit31c6114fb3a7db322fba89bb9021c694da248384 (patch)
treee294174e88abd66115063fc671b12e35ea3164ce /quacker
parent4956c4f2f7605dc7332b0e51e77a25fe88caef69 (diff)
Macondo PEG options
Diffstat (limited to 'quacker')
-rw-r--r--quacker/macondo.cpp29
-rw-r--r--quacker/macondo.h4
-rw-r--r--quacker/macondobackend.cpp7
-rw-r--r--quacker/macondobackend.h4
4 files changed, 42 insertions, 2 deletions
diff --git a/quacker/macondo.cpp b/quacker/macondo.cpp
index 83a197a..36b7c38 100644
--- a/quacker/macondo.cpp
+++ b/quacker/macondo.cpp
@@ -1,6 +1,6 @@
/*
TODO:
-- more peg/endgame options
+- more endgame options
*/
#include "macondo.h"
@@ -64,8 +64,27 @@ Macondo::Macondo(Quackle::Game *game) : View() {
m_preEndgameMaxPlies = new QSpinBox;
m_preEndgameMaxPlies->setRange(1, 100);
m_preEndgameMaxPlies->setValue(settings.value("macondo/preEndgameMaxPlies", 4).toInt());
+ m_earlyCutoff = new QCheckBox(tr("Early cut-off"));
+ m_earlyCutoff->setChecked(settings.value("macondo/earlyCutoff", true).toBool());
+ m_earlyCutoff->setToolTip(tr("Cut off analysis if another play is certainly better."
+ " This speeds up analysis but moves other than the top one might not be listed in the correct order."));
+ m_skipNonEmptying = new QCheckBox(tr("Skip non-emptying"));
+ m_skipNonEmptying->setToolTip(tr("Skip analyzing plays which don't empty the bag."
+ " This speeds up analysis but may miss optimal non-emptying plays."));
+ m_skipNonEmptying->setChecked(settings.value("macondo/skipNonEmptying", true).toBool());
+ m_skipTieBreaker = new QCheckBox(tr("Skip tie-breaker"));
+ m_skipTieBreaker->setToolTip(tr("Skip breaking win% ties by spread. "
+ "This speeds up analysis but the top-ranked play might not have the best spread."));
+ m_skipTieBreaker->setChecked(settings.value("macondo/skipTieBreaker", false).toBool());
+ m_opponentRack = new QLineEdit;
+ m_opponentRack->setToolTip("Enter any tiles which you know your opponent has here, for more accurate analysis.");
+
pegLayout->addWidget(m_generatedMovesOnly);
+ pegLayout->addWidget(m_earlyCutoff);
+ pegLayout->addWidget(m_skipNonEmptying);
+ pegLayout->addWidget(m_skipTieBreaker);
pegLayout->addLayout(new LabelLayout(tr("Endgame plies"), m_preEndgameMaxPlies));
+ pegLayout->addLayout(new LabelLayout(tr("Opponent rack"), m_opponentRack));
pegBox->setLayout(pegLayout);
QGroupBox *endgameBox = new QGroupBox(tr("Endgame options"));
@@ -91,6 +110,10 @@ Macondo::~Macondo() {
settings.setValue("macondo/generatedMovesOnly", m_generatedMovesOnly->isChecked());
settings.setValue("macondo/endgameMaxPlies", m_endgameMaxPlies->value());
settings.setValue("macondo/preEndgameMaxPlies", m_preEndgameMaxPlies->value());
+ settings.setValue("macondo/earlyCutoff", m_earlyCutoff->isChecked());
+ settings.setValue("macondo/skipNonEmptying", m_skipNonEmptying->isChecked());
+ settings.setValue("macondo/skipTieBreaker", m_skipTieBreaker->isChecked());
+
delete m_backend;
}
@@ -163,6 +186,10 @@ void Macondo::solve() {
if (m_tilesUnseen > 7) {
MacondoPreEndgameOptions options;
options.endgamePlies = m_preEndgameMaxPlies->value();
+ options.earlyCutoff = m_earlyCutoff->isChecked();
+ options.skipNonEmptying = m_skipNonEmptying->isChecked();
+ options.skipTieBreaker = m_skipTieBreaker->isChecked();
+ options.opponentRack = m_opponentRack->text().toStdString();
if (m_generatedMovesOnly->isChecked()) {
if (m_movesFromKibitzer.empty()) {
QMessageBox::critical(this,
diff --git a/quacker/macondo.h b/quacker/macondo.h
index 86d8b59..dfd9d97 100644
--- a/quacker/macondo.h
+++ b/quacker/macondo.h
@@ -54,6 +54,10 @@ private:
QSpinBox *m_endgameMaxPlies;
// == pre-endgame options ===
QCheckBox *m_generatedMovesOnly;
+ QCheckBox *m_earlyCutoff;
+ QCheckBox *m_skipNonEmptying;
+ QCheckBox *m_skipTieBreaker;
+ QLineEdit *m_opponentRack;
QSpinBox *m_preEndgameMaxPlies;
QPushButton *m_solve;
Quackle::Game *m_game;
diff --git a/quacker/macondobackend.cpp b/quacker/macondobackend.cpp
index fa3c334..47d3465 100644
--- a/quacker/macondobackend.cpp
+++ b/quacker/macondobackend.cpp
@@ -586,7 +586,12 @@ void MacondoBackend::processStarted() {
}
command << "-endgameplies " << m_preEndgameOptions.endgamePlies << " ";
command << "-disable-id true ";
- command << "-early-cutoff true ";
+ command << "-early-cutoff " << (m_preEndgameOptions.earlyCutoff ? "true" : "false") << " ";
+ command << "-skip-nonemptying " << (m_preEndgameOptions.skipNonEmptying ? "true" : "false") << " ";
+ command << "-skip-tiebreaker " << (m_preEndgameOptions.skipTieBreaker ? "true" : "false") << " ";
+ if (!m_preEndgameOptions.opponentRack.empty()) {
+ command << "-opprack " << m_preEndgameOptions.opponentRack << " ";
+ }
command << "\n";
m_process->write(command.str().c_str());
}
diff --git a/quacker/macondobackend.h b/quacker/macondobackend.h
index 8af328f..048c787 100644
--- a/quacker/macondobackend.h
+++ b/quacker/macondobackend.h
@@ -23,6 +23,10 @@ struct MacondoPreEndgameOptions {
// if empty, we'll get Macondo to analyze all possible moves
Quackle::MoveList movesToAnalyze;
int endgamePlies = 4;
+ bool skipNonEmptying = false;
+ bool skipTieBreaker = false;
+ bool earlyCutoff = false;
+ std::string opponentRack;
inline MacondoPreEndgameOptions() {}
};