From e10d19ee5fec90f7f57457b74fc3fe18804362ba Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 8 Dec 2022 15:04:23 -0500 Subject: Added top yellow/red/blue, middle yellow/red/blue/purple --- lingo.cpp | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 107 insertions(+), 16 deletions(-) (limited to 'lingo.cpp') diff --git a/lingo.cpp b/lingo.cpp index e13bb53..b549804 100644 --- a/lingo.cpp +++ b/lingo.cpp @@ -26,6 +26,7 @@ enum Colour { kBlue, kPurple, kBrown, + kYellow, kColourCount }; @@ -35,7 +36,8 @@ const std::string COLOUR_EMOJIS[kColourCount] = { "🟥", "🟦", "🟪", - "🟫" + "🟫", + "🟨" }; int main(int argc, char** argv) @@ -60,14 +62,23 @@ int main(int argc, char** argv) mastodonpp::Connection connection{instance};*/ std::set> filters = { - {kBottom, kWhite}, - {kBottom, kBlack}, {kTop, kPurple}, {kTop, kWhite}, + {kTop, kYellow}, + {kTop, kRed}, + {kTop, kBlue}, + {kMiddle, kYellow}, + {kMiddle, kRed}, + {kMiddle, kBlue}, + {kMiddle, kPurple}, + {kBottom, kWhite}, + {kBottom, kBlack}, {kBottom, kRed}, {kBottom, kBlue}, }; + verbly::filter wordFilter = (verbly::form::proper == false); + verbly::filter cleanFilter = !(verbly::word::usageDomains %= (verbly::notion::wnid == 106718862)) // ethnic slurs && !(verbly::notion::wnid == 110630093); // "spastic" @@ -77,7 +88,7 @@ int main(int argc, char** argv) bool puzzleEmpty = true; std::array, kHeightCount> parts; for (int height = 0; height < static_cast(kHeightCount); height++) { - if (std::bernoulli_distribution(0.4)(rng)) { + if (std::bernoulli_distribution(0.5)(rng)) { int colour = std::uniform_int_distribution(0, static_cast(kColourCount)-1)(rng); if (filters.count({static_cast(height), static_cast(colour)})) { parts[static_cast(height)] = static_cast(colour); @@ -101,16 +112,16 @@ int main(int argc, char** argv) case kWhite: { switch (height) { case kBottom: { - forwardFilter &= (verbly::word::synonyms); + forwardFilter &= (verbly::word::synonyms %= wordFilter); break; } case kTop: { forwardFilter &= (verbly::form::pronunciations %= verbly::filter("homophones", false, - (verbly::pronunciation::forms %= verbly::filter( + (verbly::pronunciation::forms %= (wordFilter && verbly::filter( verbly::form::id, verbly::filter::comparison::field_does_not_equal, - verbly::form::id)))); + verbly::form::id))))); break; } default: break; // Not supposed yet. @@ -120,7 +131,7 @@ int main(int argc, char** argv) case kBlack: { switch (height) { case kBottom: { - forwardFilter &= (verbly::word::antonyms); + forwardFilter &= (verbly::word::antonyms %= wordFilter); break; } default: break; // Not supposed yet. @@ -130,7 +141,7 @@ int main(int argc, char** argv) case kBrown: { switch (height) { case kBottom: { - forwardFilter &= (verbly::notion::causes); + forwardFilter &= (verbly::notion::causes %= wordFilter); break; } default: break; // Not supposed yet. @@ -139,8 +150,16 @@ int main(int argc, char** argv) } case kRed: { switch (height) { + case kTop: { + forwardFilter &= (verbly::pronunciation::holophones %= wordFilter); + break; + } + case kMiddle: { + forwardFilter &= (verbly::form::holographs %= wordFilter); + break; + } case kBottom: { - forwardFilter &= (verbly::notion::partMeronyms); + forwardFilter &= (verbly::notion::partMeronyms %= wordFilter); break; } default: break; // Not supposed yet. @@ -149,8 +168,16 @@ int main(int argc, char** argv) } case kBlue: { switch (height) { + case kTop: { + forwardFilter &= (verbly::pronunciation::merophones %= wordFilter); + break; + } + case kMiddle: { + forwardFilter &= (verbly::form::merographs %= wordFilter); + break; + } case kBottom: { - forwardFilter &= (verbly::notion::partHolonyms); + forwardFilter &= (verbly::notion::partHolonyms %= wordFilter); break; } default: break; // Not supposed yet. @@ -159,8 +186,32 @@ int main(int argc, char** argv) } case kPurple: { switch (height) { + case kMiddle: { + forwardFilter &= (verbly::form::merographs %= (verbly::form::length >= 4 && (verbly::form::holographs %= wordFilter))); + break; + } case kTop: { - forwardFilter &= (verbly::pronunciation::rhymes); + forwardFilter &= (verbly::pronunciation::rhymes %= wordFilter); + break; + } + default: break; // Not supposed yet. + } + break; + } + case kYellow: { + switch (height) { + case kTop: { + forwardFilter &= (verbly::pronunciation::anaphones %= (wordFilter && verbly::filter( + verbly::pronunciation::id, + verbly::filter::comparison::field_does_not_equal, + verbly::pronunciation::id))); + break; + } + case kMiddle: { + forwardFilter &= (verbly::form::anagrams %= (wordFilter && verbly::filter( + verbly::form::id, + verbly::filter::comparison::field_does_not_equal, + verbly::form::id))); break; } default: break; // Not supposed yet. @@ -171,7 +222,7 @@ int main(int argc, char** argv) } } - verbly::word solution = database.words(forwardFilter).first(); + verbly::form solution = database.forms(forwardFilter).first(); for (int i=0; i(kHeightCount); i++) { Height height = static_cast(i); @@ -220,6 +271,14 @@ int main(int argc, char** argv) } case kBlue: { switch (height) { + case kTop: { + questionFilter = (verbly::pronunciation::holophones %= solution); + break; + } + case kMiddle: { + questionFilter = (verbly::form::holographs %= solution); + break; + } case kBottom: { /*questionFilter = ((verbly::notion::fullMemberHolonyms %= solution) || (verbly::notion::fullPartHolonyms %= solution) @@ -234,6 +293,14 @@ int main(int argc, char** argv) } case kRed: { switch (height) { + case kTop: { + questionFilter = (verbly::pronunciation::merophones %= solution); + break; + } + case kMiddle: { + questionFilter = (verbly::form::merographs %= solution); + break; + } case kBottom: { /*questionFilter = ((verbly::notion::fullMemberMeronyms %= solution) || (verbly::notion::fullPartMeronyms %= solution) @@ -252,19 +319,43 @@ int main(int argc, char** argv) questionFilter = (verbly::pronunciation::rhymes %= solution); break; } + case kMiddle: { + questionFilter = (verbly::form::merographs %= (verbly::form::length >= 4 && (verbly::form::holographs %= solution))); + break; + } + default: break; // Not supposed yet. + } + break; + } + case kYellow: { + switch (height) { + case kTop: { + questionFilter = (verbly::pronunciation::anaphones %= ((verbly::filter)solution && verbly::filter( + verbly::pronunciation::id, + verbly::filter::comparison::field_does_not_equal, + verbly::pronunciation::id))); + break; + } + case kMiddle: { + questionFilter = (verbly::form::anagrams %= ((verbly::filter)solution && verbly::filter( + verbly::form::id, + verbly::filter::comparison::field_does_not_equal, + verbly::form::id))); + break; + } default: break; // Not supposed yet. } break; } default: break; // Not supposed yet. } - verbly::word questionPart = database.words(questionFilter && cleanFilter && (verbly::form::proper == false)).first(); - std::cout << COLOUR_EMOJIS[*colour] << " " << questionPart.getBaseForm().getText() << std::endl; + verbly::form questionPart = database.forms(questionFilter && cleanFilter).first(); + std::cout << COLOUR_EMOJIS[*colour] << " " << questionPart.getText() << std::endl; } else { std::cout << "▪️" << std::endl; } } - std::cout << "(" << solution.getBaseForm().getText().size() << ")" << std::endl << std::endl << solution.getBaseForm().getText() << std::endl; + std::cout << "(" << solution.getText().size() << ")" << std::endl << std::endl << solution.getText() << std::endl; // We can poll the timeline at most once every five minutes. -- cgit 1.4.1