From f6c99467e83b7735bf4c6b13736726adc2d01d62 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Fri, 17 Feb 2023 09:34:28 -0500 Subject: Added top yellow triviality check for swapped stressed phonemes --- lingo.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'lingo.cpp') diff --git a/lingo.cpp b/lingo.cpp index 64c97ac..ea4697d 100644 --- a/lingo.cpp +++ b/lingo.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include "imagenet.h" #define ENABLE_BOT @@ -73,6 +74,10 @@ enum FilterDirection { kTowardQuestion }; +bool isDigitWrapper(unsigned char ch) { + return std::isdigit(ch); +} + verbly::filter makeHintFilter(verbly::filter subfilter, Height height, Colour colour, FilterDirection filter_direction) { switch (colour) { @@ -495,6 +500,22 @@ private: return true; } } + } else if (height == kTop && colour == kYellow) { + std::set hint_stressless; + for (const verbly::pronunciation& pronunciation : clue.getPronunciations()) { + std::string stressed = hatkirby::implode(pronunciation.getPhonemes(), " "); + std::string stressless; + std::remove_copy_if(stressed.begin(), stressed.end(), std::back_inserter(stressless), &isDigitWrapper); + hint_stressless.insert(stressless); + } + for (const verbly::pronunciation& pronunciation : solution.getPronunciations()) { + std::string stressed = hatkirby::implode(pronunciation.getPhonemes(), " "); + std::string stressless; + std::remove_copy_if(stressed.begin(), stressed.end(), std::back_inserter(stressless), &isDigitWrapper); + if (hint_stressless.count(stressless)) { + return true; + } + } } return false; } -- cgit 1.4.1