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 +++++++++++++++++++++ vendor/verbly | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) 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; } diff --git a/vendor/verbly b/vendor/verbly index c66c279..1e30651 160000 --- a/vendor/verbly +++ b/vendor/verbly @@ -1 +1 @@ -Subproject commit c66c279fb65328c5a5f5d8ca6e0df035fc5c5555 +Subproject commit 1e30651c96912e5475f1ceb46972ec4e2fa54b10 -- cgit 1.4.1