From e23f1b73d77f5cc80ba9ef07d9877111b4ded349 Mon Sep 17 00:00:00 2001 From: John Fultz Date: Mon, 14 Aug 2017 11:31:36 -0500 Subject: Fixes #50 and related non-English strategy issues. Specifically... * Bogowin was only being used for English-like dictionaries. I suppose the bogowin numbers might change a bit from dictionary to dictionary, but I think it's quite plausible that the numbers are similar for all dictionaries. * This fixes bogowin always returning 100 or 0. * Make the strategy code more fine-grained, so that if it has some strategy files and not others, it will use what it has. JKB recommended a long time ago that I add a generic worths file to give the blank a high worth, but it wasn't being used because most languages didn't also have a syn2 or a superleaves. Now it will. Also, the vowel-consonant balance computations don't use any strategy files at all, but they were also being skipped if you didn't have every single strategy file. Oops. * The strategy computations would sometimes do unexpected things if the leaves weren't alphabetized. They now look at the alphabetized version of the leave. * A couple more conversions to ranged-for loops. --- strategyparameters.h | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) (limited to 'strategyparameters.h') diff --git a/strategyparameters.h b/strategyparameters.h index 6c214d4..e491349 100644 --- a/strategyparameters.h +++ b/strategyparameters.h @@ -31,7 +31,11 @@ public: StrategyParameters(); void initialize(const string &lexicon); - bool isInitialized() const; + bool hasSyn2() const; + bool hasWorths() const; + bool hasVcPlace() const; + bool hasBogowin() const; + bool hasSuperleaves() const; // letters are raw letters include bottom marks double syn2(Letter letter1, Letter letter2) const; @@ -56,14 +60,38 @@ protected: static const int m_bogowinArrayWidth = 601; static const int m_bogowinArrayHeight = 94; double m_bogowin[m_bogowinArrayWidth][m_bogowinArrayHeight]; - typedef map SuperLeavesMap; + typedef map SuperLeavesMap; SuperLeavesMap m_superleaves; - bool m_initialized; + bool m_hasSyn2; + bool m_hasWorths; + bool m_hasVcPlace; + bool m_hasBogowin; + bool m_hasSuperleaves; }; -inline bool StrategyParameters::isInitialized() const +inline bool StrategyParameters::hasSyn2() const { - return m_initialized; + return m_hasSyn2; +} + +inline bool StrategyParameters::hasWorths() const +{ + return m_hasWorths; +} + +inline bool StrategyParameters::hasVcPlace() const +{ + return m_hasVcPlace; +} + +inline bool StrategyParameters::hasBogowin() const +{ + return m_hasBogowin; +} + +inline bool StrategyParameters::hasSuperleaves() const +{ + return m_hasSuperleaves; } inline int StrategyParameters::mapLetter(Letter letter) const -- cgit v1.2.3