summaryrefslogtreecommitdiff
path: root/quacker
diff options
context:
space:
mode:
authorJohn Fultz <jfultz@wolfram.com>2016-07-03 01:55:20 -0500
committerJohn Fultz <jfultz@wolfram.com>2016-07-03 01:55:20 -0500
commit0cda99549250c87ab9c9b20044767a7615e279c6 (patch)
treea53d4b1002ff6ae29f63e16aab25dab3082ba9ea /quacker
parent63e3348ace58bb8cc990d418269df61f640fc234 (diff)
Add a scoring option preference.
A checkbox in the preferences dialog now allows you to configure Quackle so that plays with illegal words which are left unchallenged score zero. Obviously, off by default. But useful for entering games as part of the Marty Gabriel/Scott Garner world record scoring attempt. This is apparently what the Guinness folks are looking for.
Diffstat (limited to 'quacker')
-rw-r--r--quacker/configpages.cpp4
-rw-r--r--quacker/configpages.h1
-rw-r--r--quacker/quacker.cpp8
-rw-r--r--quacker/quackersettings.cpp2
4 files changed, 14 insertions, 1 deletions
diff --git a/quacker/configpages.cpp b/quacker/configpages.cpp
index c246797..ee807fd 100644
--- a/quacker/configpages.cpp
+++ b/quacker/configpages.cpp
@@ -96,10 +96,12 @@ InterfacePage::InterfacePage(QWidget *parent)
QGroupBox *miscellanyGroup = new QGroupBox(tr("Miscellany"));
m_vowelFirstCheck = new QCheckBox(tr("&Vowel-first alphabetizing"));
m_octothorpCheck = new QCheckBox(tr("&Octothorp British words"));
+ m_scoreInvalidAsZero = new QCheckBox(tr("&Score 0 for plays with illegal words"));
QGridLayout *miscellanyLayout = new QGridLayout;
miscellanyLayout->addWidget(m_vowelFirstCheck, 0, 0);
miscellanyLayout->addWidget(m_octothorpCheck, 1, 0);
+ miscellanyLayout->addWidget(m_scoreInvalidAsZero, 2, 0);
miscellanyGroup->setLayout(miscellanyLayout);
QVBoxLayout *mainLayout = new QVBoxLayout;
@@ -116,6 +118,7 @@ void InterfacePage::readConfig()
m_verboseLabelsCheck->setChecked(QuackerSettings::self()->verboseLabels);
m_scoreLabelsCheck->setChecked(QuackerSettings::self()->scoreLabels);
m_octothorpCheck->setChecked(QuackleIO::UtilSettings::self()->octothorpBritish);
+ m_scoreInvalidAsZero->setChecked(QuackleIO::UtilSettings::self()->scoreInvalidAsZero);
}
void InterfacePage::writeConfig()
@@ -125,5 +128,6 @@ void InterfacePage::writeConfig()
QuackerSettings::self()->verboseLabels = m_verboseLabelsCheck->isChecked();
QuackerSettings::self()->scoreLabels = m_scoreLabelsCheck->isChecked();
QuackleIO::UtilSettings::self()->octothorpBritish = m_octothorpCheck->isChecked();
+ QuackleIO::UtilSettings::self()->scoreInvalidAsZero = m_scoreInvalidAsZero->isChecked();
}
diff --git a/quacker/configpages.h b/quacker/configpages.h
index 6d02ec0..6b61375 100644
--- a/quacker/configpages.h
+++ b/quacker/configpages.h
@@ -52,6 +52,7 @@ private:
QCheckBox *m_verboseLabelsCheck;
QCheckBox *m_scoreLabelsCheck;
QCheckBox *m_octothorpCheck;
+ QCheckBox *m_scoreInvalidAsZero;
QComboBox *m_britishColoringCombo;
};
diff --git a/quacker/quacker.cpp b/quacker/quacker.cpp
index 69bf9f9..be70c14 100644
--- a/quacker/quacker.cpp
+++ b/quacker/quacker.cpp
@@ -297,6 +297,7 @@ void TopLevel::setCandidateMove(const Quackle::Move &move)
if (!m_game->hasPositions() || (move.action == Quackle::Move::Place && move.tiles().empty()))
return;
+ bool playHasIllegalWords = false;
Quackle::Move prettiedMove(move);
m_game->currentPosition().ensureMoveTilesDoNotIncludePlayThru(prettiedMove);
m_game->currentPosition().ensureMovePrettiness(prettiedMove);
@@ -367,6 +368,8 @@ void TopLevel::setCandidateMove(const Quackle::Move &move)
{
prettiedMove.setIsChallengedPhoney(true);
}
+ else
+ playHasIllegalWords = true;
}
validityFlags ^= Quackle::GamePosition::UnacceptableWord;
@@ -384,7 +387,10 @@ void TopLevel::setCandidateMove(const Quackle::Move &move)
if (!carryOn)
return;
- m_game->currentPosition().scoreMove(prettiedMove);
+ if (playHasIllegalWords && QuackleIO::UtilSettings::self()->scoreInvalidAsZero)
+ prettiedMove.score = 0;
+ else
+ m_game->currentPosition().scoreMove(prettiedMove);
m_game->currentPosition().addAndSetMoveMade(prettiedMove);
switchToTab(ChoicesTabIndex);
ensureUpToDateSimulatorMoveList();
diff --git a/quacker/quackersettings.cpp b/quacker/quackersettings.cpp
index 1889848..510e43a 100644
--- a/quacker/quackersettings.cpp
+++ b/quacker/quackersettings.cpp
@@ -45,6 +45,7 @@ void QuackerSettings::readSettings()
scoreLabels = settings.value("quackle/settings/score-labels", scoreLabels).toBool();
QuackleIO::UtilSettings::self()->vowelFirst = settings.value("quackle/settings/vowel-first", QuackleIO::UtilSettings::self()->vowelFirst).toBool();
QuackleIO::UtilSettings::self()->octothorpBritish = settings.value("quackle/settings/octothorp-british", QuackleIO::UtilSettings::self()->octothorpBritish).toBool();
+ QuackleIO::UtilSettings::self()->scoreInvalidAsZero = settings.value("quackle/settings/score-invalid-as-zero", QuackleIO::UtilSettings::self()->scoreInvalidAsZero).toBool();
m_letterboxSettings.readSettings();
}
@@ -57,6 +58,7 @@ void QuackerSettings::writeSettings()
settings.setValue("quackle/settings/score-labels", scoreLabels);
settings.setValue("quackle/settings/vowel-first", QuackleIO::UtilSettings::self()->vowelFirst);
settings.setValue("quackle/settings/octothorp-british", QuackleIO::UtilSettings::self()->octothorpBritish);
+ settings.setValue("quackle/settings/score-invalid-as-zero", QuackleIO::UtilSettings::self()->scoreInvalidAsZero);
m_letterboxSettings.writeSettings();
}