From cebfd065c029788f3d6a8cc33b9401a708052335 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 15 Feb 2023 10:04:06 -0500 Subject: Did a buncha work --- .gitignore | 2 + .gitmodules | 3 + CMakeLists.txt | 13 ++ generator.cpp | 675 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ generator.h | 230 ++++++++++++++++++++ main.cpp | 550 ++++++++++++++++++++++++++++++++++++++++++++++ vendor/verbly | 1 + 7 files changed, 1474 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 CMakeLists.txt create mode 100644 generator.cpp create mode 100644 generator.h create mode 100644 main.cpp create mode 160000 vendor/verbly diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d76b74e --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build +.DS_Store diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..d812b5e --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "vendor/verbly"] + path = vendor/verbly + url = git@github.com:hatkirby/verbly diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..99592cb --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required (VERSION 3.1) +project (lingo_randomizer) + +set(CMAKE_BUILD_TYPE Debug) + +add_subdirectory(vendor/verbly) + +include_directories(vendor/verbly/lib) + +add_executable(lingo_randomizer main.cpp generator.cpp) +set_property(TARGET lingo_randomizer PROPERTY CXX_STANDARD 17) +set_property(TARGET lingo_randomizer PROPERTY CXX_STANDARD_REQUIRED ON) +target_link_libraries(lingo_randomizer verbly) diff --git a/generator.cpp b/generator.cpp new file mode 100644 index 0000000..d0ef1a9 --- /dev/null +++ b/generator.cpp @@ -0,0 +1,675 @@ +#include "generator.h" +#include +#include + +verbly::filter Generator::MakeHintFilter(verbly::filter subfilter, Height height, Colour colour, FilterDirection filter_direction) +{ + switch (colour) { + case kWhite: { + switch (height) { + case kBottom: { + return (verbly::word::synonyms %= subfilter); + } + case kTop: { + return (verbly::form::pronunciations %= + verbly::filter("homophones", false, + (verbly::pronunciation::forms %= (subfilter && verbly::filter( + verbly::form::id, + verbly::filter::comparison::field_does_not_equal, + verbly::form::id))))); + } + case kMiddle: { + return subfilter; + } + default: break; // Not supported yet. + } + break; + } + case kBlack: { + switch (height) { + case kBottom: { + return (verbly::word::antonyms %= subfilter); + } + case kMiddle: { + return (verbly::form::antogram %= subfilter); + } + case kTop: { + return (verbly::pronunciation::antophone %= subfilter); + } + default: break; // Not supported yet. + } + break; + } + case kBrown: { + break; // Not supported yet. + } + case kRed: { + switch (height) { + case kTop: { + if (filter_direction == kTowardSolution) + { + return (verbly::pronunciation::merophones %= subfilter); + } else { + return (verbly::pronunciation::holophones %= subfilter); + } + } + case kMiddle: { + if (filter_direction == kTowardSolution) + { + return (verbly::form::merographs %= subfilter); + } else { + return (verbly::form::holographs %= subfilter); + } + } + case kBottom: { + if (filter_direction == kTowardSolution) + { + return (verbly::notion::partMeronyms %= + verbly::filter("partMeronyms", false, + subfilter && verbly::filter( + verbly::form::id, + verbly::filter::comparison::field_does_not_equal, + verbly::form::id))); + } else { + return (verbly::notion::partHolonyms %= + verbly::filter("partHolonyms", false, + subfilter && verbly::filter( + verbly::form::id, + verbly::filter::comparison::field_does_not_equal, + verbly::form::id))); + } + } + default: break; // Not supported yet. + } + break; + } + case kBlue: { + switch (height) { + case kTop: { + if (filter_direction == kTowardSolution) + { + return (verbly::pronunciation::holophones %= subfilter); + } else { + return (verbly::pronunciation::merophones %= subfilter); + } + } + case kMiddle: { + if (filter_direction == kTowardSolution) + { + return (verbly::form::holographs %= subfilter); + } else { + return (verbly::form::merographs %= subfilter); + } + } + case kBottom: { + if (filter_direction == kTowardSolution) + { + return (verbly::notion::partHolonyms %= + verbly::filter("partHolonyms", false, + subfilter && verbly::filter( + verbly::form::id, + verbly::filter::comparison::field_does_not_equal, + verbly::form::id))); + } else { + return (verbly::notion::partMeronyms %= + verbly::filter("partMeronyms", false, + subfilter && verbly::filter( + verbly::form::id, + verbly::filter::comparison::field_does_not_equal, + verbly::form::id))); + } + } + default: break; // Not supported yet. + } + break; + } + case kPurple: { + switch (height) { + case kMiddle: { + return (verbly::form::holographs %= + verbly::filter("midpurp", false, + (verbly::form::length >= 4 && (verbly::form::merographs %= + (subfilter && verbly::filter( + verbly::form::id, + verbly::filter::comparison::field_does_not_equal, + verbly::form::id)))))); + } + case kTop: { + return (verbly::pronunciation::rhymes %= subfilter); + } + default: break; // Not supported yet. + } + break; + } + case kYellow: { + switch (height) { + case kTop: { + return (verbly::pronunciation::anaphones %= (subfilter && verbly::filter( + verbly::pronunciation::id, + verbly::filter::comparison::field_does_not_equal, + verbly::pronunciation::id))); + } + case kMiddle: { + return (verbly::form::anagrams %= (subfilter && verbly::filter( + verbly::form::id, + verbly::filter::comparison::field_does_not_equal, + verbly::form::id))); + } + default: break; // Not supported yet. + } + break; + } + case kGreen: { + if (filter_direction == kTowardSolution) + { + switch (height) { + case kBottom: { + verbly::filter whitelist = + (verbly::notion::wnid == 109287968) // Geological formations + || (verbly::notion::wnid == 109208496) // Asterisms (collections of stars) + || (verbly::notion::wnid == 109239740) // Celestial bodies + || (verbly::notion::wnid == 109277686) // Exterrestrial objects (comets and meteroids) + || (verbly::notion::wnid == 109403211) // Radiators (supposedly natural radiators but actually these are just pictures of radiators) + || (verbly::notion::wnid == 109416076) // Rocks + || (verbly::notion::wnid == 105442131) // Chromosomes + || (verbly::notion::wnid == 100324978) // Tightrope walking + || (verbly::notion::wnid == 100326094) // Rock climbing + || (verbly::notion::wnid == 100433458) // Contact sports + || (verbly::notion::wnid == 100433802) // Gymnastics + || (verbly::notion::wnid == 100439826) // Track and field + || (verbly::notion::wnid == 100440747) // Skiing + || (verbly::notion::wnid == 100441824) // Water sport + || (verbly::notion::wnid == 100445351) // Rowing + || (verbly::notion::wnid == 100446980) // Archery + // TODO: add more sports + || (verbly::notion::wnid == 100021939) // Artifacts + || (verbly::notion::wnid == 101471682) // Vertebrates + ; + + verbly::filter blacklist = + (verbly::notion::wnid == 106883725) // swastika + || (verbly::notion::wnid == 104416901) // tetraskele + || (verbly::notion::wnid == 102512053) // fish + || (verbly::notion::wnid == 103575691) // instrument of execution + || (verbly::notion::wnid == 103829563) // noose + || (verbly::notion::wnid == 103663910) // life support + ; + + return subfilter + && (verbly::notion::fullHypernyms %= whitelist) + && !(verbly::notion::fullHypernyms %= blacklist) + && (verbly::notion::partOfSpeech == verbly::part_of_speech::noun) + && (verbly::notion::numOfImages >= 1); + } + case kMiddle: { + return subfilter; + } + default: break; // Never supported. + } + } else { + return (verbly::form::text == "picture"); + } + break; + } + default: break; // Not supported yet. + } + return {}; +} + +std::string ApplyWanderlust(const std::string& word) { + std::string result; + for (char ch : word) { + if (ch == 'w') { + result += '1'; + } else if (ch == 'a') { + result += '2'; + } else if (ch == 'n') { + result += '3'; + } else if (ch == 'd') { + result += '4'; + } else if (ch == 'e') { + result += '5'; + } else if (ch == 'r') { + result += '6'; + } else if (ch == 'l') { + result += '7'; + } else if (ch == 'u') { + result += '8'; + } else if (ch == 's') { + result += '9'; + } else if (ch == 't') { + result += '0'; + } else if (ch == ' ') { + result += ' '; + } + } + return result; +} + +void Generator::GenerateStaticPanel(std::string name, std::string question, std::string answer) { + SavePanel(name, question, answer.empty() ? question : answer, {}); +} + +void Generator::GenerateSinglePanel(std::string name, Height height, Colour colour, GenerateOptions options) { + while (!GenerateSinglePanelImpl(name, height, colour, options)); +} + +bool Generator::GenerateSinglePanelImpl(std::string name, Height height, Colour colour, GenerateOptions options) { + verbly::form solution; + if (options.reuse_solution) { + const std::string& word = reusable_.at(std::uniform_int_distribution(0, reusable_.size()-1)(rng_)); + if (options.max_answer_len > 0 && word.size() > options.max_answer_len) return false; + solution = database_->forms(verbly::form::text == word).first(); + } else { + verbly::filter forward = MakeHintFilter({}, height, colour, kTowardSolution); + std::vector solutions = database_->forms(forward && GetWordFilter(kTowardSolution, options)).all(); + solution = solutions.front();//solutions.at(std::uniform_int_distribution(0, solutions.size())(rng_)); + } + + if (!options.unique_pool.empty() && pools_[options.unique_pool].count(solution.getText())) { + return false; + } + if (options.palindrome != kPalindromeUnspecified) { + std::string reversed = solution.getText(); + std::reverse(reversed.begin(), reversed.end()); + + if ((options.palindrome == kForcePalindrome && reversed != solution.getText()) || + (options.palindrome == kRejectPalindrome && reversed == solution.getText())) { + return false; + } + } + + // Finish early if this is a middle white. + if (height == kMiddle && colour == kWhite) { + SavePanel(name, solution.getText(), solution.getText(), options); + return true; + } + + verbly::filter questionFilter = MakeHintFilter(solution, height, colour, kTowardQuestion); + std::vector questions = database_->forms(questionFilter && GetWordFilter(kTowardQuestion, options)).all();//, verbly::order(verbly::form::id), 0).all(); + if (questions.size() < 1) return false; + verbly::form question = questions.front();// questions.at(std::uniform_int_distribution(0, questions.size())(rng_)); + + if (IsClueTrivial(height, colour, question, solution)) { + return false; + } + + SavePanel(name, question.getText(), solution.getText(), options); + if (!options.copy_to.empty()) { + SavePanel(options.copy_to, question.getText(), solution.getText(), options); + } + + return true; +} + +void Generator::GenerateDoublePanel(std::string name1, std::string name2, Height height, Colour colour, GenerateOptions options) { + while (!GenerateDoublePanelImpl(name1, name2, height, colour, options)); +} + +bool Generator::GenerateDoublePanelImpl(std::string name1, std::string name2, Height height, Colour colour, GenerateOptions options) { + verbly::form solution; + if (options.reuse_solution) { + const std::string& word = reusable_.at(std::uniform_int_distribution(0, reusable_.size()-1)(rng_)); + if (options.max_answer_len > 0 && word.size() > options.max_answer_len) return false; + solution = database_->forms(verbly::form::text == word).first(); + } else { + verbly::filter forward = MakeHintFilter({}, height, colour, kTowardSolution); + std::vector solutions = database_->forms(forward && GetWordFilter(kTowardSolution, options)).all(); + solution = solutions.front();//solutions.at(std::uniform_int_distribution(0, solutions.size())(rng_)); + } + + if (!options.unique_pool.empty() && pools_[options.unique_pool].count(solution.getText())) { + return false; + } + + // Finish early if this is a middle white. + if (height == kMiddle && colour == kWhite) { + SavePanel(name1, solution.getText(), solution.getText(), options); + SavePanel(name2, solution.getText(), solution.getText(), options); + return true; + } + + verbly::filter questionFilter = MakeHintFilter(solution, height, colour, kTowardQuestion); + std::vector questions = database_->forms(questionFilter && GetWordFilter(kTowardQuestion, options), {}, 2).all(); + if (questions.size() < 2) return false; + + //std::shuffle(questions.begin(), questions.end(), rng_); + + if (IsClueTrivial(height, colour, questions[0], solution) || IsClueTrivial(height, colour, questions[1], solution)) { + return false; + } + + SavePanel(name1, questions[0].getText(), solution.getText(), options); + SavePanel(name2, questions[1].getText(), solution.getText(), options); + + return true; +} + +void Generator::GenerateCohintedPanels(std::string name1, std::string name2, Height height, Colour colour, GenerateOptions options) { + while (!GenerateCohintedPanelsImpl(name1, name2, height, colour, options)); +} + +bool Generator::GenerateCohintedPanelsImpl(std::string name1, std::string name2, Height height, Colour colour, GenerateOptions options) { + verbly::filter backward = MakeHintFilter({}, height, colour, kTowardQuestion); + std::vector questions = database_->forms(backward && GetWordFilter(kTowardQuestion, options)).all();//, verbly::order(verbly::form::id), 0).all(); + verbly::form question = questions.front();// solutions.at(std::uniform_int_distribution(0, solutions.size())(rng_)); + + // Finish early if this is a middle white. + if (height == kMiddle && colour == kWhite) { + SavePanel(name1, question.getText(), question.getText(), options); + SavePanel(name2, question.getText(), question.getText(), options); + return true; + } + + verbly::filter solutionFilter = MakeHintFilter(question, height, colour, kTowardSolution); + std::vector solutions = database_->forms(solutionFilter && GetWordFilter(kTowardSolution, options), {}, 2).all(); + if (solutions.size() < 2) return false; + + //std::shuffle(questions.begin(), questions.end(), rng_); + + if (IsClueTrivial(height, colour, question, solutions[0]) || IsClueTrivial(height, colour, question, solutions[1])) { + return false; + } + + SavePanel(name1, question.getText(), solutions[0].getText(), options); + SavePanel(name2, question.getText(), solutions[1].getText(), options); + + return true; +} + +void Generator::GeneratePairedPanels(std::string name1, std::string name2, Height height, Colour colour, GenerateOptions options) { + while (!GeneratePairedPanelsImpl(name1, name2, height, colour, options)); +} + +bool Generator::GeneratePairedPanelsImpl(std::string name1, std::string name2, Height height, Colour colour, GenerateOptions options) { + Colour effectiveColour = (height == kMiddle && colour == kWhite) ? kBlack : colour; + Height effectiveHeight = (height == kMiddle && colour == kWhite) ? kBottom : height; + + verbly::filter forward = MakeHintFilter({}, effectiveHeight, effectiveColour, kTowardSolution); + std::vector solutions = database_->forms(forward && GetWordFilter(kTowardSolution, options)).all(); + verbly::form solution = solutions.front();//solutions.at(std::uniform_int_distribution(0, solutions.size())(rng_)); + + verbly::filter questionFilter = MakeHintFilter(solution, effectiveHeight, effectiveColour, kTowardQuestion); + std::vector questions = database_->forms(questionFilter && GetWordFilter(kTowardQuestion, options)).all();//, verbly::order(verbly::form::id), 0).all(); + if (questions.size() < 1) return false; + verbly::form question = questions.front();// questions.at(std::uniform_int_distribution(0, questions.size())(rng_)); + + if (IsClueTrivial(height, effectiveColour, question, solution)) { + return false; + } + + if (options.palindrome != kPalindromeUnspecified) { + std::string reversed = question.getText(); + std::reverse(reversed.begin(), reversed.end()); + + if ((options.palindrome == kForcePalindrome && reversed != question.getText()) || + (options.palindrome == kRejectPalindrome && reversed == question.getText())) { + return false; + } + } + + if (height == kMiddle && colour == kWhite) { + SavePanel(name1, question.getText(), question.getText(), options); + SavePanel(name2, solution.getText(), solution.getText(), options); + if (!options.copy_to.empty() && !options.copy_to2.empty()) { + SavePanel(options.copy_to, question.getText(), question.getText(), options); + SavePanel(options.copy_to2, solution.getText(), solution.getText(), options); + } + } else { + SavePanel(name1, question.getText(), solution.getText(), options); + SavePanel(name2, solution.getText(), question.getText(), options); + if (!options.copy_to.empty() && !options.copy_to2.empty()) { + SavePanel(options.copy_to, question.getText(), solution.getText(), options); + SavePanel(options.copy_to2, solution.getText(), question.getText(), options); + } + } + + return true; +} + +void Generator::GeneratePanelStack(std::string top_name, Colour top_colour, std::string middle_name, Colour middle_colour, std::string bottom_name, Colour bottom_colour, GenerateOptions options) { + while (!GeneratePanelStackImpl(top_name, top_colour, middle_name, middle_colour, bottom_name, bottom_colour, options)); +} + +bool Generator::GeneratePanelStackImpl(std::string top_name, Colour top_colour, std::string middle_name, Colour middle_colour, std::string bottom_name, Colour bottom_colour, GenerateOptions options) { + verbly::form solution; + if (options.reuse_solution) { + const std::string& word = reusable_.at(std::uniform_int_distribution(0, reusable_.size()-1)(rng_)); + if (options.max_answer_len > 0 && word.size() > options.max_answer_len) return false; + solution = database_->forms(verbly::form::text == word).first(); + } else { + verbly::filter forward = GetWordFilter(kTowardSolution, options); + if (!top_name.empty()) { + forward &= MakeHintFilter({}, kTop, top_colour, kTowardSolution); + } + if (!middle_name.empty()) { + forward &= MakeHintFilter({}, kMiddle, middle_colour, kTowardSolution); + } + if (!bottom_name.empty()) { + forward &= MakeHintFilter({}, kBottom, bottom_colour, kTowardSolution); + } + std::vector solutions = database_->forms(forward).all(); + solution = solutions.front();//solutions.at(std::uniform_int_distribution(0, solutions.size())(rng_)); + } + + if (!options.unique_pool.empty() && pools_[options.unique_pool].count(solution.getText())) { + return false; + } + + std::string top_hint; + std::string middle_hint; + std::string bottom_hint; + + if (!top_name.empty()) { + verbly::filter questionFilter = MakeHintFilter(solution, kTop, top_colour, kTowardQuestion); + std::vector questions = database_->forms(questionFilter && GetWordFilter(kTowardQuestion, options), {}, 1).all(); + if (questions.empty()) return false; + top_hint = questions.front().getText(); + + if (IsClueTrivial(kTop, top_colour, questions.front(), solution)) { + return false; + } + } + + if (!middle_name.empty()) { + verbly::filter questionFilter = MakeHintFilter(solution, kMiddle, middle_colour, kTowardQuestion); + std::vector questions = database_->forms(questionFilter && GetWordFilter(kTowardQuestion, options), {}, 1).all(); + if (questions.empty()) return false; + middle_hint = questions.front().getText(); + + if (IsClueTrivial(kMiddle, middle_colour, questions.front(), solution)) { + return false; + } + } + + if (!bottom_name.empty()) { + verbly::filter questionFilter = MakeHintFilter(solution, kBottom, bottom_colour, kTowardQuestion); + std::vector questions = database_->forms(questionFilter && GetWordFilter(kTowardQuestion, options), {}, 1).all(); + if (questions.empty()) return false; + bottom_hint = questions.front().getText(); + + if (IsClueTrivial(kBottom, bottom_colour, questions.front(), solution)) { + return false; + } + } + + if (!top_name.empty()) { + SavePanel(top_name, top_hint, solution.getText(), options); + } + if (!middle_name.empty()) { + SavePanel(middle_name, middle_hint, solution.getText(), options); + } + if (!bottom_name.empty()) { + SavePanel(bottom_name, bottom_hint, solution.getText(), options); + } + + return true; +} + +void Generator::GenerateOrangeNumberPanel(std::string name) { + std::string solution = wanderlust_->GetWord(rng_); + std::string question = ApplyWanderlust(solution); + + SavePanel(name, question, solution); +} + +void Generator::GenerateOrangeWordPanel(std::string name) { + std::string question = wanderlust_->GetWord(rng_); + std::string solution = ApplyWanderlust(question); + + SavePanel(name, question, solution); +} + +void Generator::GenerateOrangeAdditionPanel(std::string name) { + auto [question, solution] = wanderlust_->GetPuzzle(rng_); + + SavePanel(name, question, solution); +} + +void Generator::GenerateOneRoadManyTurns(std::string order_name, std::string part1_name, std::string part2_name, std::string part3_name, std::string part4_name) { + const auto& [part1_q, part1_a] = panels_.at(part1_name); + const auto& [part2_q, part2_a] = panels_.at(part2_name); + const auto& [part3_q, part3_a] = panels_.at(part3_name); + const auto& [part4_q, part4_a] = panels_.at(part4_name); + + SavePanel(order_name, "order", part1_a + " " + part2_a + " " + part3_a + " " + part4_a); +} + +void Generator::GenerateComboPanel(std::string name, Height left_height, Colour left_colour, Height right_height, Colour right_colour, GenerateOptions options) { + while (!GenerateComboPanelImpl(name, left_height, left_colour, right_height, right_colour, options)); +} + +bool Generator::GenerateComboPanelImpl(std::string name, Height left_height, Colour left_colour, Height right_height, Colour right_colour, GenerateOptions options) { + options.force_two_words = true; + + verbly::form solution = database_->forms(GetWordFilter(kTowardSolution, options)).first(); + std::string soltext = solution.getText(); + int spacepos = soltext.find(" "); + std::string leftword = soltext.substr(0, spacepos); + std::string rightword = soltext.substr(spacepos+1); + + options.force_two_words = false; + verbly::filter left_filter = MakeHintFilter(verbly::form::text == leftword, left_height, left_colour, kTowardQuestion); + std::vector left_questions = database_->forms(left_filter && GetWordFilter(kTowardQuestion, options)).all(); + if (left_questions.size() < 1) return false; + verbly::form left_question = left_questions.front(); + + verbly::filter right_filter = MakeHintFilter(verbly::form::text == rightword, right_height, right_colour, kTowardQuestion); + std::vector right_questions = database_->forms(right_filter && GetWordFilter(kTowardQuestion, options)).all(); + if (right_questions.size() < 1) return false; + verbly::form right_question = right_questions.front(); + + SavePanel(name, left_question.getText() + " " + right_question.getText(), soltext, options); + + return true; +} + +void Generator::GenerateCrossTower( + std::string north_tower_name, + std::string south_tower_name, + std::string east_tower_name, + std::string west_tower_name, + std::string north_lookout_name, + std::string south_lookout_name, + std::string east_lookout_name, + std::string west_lookout_name, + std::string north_other_name1, + std::string north_other_name2, + std::string north_other_name3, + std::string south_other_name1, + std::string south_other_name2, + std::string south_other_name3, + std::string east_other_name1, + std::string east_other_name2, + std::string east_other_name3, + std::string west_other_name1, + std::string west_other_name2, + std::string west_other_name3) +{ + std::vector> sets = cross_tower_->GetPuzzleSet(rng_); + +} + +void Generator::SavePanel(std::string name, std::string question, std::string answer, GenerateOptions options) { + if (options.save_for_later) { + reusable_.push_back(answer); + } + + if (!options.unique_pool.empty()) { + pools_[options.unique_pool].insert(answer); + } + + if (options.obscure_hint) { + int numToObscure = (question.size()/3 > 0) ? std::uniform_int_distribution(1, question.size()/3)(rng_) : 1; + std::vector indicies(question.size()); + std::iota(indicies.begin(), indicies.end(), 0); + std::shuffle(indicies.begin(), indicies.end(), rng_); + + for (int i=0; i 0) { + wordFilter &= (verbly::form::length == options.exact_len); + } else if (dir == kTowardSolution && options.max_answer_len > 0) { + wordFilter &= (verbly::form::length <= options.max_answer_len); + } else if (dir == kTowardQuestion && options.max_hint_len > 0) { + wordFilter &= (verbly::form::length <= options.max_hint_len); + } else { + wordFilter &= (verbly::form::length <= 11); + } + + if (options.exact_len == 0) { + wordFilter &= (verbly::form::length >= 3); + } + + if (!options.multiword) { + if (options.force_two_words) { + wordFilter &= (verbly::form::complexity == 2); + } else { + wordFilter &= (verbly::form::complexity == 1); + } + } else { + wordFilter &= ((verbly::form::complexity > 1) || (verbly::form::frequency > 2000000)); + } + + return wordFilter; +} + +bool Generator::IsClueTrivial(Height height, Colour colour, const verbly::form& clue, const verbly::form& solution) const +{ + if (height == kTop && colour == kWhite) + { + return !database_->forms((verbly::filter)clue && (verbly::word::synonyms %= solution)).all().empty(); + } else if (height == kBottom && colour == kWhite) + { + return !database_->forms((verbly::filter)clue && (verbly::form::pronunciations %= solution)).all().empty(); + } else if (height == kBottom && colour == kBlack) + { + return !database_->forms((verbly::filter)clue && (verbly::form::merographs %= solution)).all().empty() + || !database_->forms((verbly::filter)clue && (verbly::form::holographs %= solution)).all().empty(); + } else if ((height == kMiddle || height == kTop) && colour == kPurple) + { + return (clue.getId() == solution.getId()) + || !database_->forms((verbly::filter)clue && (verbly::form::merographs %= solution)).all().empty() + || !database_->forms((verbly::filter)clue && (verbly::form::holographs %= solution)).all().empty(); + } + return false; +} diff --git a/generator.h b/generator.h new file mode 100644 index 0000000..1381cd3 --- /dev/null +++ b/generator.h @@ -0,0 +1,230 @@ +#ifndef GENERATOR_H_811386CE +#define GENERATOR_H_811386CE + +#include +#include +#include +#include +#include +#include +#include + +enum Height { + kTop, + kMiddle, + kBottom, + kHeightCount +}; + +enum Colour { + kWhite, + kBlack, + kRed, + kBlue, + kPurple, + kBrown, + kYellow, + kGreen, + kOrange, + kColourCount +}; + +enum FilterDirection { + kTowardSolution, + kTowardQuestion +}; + +enum PalindromeQuery { + kPalindromeUnspecified, + kForcePalindrome, + kRejectPalindrome +}; + +struct GenerateOptions { + bool obscure_hint = false; + int max_answer_len = 0; + int max_hint_len = 0; + int exact_len = 0; + bool multiword = false; + bool save_for_later = false; + bool reuse_solution = false; // supported by single, double, and stack + std::string unique_pool; // supported by single, double, and stack + PalindromeQuery palindrome = kPalindromeUnspecified; // only important for middle black. supported by single and paired + std::string copy_to; // supported by single and paired + std::string copy_to2; // supported by paired + bool force_two_words = false; +}; + +class Wanderlust { +public: + Wanderlust(const std::string& words_filename, const std::string& puzzles_filename) { + std::ifstream words_file(words_filename); + std::string line; + while (std::getline(words_file, line)) { + words_.push_back(line); + } + + std::ifstream puzzles_file(puzzles_filename); + while (std::getline(puzzles_file, line)) { + std::string line2; + if (!std::getline(puzzles_file, line2)) { + throw std::invalid_argument("Wanderlust file is malformed."); + } + + puzzles_.emplace_back(line, line2); + } + } + + std::tuple GetPuzzle(std::mt19937& rng) const { + return puzzles_.at(std::uniform_int_distribution(0, puzzles_.size()-1)(rng)); + } + + const std::string& GetWord(std::mt19937& rng) const { + return words_.at(std::uniform_int_distribution(0, words_.size()-1)(rng)); + } + +private: + std::vector> puzzles_; + std::vector words_; +}; + +class CrossTower { +public: + explicit CrossTower(std::string filename) { + std::ifstream file(filename); + std::string line; + while (std::getline(file, line)) { + sets_.push_back(hatkirby::split>(line, " ")); + } + } + + std::vector> GetPuzzleSet(std::mt19937& rng) const { + std::vector> result = sets_; + std::shuffle(result.begin(), result.end(), rng); + result.resize(4); + + for (std::vector& set : result) { + std::shuffle(set.begin(), set.end(), rng); + } + + return result; + } + +private: + std::vector> sets_; +}; + +class Generator { +public: + + explicit Generator(unsigned int seed) : seed_(seed), rng_(seed) { + database_ = std::make_unique("/Users/hatkirby/Dropbox/Programming/verbly-datafiles/d1.3_lingo7"); + wanderlust_ = std::make_unique("../wanderlust_words.txt", "../wanderlust_puzzles.txt"); + cross_tower_ = std::make_unique("../cross_tower.txt"); + } + + // Querying + bool IsPanelRandomized(const std::string& name) const { + return panels_.count(name); + } + + const std::tuple& GetPanel(const std::string& name) const { + return panels_.at(name); + } + + // Sets the panel's question and answer to static values. + void GenerateStaticPanel(std::string name, std::string question, std::string answer = ""); + + // Generates a one-block puzzle with the given height and colour. + void GenerateSinglePanel(std::string name, Height height, Colour colour, GenerateOptions options = {}); + + // Generates a one-block puzzle with the given height and colour, where there is a panel on two faces of the block. + // Both puzzles will have the same answer. + void GenerateDoublePanel(std::string name1, std::string name2, Height height, Colour colour, GenerateOptions options = {}); + + // Generates two puzzles with the same hint but different answers. + void GenerateCohintedPanels(std::string name1, std::string name2, Height height, Colour colour, GenerateOptions options = {}); + + // Generates two panels at once, where the question for one is the answer to the other. + // Colour must be white, black, or yellow. + // Middle white is a special case; the puzzles will be antonyms of one another. + void GeneratePairedPanels(std::string name1, std::string name2, Height height, Colour colour, GenerateOptions options = {}); + + // Generates a vertical stack of panels that all have the same answer. + // If a name is left blank, that height will be ignored. + void GeneratePanelStack(std::string top_name, Colour top_colour, std::string middle_name, Colour middle_colour, std::string bottom_name, Colour bottom_colour, GenerateOptions options = {}); + + // Generate an orange puzzle, with a number for the hint. + void GenerateOrangeNumberPanel(std::string name); + + // Generate an orange puzzle, with a word for the hint. + void GenerateOrangeWordPanel(std::string name); + + // Generate an orange puzzle, with an addition problem for the hint. + void GenerateOrangeAdditionPanel(std::string name); + + // Generates the ONE ROAD MANY TURNS panel by combining the solutions to four other panels. + void GenerateOneRoadManyTurns(std::string order_name, std::string part1_name, std::string part2_name, std::string part3_name, std::string part4_name); + + // Generates a hybrid puzzle where the solution is two words and each word is provided by a different colour/height puzzle. + void GenerateComboPanel(std::string name, Height left_height, Colour left_colour, Height right_height, Colour right_colour, GenerateOptions options = {}); + + // Generates the cross tower sets-of-four puzzles. + void GenerateCrossTower( + std::string north_tower_name, + std::string south_tower_name, + std::string east_tower_name, + std::string west_tower_name, + std::string north_lookout_name, + std::string south_lookout_name, + std::string east_lookout_name, + std::string west_lookout_name, + std::string north_other_name1, + std::string north_other_name2, + std::string north_other_name3, + std::string south_other_name1, + std::string south_other_name2, + std::string south_other_name3, + std::string east_other_name1, + std::string east_other_name2, + std::string east_other_name3, + std::string west_other_name1, + std::string west_other_name2, + std::string west_other_name3); + +private: + + verbly::filter MakeHintFilter(verbly::filter subfilter, Height height, Colour colour, FilterDirection filter_direction); + + bool GenerateSinglePanelImpl(std::string name, Height height, Colour colour, GenerateOptions options); + + bool GenerateDoublePanelImpl(std::string name1, std::string name2, Height height, Colour colour, GenerateOptions options); + + bool GenerateCohintedPanelsImpl(std::string name1, std::string name2, Height height, Colour colour, GenerateOptions options); + + bool GeneratePairedPanelsImpl(std::string name1, std::string name2, Height height, Colour colour, GenerateOptions options); + + bool GeneratePanelStackImpl(std::string top_name, Colour top_colour, std::string middle_name, Colour middle_colour, std::string bottom_name, Colour bottom_colour, GenerateOptions options); + + bool GenerateComboPanelImpl(std::string name, Height left_height, Colour left_colour, Height right_height, Colour right_colour, GenerateOptions options); + + void SavePanel(std::string name, std::string question, std::string answer, GenerateOptions options = {}); + + verbly::filter GetWordFilter(FilterDirection direction, GenerateOptions options) const; + + bool IsClueTrivial(Height height, Colour colour, const verbly::form& clue, const verbly::form& solution) const; + + unsigned int seed_; + std::mt19937 rng_; + std::unique_ptr database_; + std::unique_ptr wanderlust_; + std::unique_ptr cross_tower_; + + // name, question, answer + std::map> panels_; + + std::vector reusable_; + std::map> pools_; +}; + +#endif /* end of include guard: GENERATOR_H_811386CE */ diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..ab19805 --- /dev/null +++ b/main.cpp @@ -0,0 +1,550 @@ +#include +#include +#include +#include +#include "generator.h" + +class Randomizer { +public: + + explicit Randomizer(unsigned int seed) : seed_(seed), gen_(seed) {} + + void Run() { + // Entry room + gen_.GenerateStaticPanel("Panel_hi_hi", "hewwo"); + gen_.GenerateStaticPanel("Panel_type_type", "mode"); + gen_.GenerateStaticPanel("Panel_this_this", "normal"); + gen_.GenerateStaticPanel("Panel_write_write", "random seed"); + gen_.GenerateStaticPanel("Panel_same_same", std::to_string(seed_)); + gen_.GenerateSinglePanel("Panel_hidden_hidden", kMiddle, kWhite); + gen_.GenerateSinglePanel("Panel_hi_high", kTop, kWhite); + gen_.GenerateSinglePanel("Panel_low_low", kBottom, kWhite, {.max_answer_len = 7}); + gen_.GenerateSinglePanel("Panel_forward_forward", kMiddle, kWhite, {.obscure_hint = true, .max_answer_len = 20}); + gen_.GenerateSinglePanel("Panel_between_between", kMiddle, kWhite, {.obscure_hint = true, .max_answer_len = 20}); + gen_.GenerateSinglePanel("Panel_backward_backward", kMiddle, kWhite, {.obscure_hint = true, .max_answer_len = 20}); + gen_.GenerateSinglePanel("Panel_secret_secret", kMiddle, kWhite, {.obscure_hint = true, .max_answer_len = 20}); + + // The Traveled + gen_.GenerateSinglePanel("Panel_open_open", kMiddle, kWhite, {.obscure_hint = true, .unique_pool = "traveled"}); + gen_.GenerateSinglePanel("Panel_close_near", kBottom, kWhite, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "traveled"}); + gen_.GenerateDoublePanel("Panel_compose_write", "Panel_record_write", kBottom, kWhite, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "traveled"}); + gen_.GenerateSinglePanel("Panel_category_type", kBottom, kWhite, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "traveled"}); + gen_.GenerateSinglePanel("Panel_hello_hi", kBottom, kWhite, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "traveled"}); + gen_.GenerateDoublePanel("Panel_duplicate_same", "Panel_identical_same", kBottom, kWhite, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "traveled"}); + gen_.GenerateSinglePanel("Panel_distant_far", kBottom, kWhite, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "traveled"}); + gen_.GenerateSinglePanel("Panel_hay_straw", kBottom, kWhite, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "traveled"}); + gen_.GenerateDoublePanel("Panel_giggle_laugh", "Panel_chuckle_laugh", kBottom, kWhite, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "traveled"}); + gen_.GenerateSinglePanel("Panel_snitch_rat", kBottom, kWhite, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "traveled"}); + gen_.GenerateSinglePanel("Panel_concealed_hidden", kBottom, kWhite, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "traveled"}); + gen_.GenerateDoublePanel("Panel_plunge_fall", "Panel_autumn_fall", kBottom, kWhite, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "traveled"}); + gen_.GenerateSinglePanel("Panel_growths_warts", kBottom, kWhite, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "traveled"}); + + // The Agreeable + gen_.GenerateSinglePanel("Panel_close_open", kBottom, kBlack, {.max_answer_len = 6, .unique_pool = "agreeable"}); + gen_.GenerateSinglePanel("Panel_retool_looter", kMiddle, kBlack, {.save_for_later = true, .unique_pool = "agreeable", .palindrome = kRejectPalindrome}); + gen_.GenerateSinglePanel("Panel_drawer_reward", kMiddle, kBlack, {.save_for_later = true, .unique_pool = "agreeable", .palindrome = kRejectPalindrome}); + gen_.GenerateSinglePanel("Panel_read_write", kBottom, kBlack, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "agreeable"}); + gen_.GenerateSinglePanel("Panel_different_same", kBottom, kBlack, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "agreeable"}); + gen_.GenerateSinglePanel("Panel_bye_hi", kBottom, kBlack, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "agreeable"}); + gen_.GenerateSinglePanel("Panel_low_high", kBottom, kBlack, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "agreeable"}); + gen_.GenerateSinglePanel("Panel_alive_dead", kBottom, kBlack, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "agreeable"}); + gen_.GenerateSinglePanel("Panel_that_this", kBottom, kBlack, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "agreeable"}); + gen_.GenerateSinglePanel("Panel_stressed_desserts", kMiddle, kBlack, {.unique_pool = "agreeable", .palindrome = kRejectPalindrome}); + gen_.GenerateSinglePanel("Panel_star_rats", kMiddle, kBlack, {.unique_pool = "agreeable", .palindrome = kRejectPalindrome}); + gen_.GenerateSinglePanel("Panel_tame_mate", kTop, kBlack, {.unique_pool = "agreeable"}); + gen_.GenerateSinglePanel("Panel_cat_tack", kTop, kBlack, {.unique_pool = "agreeable"}); + gen_.GeneratePairedPanels("Panel_leaf_feel", "Panel_feel_leaf", kTop, kBlack, {.obscure_hint = true, .save_for_later = true}); + gen_.GeneratePairedPanels("Panel_warts_straw", "Panel_straw_warts", kMiddle, kBlack, {.obscure_hint = true, .save_for_later = true, .palindrome = kRejectPalindrome}); + gen_.GeneratePairedPanels("Panel_near_far", "Panel_far_near", kBottom, kBlack, {.obscure_hint = true, .save_for_later = true}); + // Panel_left_wrong: left? wrong! + gen_.GenerateSinglePanel("Panel_black_white", kBottom, kBlack, {.max_answer_len = 7}); + gen_.GeneratePairedPanels("Panel_left_right", "Panel_right_left", kBottom, kBlack, {.obscure_hint = true}); + + // The Seeker + gen_.GenerateSinglePanel("Panel_entrance_entrance", kMiddle, kWhite, {.obscure_hint = true, .save_for_later = true, .unique_pool = "seeker"}); + gen_.GenerateSinglePanel("Panel_bear_bear", kMiddle, kWhite, {.obscure_hint = true, .save_for_later = true, .unique_pool = "seeker"}); + gen_.GenerateDoublePanel("Panel_mine_mine", "Panel_mine_mine_2", kMiddle, kWhite, {.obscure_hint = true, .save_for_later = true, .unique_pool = "seeker"}); + gen_.GenerateSinglePanel("Panel_bow_bow", kMiddle, kWhite, {.obscure_hint = true, .save_for_later = true, .unique_pool = "seeker"}); + gen_.GenerateSinglePanel("Panel_does_does", kMiddle, kWhite, {.obscure_hint = true, .save_for_later = true, .unique_pool = "seeker"}); + gen_.GenerateDoublePanel("Panel_mobile_mobile", "Panel_mobile_mobile_2", kMiddle, kWhite, {.obscure_hint = true, .save_for_later = true, .unique_pool = "seeker"}); + gen_.GeneratePanelStack("Panel_desert_dessert", kWhite, "Panel_desert_desert", kWhite, "", {}, {.obscure_hint = true, .save_for_later = true, .unique_pool = "seeker"}); + gen_.GeneratePanelStack("Panel_sow_so", kWhite, "Panel_sow_sow", kWhite, "", {}, {.obscure_hint = true, .save_for_later = true, .unique_pool = "seeker"}); + gen_.GenerateDoublePanel("Panel_two_to", "Panel_two_too", kTop, kWhite, {.save_for_later = true, .unique_pool = "seeker"}); + gen_.GenerateSinglePanel("Panel_write_right", kTop, kWhite, {.save_for_later = true, .unique_pool = "seeker"}); + gen_.GenerateSinglePanel("Panel_you_ewe", kTop, kWhite, {.save_for_later = true, .unique_pool = "seeker"}); + gen_.GenerateDoublePanel("Panel_not_knot", "Panel_not_naught", kTop, kWhite, {.save_for_later = true, .unique_pool = "seeker"}); + gen_.GenerateSinglePanel("Panel_bear_bare", kTop, kWhite, {.save_for_later = true, .unique_pool = "seeker"}); + + // The Tenacious + gen_.GenerateSinglePanel("Panel_slaughter_laughter", kMiddle, kRed, {.unique_pool = "tenacious"}); + gen_.GenerateSinglePanel("Panel_dread_dead", kMiddle, kRed, {.unique_pool = "tenacious"}); + gen_.GenerateSinglePanel("Panel_massacred_sacred", kMiddle, kRed, {.unique_pool = "tenacious"}); + gen_.GenerateSinglePanel("Panel_decay_day", kMiddle, kRed, {.unique_pool = "tenacious"}); + gen_.GeneratePairedPanels("Panel_solos_solos", "Panel_solos_solos_2", kMiddle, kBlack, {.palindrome = kForcePalindrome}); + gen_.GeneratePairedPanels("Panel_racecar_racecar", "Panel_racecar_racecar_2", kMiddle, kBlack, {.palindrome = kForcePalindrome}); + gen_.GeneratePairedPanels("Panel_level_level", "Panel_level_level_2", kMiddle, kBlack, {.palindrome = kForcePalindrome}); + + // The Bold + gen_.GenerateSinglePanel("Panel_heartbreak_brake", kTop, kRed, {.save_for_later = true, .unique_pool = "bold"}); + gen_.GenerateSinglePanel("Panel_airplane_plain", kTop, kRed, {.save_for_later = true, .unique_pool = "bold"}); + gen_.GenerateSinglePanel("Panel_nightmare_knight", kTop, kRed, {.save_for_later = true, .unique_pool = "bold"}); + gen_.GenerateSinglePanel("Panel_sign_sigh", kTop, kRed, {.save_for_later = true, .unique_pool = "bold"}); + gen_.GenerateSinglePanel("Panel_unopened_open", kMiddle, kRed, {.save_for_later = true, .unique_pool = "bold"}); + gen_.GenerateDoublePanel("Panel_undead_dead", "Panel_deadline_dead", kMiddle, kRed, {.save_for_later = true, .unique_pool = "bold"}); + gen_.GenerateSinglePanel("Panel_sushi_hi", kMiddle, kRed, {.reuse_solution = true, .unique_pool = "bold"}); + gen_.GenerateSinglePanel("Panel_thistle_this", kMiddle, kRed, {.reuse_solution = true, .unique_pool = "bold"}); + gen_.GenerateDoublePanel("Panel_landmass_mass", "Panel_massacred_mass", kMiddle, kRed, {.save_for_later = true, .unique_pool = "bold"}); + gen_.GenerateDoublePanel("Panel_face_eye", "Panel_needle_eye", kBottom, kRed, {.max_answer_len = 6, .unique_pool = "bold"}); + gen_.GenerateSinglePanel("Panel_foot_toe", kBottom, kRed, {.max_answer_len = 6, .unique_pool = "bold"}); + gen_.GenerateDoublePanel("Panel_mouth_teeth", "Panel_saw_teeth", kBottom, kRed, {.max_answer_len = 6, .unique_pool = "bold"}); + gen_.GenerateSinglePanel("Panel_hand_finger", kBottom, kRed, {.max_answer_len = 6, .unique_pool = "bold"}); + + // The Steady + + // The Undeterred + gen_.GenerateSinglePanel("Panel_two_toucan", kTop, kBlue, {.unique_pool = "undeterred", .reuse_solution = true}); + gen_.GenerateDoublePanel("Panel_ice_eyesight", "Panel_height_eyesight", kTop, kBlue, {.unique_pool = "undeterred", .max_answer_len = 6}); + gen_.GenerateSinglePanel("Panel_eye_hi", kTop, kBlue, {.unique_pool = "undeterred", .reuse_solution = true}); + gen_.GenerateSinglePanel("Panel_pen_open", kMiddle, kBlue, {.max_answer_len = 4, .unique_pool = "undeterred"}); + gen_.GenerateSinglePanel("Panel_not_notice", kMiddle, kBlue, {.unique_pool = "undeterred", .max_answer_len = 6}); + gen_.GenerateDoublePanel("Panel_just_readjust", "Panel_read_readjust", kMiddle, kBlue, {.unique_pool = "undeterred"}); + gen_.GenerateSinglePanel("Panel_ate_primate", kMiddle, kBlue, {.unique_pool = "undeterred", .reuse_solution = true}); + gen_.GenerateSinglePanel("Panel_bone_skeleton", kBottom, kBlue, {.max_answer_len = 7, .unique_pool = "undeterred"}); + gen_.GenerateDoublePanel("Panel_mouth_face", "Panel_eye_face", kBottom, kBlue, {.max_answer_len = 4, .unique_pool = "undeterred"}); + gen_.GenerateSinglePanel("Panel_toucan_bird", kBottom, kBlue, {.max_answer_len = 4, .unique_pool = "undeterred"}); + gen_.GenerateSinglePanel("Panel_primate_mammal", kBottom, kBlue, {.max_answer_len = 6, .unique_pool = "undeterred"}); + gen_.GenerateDoublePanel("Panel_continent_planet", "Panel_ocean_planet", kBottom, kBlue, {.max_answer_len = 6, .unique_pool = "undeterred"}); + gen_.GenerateSinglePanel("Panel_wall_room", kBottom, kBlue, {.max_answer_len = 4, .unique_pool = "undeterred"}); + + // The Discerning + gen_.GenerateSinglePanel("Panel_nope_open", kMiddle, kYellow, {.max_answer_len = 4, .unique_pool = "discerning"}); + gen_.GenerateSinglePanel("Panel_hits_this", kMiddle, kYellow, {.save_for_later = true, .unique_pool = "discerning"}); + gen_.GenerateDoublePanel("Panel_warred_drawer", "Panel_redraw_drawer", kMiddle, kYellow, {.save_for_later = true, .unique_pool = "discerning"}); + gen_.GenerateSinglePanel("Panel_adder_dread", kMiddle, kYellow, {.save_for_later = true, .unique_pool = "discerning"}); + gen_.GenerateSinglePanel("Panel_laughters_slaughter", kMiddle, kYellow, {.save_for_later = true, .unique_pool = "discerning"}); + gen_.GenerateDoublePanel("Panel_stone_notes", "Panel_onset_notes", kMiddle, kYellow, {.save_for_later = true, .unique_pool = "discerning"}); + gen_.GenerateSinglePanel("Panel_rat_art", kMiddle, kYellow, {.save_for_later = true, .unique_pool = "discerning"}); + gen_.GenerateSinglePanel("Panel_dusty_study", kMiddle, kYellow, {.save_for_later = true, .unique_pool = "discerning"}); + gen_.GenerateDoublePanel("Panel_arts_star", "Panel_tsar_star", kMiddle, kYellow, {.save_for_later = true, .unique_pool = "discerning"}); + gen_.GenerateSinglePanel("Panel_state_taste", kMiddle, kYellow, {.save_for_later = true, .unique_pool = "discerning"}); + gen_.GenerateSinglePanel("Panel_react_trace", kMiddle, kYellow, {.save_for_later = true, .unique_pool = "discerning"}); + gen_.GenerateDoublePanel("Panel_dear_read", "Panel_dare_read", kMiddle, kYellow, {.save_for_later = true, .unique_pool = "discerning"}); + gen_.GenerateSinglePanel("Panel_seam_same", kMiddle, kYellow, {.save_for_later = true, .unique_pool = "discerning"}); + + // Crossroads + gen_.GeneratePairedPanels("Panel_sword_words", "Panel_words_sword", kMiddle, kYellow); + gen_.GeneratePairedPanels("Panel_turn_runt", "Panel_turn_runt2", kMiddle, kYellow); + // Panel_runt3: runt? return! + gen_.GenerateSinglePanel("Panel_corner", kTop, kYellow, {.multiword = true}); + gen_.GenerateSinglePanel("Panel_order_chaos", kBottom, kBlack, {.max_answer_len = 7}); + gen_.GenerateSinglePanel("Panel_swap_wasp", kMiddle, kYellow); + gen_.GenerateCohintedPanels("Panel_lost_lots", "Panel_lost_slot", kMiddle, kYellow); + gen_.GenerateSinglePanel("Panel_gel", kTop, kYellow); + gen_.GenerateSinglePanel("Panel_though", kTop, kYellow); + gen_.GenerateSinglePanel("Panel_eyes_see_shuffle", kMiddle, kYellow, {.multiword = true}); + gen_.GenerateSinglePanel("Panel_theeyes_theeyes", kMiddle, kWhite, {.multiword = true, .obscure_hint = true, .max_answer_len = 20}); + gen_.GenerateDoublePanel("Panel_amen_mean", "Panel_name_mean", kMiddle, kYellow); + gen_.GenerateSinglePanel("Panel_behind", kMiddle, kYellow, {.multiword = true}); + gen_.GenerateSinglePanel("Panel_crossroads_crossroads", kMiddle, kWhite, {.obscure_hint = true, .max_answer_len = 20}); + gen_.GenerateSinglePanel("Panel_corner_corner", kMiddle, kWhite, {.obscure_hint = true, .max_answer_len = 20}); + gen_.GenerateSinglePanel("Panel_hollow_hollow", kMiddle, kWhite, {.obscure_hint = true, .max_answer_len = 20}); + gen_.GeneratePairedPanels("Panel_far_far", "Panel_near_near", kMiddle, kWhite, {.obscure_hint = true, .max_answer_len = 20}); + gen_.GenerateSinglePanel("Panel_lost_found", kBottom, kBlack, {.max_answer_len = 7}); + gen_.GenerateSinglePanel("Panel_clockwise_counterclockwise", kBottom, kBlack, {.max_answer_len = 20}); + + // Panel_past_present: past? present! + // Panel_future_present: future? present! + // Panel_future_past: future? past! + // Panel_past_future: past? future! + // Panel_past_past: past? past! + // Panel_pinecone_pine: pinecone? pine! + // Panel_acorn_oak: acorn? oak! + + gen_.GeneratePairedPanels("Panel_left_left", "Panel_right_right", kMiddle, kWhite, {.obscure_hint = true, .max_answer_len = 20, .copy_to = "Panel_left_left_2", .copy_to2 = "Panel_right_right_2"}); + gen_.GenerateSinglePanel("Panel_middle_middle", kMiddle, kWhite, {.obscure_hint = true, .max_answer_len = 20, .copy_to = "Panel_middle_middle_2"}); + gen_.GenerateSinglePanel("Panel_shortcuts", kMiddle, kYellow, {.multiword = true}); + gen_.GenerateSinglePanel("Panel_tower", kMiddle, kYellow, {.multiword = true}); + + // The Perceptive + gen_.GenerateSinglePanel("Panel_trace_trace", kMiddle, kWhite, {.obscure_hint = true}); + // Panel_path_lock: path? lock! + // Panel_path_knot: path? knot! + // Panel_path_lost: path? lost! + gen_.GenerateSinglePanel("Panel_look_look", kBottom, kWhite, {.max_answer_len = 7}); + // Panel_path_open: path? open! + // Panel_path_help: path? help! + // Panel_path_hunt: path? hunt! + // Panel_path_nest: path? nest! + // Panel_path_look: path? look! + gen_.GenerateSinglePanel("Panel_down_up", kBottom, kBlack, {.max_answer_len = 7}); + gen_.GenerateSinglePanel("Panel_strays_maze", kTop, kPurple, {.reuse_solution = true}); + gen_.GenerateSinglePanel("Panel_daze_maze", kMiddle, kPurple, {.max_answer_len = 6, .reuse_solution = true}); + gen_.GenerateSinglePanel("Panel_reflow_flower", kMiddle, kYellow); + gen_.GenerateSinglePanel("Panel_leap_jump", kBottom, kWhite, {.max_answer_len = 7}); + gen_.GenerateSinglePanel("Panel_hide_seek", kBottom, kBlack, {.max_answer_len = 7}); + gen_.GenerateSinglePanel("Panel_hide_seek_2", kBottom, kBlack, {.max_answer_len = 7}); + gen_.GenerateSinglePanel("Panel_hide_seek_3", kBottom, kBlack, {.max_answer_len = 7}); + gen_.GenerateSinglePanel("Panel_hide_seek_4", kBottom, kBlack, {.max_answer_len = 7}); + + // The Observant + + // Knight/Night + gen_.GenerateSinglePanel("Panel_rat_tar", kMiddle, kBlack, {.palindrome = kRejectPalindrome}); + gen_.GenerateSinglePanel("Panel_discover_recover", kMiddle, kPurple, {.max_answer_len = 7}); + gen_.GenerateSinglePanel("Panel_deadend_deadened", kTop, kWhite, {.multiword = true}); + gen_.GenerateSinglePanel("Panel_deadend_deadend", kMiddle, kWhite, {.multiword = true, .obscure_hint = true}); + gen_.GenerateSinglePanel("Panel_warner_corner", kTop, kPurple); + gen_.GenerateSinglePanel("Panel_lies_lies", kMiddle, kWhite, {.obscure_hint = true, .max_answer_len = 20}); + gen_.GeneratePairedPanels("Panel_night_knight", "Panel_knight_night", kMiddle, kBlue); + gen_.GenerateSinglePanel("Panel_bee_be", kMiddle, kRed); + gen_.GenerateSinglePanel("Panel_new_knew", kMiddle, kBlue, {.max_answer_len = 4}); + gen_.GenerateSinglePanel("Panel_fore_for", kMiddle, kRed); + gen_.GenerateCohintedPanels("Panel_trusted_trust", "Panel_trusted_rusted", kMiddle, kRed, {.save_for_later = true}); + gen_.GenerateCohintedPanels("Panel_rust_trust", "Panel_rust_crust", kMiddle, kBlue, {.max_answer_len = 5, .save_for_later = true}); + gen_.GenerateSinglePanel("Panel_encrusted_rust", kMiddle, kRed, {.save_for_later = true}); + gen_.GenerateCohintedPanels("Panel_adjust_readjust", "Panel_adjust_adjusted", kMiddle, kBlue, {.max_answer_len = 6, .save_for_later = true}); + gen_.GenerateSinglePanel("Panel_adjust_readjusted", kMiddle, kBlue, {.save_for_later = true}); + gen_.GeneratePairedPanels("Panel_before_fore", "Panel_be_before", kMiddle, kRed, {.obscure_hint = true}); + gen_.GenerateSinglePanel("Panel_trust_crust", kMiddle, kPurple, {.reuse_solution = true}); + gen_.GenerateSinglePanel("Panel_trust_crust_2", kMiddle, kPurple, {.reuse_solution = true}); + gen_.GenerateSinglePanel("Panel_trusted_readjusted", kMiddle, kPurple, {.reuse_solution = true}); + + // The Initiated + gen_.GenerateSinglePanel("Panel_locked_knocked", kMiddle, kPurple, {.max_hint_len = 5, .max_answer_len = 5, .reuse_solution = true, .unique_pool = "initiated"}); + gen_.GenerateSinglePanel("Panel_daughter_laughter", kMiddle, kPurple, {.reuse_solution = true, .unique_pool = "initiated"}); + gen_.GenerateDoublePanel("Panel_move_love", "Panel_stove_love", kMiddle, kPurple, {.reuse_solution = true, .unique_pool = "initiated"}); + gen_.GenerateSinglePanel("Panel_scope_type", kMiddle, kPurple, {.reuse_solution = true, .unique_pool = "initiated"}); + gen_.GenerateSinglePanel("Panel_abyss_this", kMiddle, kPurple, {.max_hint_len = 6, .reuse_solution = true, .unique_pool = "initiated"}); + gen_.GenerateDoublePanel("Panel_sweat_great", "Panel_beat_great", kMiddle, kPurple, {.max_hint_len = 6, .reuse_solution = true, .unique_pool = "initiated"}); + gen_.GenerateSinglePanel("Panel_alumni_hi", kTop, kPurple, {.reuse_solution = true, .unique_pool = "initiated"}); + gen_.GenerateSinglePanel("Panel_wrath_path", kMiddle, kPurple, {.max_hint_len = 6, .reuse_solution = true, .unique_pool = "initiated"}); + gen_.GenerateDoublePanel("Panel_knight_write", "Panel_byte_write", kTop, kPurple, {.reuse_solution = true, .unique_pool = "initiated"}); + gen_.GenerateSinglePanel("Panel_maim_same", kTop, kPurple, {.reuse_solution = true, .unique_pool = "initiated"}); + gen_.GenerateSinglePanel("Panel_bare_bear", kTop, kPurple, {.reuse_solution = true, .unique_pool = "initiated"}); + gen_.GeneratePanelStack("Panel_chair_bear", kPurple, "", {}, "Panel_cost_most", kPurple, {.reuse_solution = true, .unique_pool = "initiated"}); + gen_.GenerateSinglePanel("Panel_bed_dead", kMiddle, kPurple, {.max_hint_len = 6, .reuse_solution = true, .unique_pool = "initiated"}); + + // The Bearer + // Panel_north_missing: ? north! + // Panel_diamonds_missing: ? diamonds! + // Panel_fire_missing: ? fire! + // Panel_winter_missing: ? winter! + gen_.GenerateSinglePanel("Panel_shortcut_shortcut", kMiddle, kWhite, {.obscure_hint = true, .max_answer_len = 20}); + // Panel_north_north: ? north! + // Panel_mouth_south: sound? south! + // Panel_yeast_east: yeast? east! + // Panel_wet_west: wet? west! + // Panel_fire_fire: ? fire! + // Panel_earth_earth: earth? earth! + // Panel_water_water: water? water! + // Panel_air_air: air? air! + // Panel_winter_winter: ? winter! + // Panel_diamonds_diamonds: ? diamonds! + // Panel_spades_spades: spades? spades! + // Panel_clubs_clubs: clubs? clubs! + // Panel_hearts_hearts: hearts? hearts! + // Panel_part_rap: part? rap! + // Panel_heart_tar: heart? tar! + // Panel_smile_lime: smile? lime! + // Panel_snow_won: snow? won! + // Panel_warts_star: warts? star! + // Panel_pots_top: pots? top! + // Panel_silent_list: silent? list! + // Panel_silent_list_2: silent? list! + // Panel_tent_net: tent? net! + // Panel_peace_ape: peace? ape! + // Panel_space_cape: space? cape! + // Panel_bowl_low: bowl? low! + + // Wanderlust + gen_.GenerateOrangeNumberPanel("Panel_lust"); + gen_.GenerateOrangeNumberPanel("Panel_read"); + gen_.GenerateOrangeNumberPanel("Panel_sew"); + gen_.GenerateOrangeNumberPanel("Panel_dead"); + gen_.GenerateOrangeNumberPanel("Panel_1234567890_wanderlust"); + gen_.GenerateOrangeNumberPanel("Panel_834283054_undaunted"); + gen_.GenerateOrangeWordPanel("Panel_learn"); + gen_.GenerateOrangeWordPanel("Panel_dust"); + gen_.GenerateOrangeWordPanel("Panel_star"); + gen_.GenerateOrangeWordPanel("Panel_wander"); + gen_.GenerateOrangeWordPanel("Panel_wanderlust_1234567890"); + gen_.GenerateOrangeAdditionPanel("Panel_dads_ale_dead_1"); + gen_.GenerateOrangeAdditionPanel("Panel_art_art_eat_2"); + gen_.GenerateOrangeAdditionPanel("Panel_deer_wren_rats_3"); + gen_.GenerateOrangeAdditionPanel("Panel_learns_unsew_unrest_4"); + gen_.GenerateOrangeAdditionPanel("Panel_drawl_runs_enter_5"); + gen_.GenerateOrangeAdditionPanel("Panel_reads_rust_lawns_6"); + gen_.GenerateOrangeAdditionPanel("Panel_waded_wee_warts_7"); + + // The Wise + // Panel_kitten_cat: kitten? cat! + // Panel_cat_kitten: cat? kitten! + // Panel_puppy_dog: puppy? dog! + // Panel_adult_child: adult? child! + // Panel_bread_mold: bread? mold! + // Panel_dinosaur_fossil: dinosaur? fossil! + // Panel_oak_acorn: oak? acorn! + // Panel_corpse_skeleton: corpse? skeleton! + // Panel_before_ere: before? ere! + // Panel_your_thy: your? thy! + // Panel_betwixt_between: betwixt? between! + // Panel_nigh_near: nigh? near! + // Panel_connexion_connection: connexion? connection! + // Panel_thou_you: thou? you! + + // Art Gallery + gen_.GenerateSinglePanel("Panel_eon_one", kMiddle, kYellow, {.max_answer_len = 5}); + gen_.GenerateSinglePanel("Panel_to_two", kMiddle, kRed); + gen_.GenerateSinglePanel("Panel_free_three", kMiddle, kPurple, {.reuse_solution = true, .max_hint_len = 5}); + gen_.GenerateSinglePanel("Panel_our_four", kMiddle, kBlue, {.reuse_solution = true}); + gen_.GenerateSinglePanel("Panel_house_neighborhood", kBottom, kBlue, {.max_answer_len = 6}); + gen_.GenerateStaticPanel("Panel_path_road", "path", "road"); // can't randomise brown yet + gen_.GenerateSinglePanel("Panel_park_drive", kBottom, kBlack, {.max_answer_len = 6}); + gen_.GenerateSinglePanel("Panel_carriage_horse", kBottom, kRed, {.max_answer_len = 6}); + gen_.GenerateSinglePanel("Panel_an_many", kMiddle, kBlue, {.max_answer_len = 4}); + gen_.GenerateSinglePanel("Panel_may_many", kMiddle, kBlue, {.max_answer_len = 4}); + gen_.GenerateSinglePanel("Panel_any_many", kMiddle, kBlue, {.max_answer_len = 4}); + gen_.GenerateSinglePanel("Panel_man_many", kMiddle, kBlue, {.max_answer_len = 4}); + gen_.GenerateSinglePanel("Panel_urns_turns", kMiddle, kBlue, {.reuse_solution = true}); + gen_.GenerateSinglePanel("Panel_learns_turns", kMiddle, kPurple, {.reuse_solution = true, .max_answer_len = 5}); + gen_.GenerateSinglePanel("Panel_runts_turns", kMiddle, kYellow); + gen_.GenerateOrangeAdditionPanel("Panel_send_use_turns"); + gen_.GenerateOrangeWordPanel("Panel_trust_06890"); + gen_.GenerateOrangeNumberPanel("Panel_06890_trust"); + gen_.GenerateOneRoadManyTurns("Panel_order_onepathmanyturns", "Panel_eon_one", "Panel_path_road", "Panel_any_many", "Panel_send_use_turns"); + + // Rhyme Rooms + gen_.GeneratePanelStack("Panel_ascend_rhyme", kPurple, "", {}, "Panel_ascend_syn", kWhite, {.unique_pool = "rhyme"}); + gen_.GeneratePanelStack("Panel_double_rhyme", kPurple, "", {}, "Panel_double_syn", kWhite, {.unique_pool = "rhyme"}); + gen_.GeneratePanelStack("Panel_blocked_rhyme", kPurple, "", {}, "Panel_blocked_syn", kWhite, {.unique_pool = "rhyme"}); + gen_.GeneratePanelStack("Panel_rise_rhyme", kPurple, "", {}, "Panel_rise_syn", kWhite, {.unique_pool = "rhyme"}); + gen_.GeneratePanelStack("Panel_crystal_rhyme", kPurple, "", {}, "Panel_crystal_syn", kWhite, {.unique_pool = "rhyme"}); + gen_.GeneratePanelStack("Panel_creative_rhyme", kPurple, "", {}, "Panel_creative_syn", kWhite, {.unique_pool = "rhyme"}); + gen_.GeneratePanelStack("Panel_child_rhyme", kPurple, "", {}, "Panel_child_syn", kWhite, {.unique_pool = "rhyme"}); + gen_.GeneratePanelStack("Panel_hidden_rhyme", kPurple, "", {}, "Panel_hidden_syn", kWhite, {.unique_pool = "rhyme"}); + gen_.GeneratePanelStack("Panel_word_rhyme", kPurple, "", {}, "Panel_word_whole", kBlue, {.unique_pool = "rhyme"}); + gen_.GeneratePanelStack("Panel_silent_rhyme", kPurple, "", {}, "Panel_silent_syn", kWhite, {.unique_pool = "rhyme"}); + gen_.GeneratePanelStack("Panel_bones_rhyme", kPurple, "", {}, "Panel_bones_syn", kWhite, {.unique_pool = "rhyme"}); + gen_.GeneratePanelStack("Panel_sentence_rhyme", kPurple, "", {}, "Panel_sentence_whole", kBlue, {.unique_pool = "rhyme"}); + gen_.GeneratePanelStack("Panel_dream_rhyme", kPurple, "", {}, "Panel_dream_syn", kWhite, {.unique_pool = "rhyme"}); + gen_.GeneratePanelStack("Panel_mystery_rhyme", kPurple, "", {}, "Panel_mystery_syn", kWhite, {.unique_pool = "rhyme"}); + gen_.GeneratePanelStack("Panel_jump_rhyme", kPurple, "", {}, "Panel_jump_syn", kWhite, {.unique_pool = "rhyme"}); + gen_.GeneratePanelStack("Panel_fall_rhyme", kPurple, "", {}, "Panel_fall_syn", kWhite, {.unique_pool = "rhyme"}); + //gen_.GeneratePanelStack("Panel_return_rhyme", kPurple, "", {}, "Panel_return_ant", kBlack, {.unique_pool = "rhyme"}); + //gen_.GeneratePanelStack("Panel_descend_rhyme", kPurple, "", {}, "Panel_descend_ant", kBlack, {.unique_pool = "rhyme"}); + // ^ commenting those out for now because they take disproportionately long to generate currently + gen_.GenerateSinglePanel("Panel_leap_leap", kMiddle, kWhite, {.obscure_hint = true}); + + // The Optimistic + gen_.GenerateSinglePanel("Panel_backside_1", kMiddle, kWhite, {.obscure_hint = true}); + gen_.GenerateSinglePanel("Panel_backside_2", kMiddle, kWhite, {.obscure_hint = true}); + gen_.GenerateSinglePanel("Panel_backside_3", kMiddle, kWhite, {.obscure_hint = true}); + gen_.GenerateSinglePanel("Panel_backside_4", kMiddle, kWhite, {.obscure_hint = true}); + gen_.GenerateSinglePanel("Panel_backside_5", kMiddle, kWhite, {.obscure_hint = true}); + gen_.GenerateSinglePanel("Panel_farther_far", kMiddle, kRed); + // Panel_first_first: first? first! + // Panel_second_second: second? second! + // Panel_third_third: third? third! + // Panel_fourth_fourth: fourth? fourth! + + // Number Hunt + gen_.GenerateSinglePanel("Panel_zero_zero", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 10}); + gen_.GenerateSinglePanel("Panel_one_one", kMiddle, kWhite, {.exact_len = 1}); + gen_.GenerateSinglePanel("Panel_two_two", kMiddle, kWhite, {.exact_len = 2}); + gen_.GenerateSinglePanel("Panel_two_two_2", kMiddle, kWhite, {.exact_len = 2}); + gen_.GenerateSinglePanel("Panel_three_three", kMiddle, kWhite, {.exact_len = 3}); + gen_.GenerateSinglePanel("Panel_three_three_2", kMiddle, kWhite, {.exact_len = 3}); + gen_.GenerateSinglePanel("Panel_three_three_3", kMiddle, kWhite, {.exact_len = 3}); + gen_.GenerateSinglePanel("Panel_four_four", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 4}); + gen_.GenerateSinglePanel("Panel_four_four_2", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 4}); + gen_.GenerateSinglePanel("Panel_four_four_3", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 4}); + gen_.GenerateSinglePanel("Panel_four_four_4", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 4}); + gen_.GenerateSinglePanel("Panel_five_five", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 5}); + gen_.GenerateSinglePanel("Panel_five_five_2", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 5}); + gen_.GenerateSinglePanel("Panel_five_five_3", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 5}); + gen_.GenerateSinglePanel("Panel_five_five_4", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 5}); + gen_.GenerateSinglePanel("Panel_five_five_5", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 5}); + gen_.GenerateSinglePanel("Panel_six_six", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 6}); + gen_.GenerateSinglePanel("Panel_six_six_2", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 6}); + gen_.GenerateSinglePanel("Panel_six_six_3", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 6}); + gen_.GenerateSinglePanel("Panel_six_six_4", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 6}); + gen_.GenerateSinglePanel("Panel_six_six_5", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 6}); + gen_.GenerateSinglePanel("Panel_six_six_6", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 6}); + gen_.GenerateSinglePanel("Panel_seven_seven", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 7}); + gen_.GenerateSinglePanel("Panel_seven_seven_2", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 7}); + gen_.GenerateSinglePanel("Panel_seven_seven_3", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 7}); + gen_.GenerateSinglePanel("Panel_seven_seven_4", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 7}); + gen_.GenerateSinglePanel("Panel_seven_seven_5", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 7}); + gen_.GenerateSinglePanel("Panel_seven_seven_6", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 7}); + gen_.GenerateSinglePanel("Panel_seven_seven_7", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 7}); + gen_.GenerateSinglePanel("Panel_eight_eight", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 8}); + gen_.GenerateSinglePanel("Panel_eight_eight_2", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 8}); + gen_.GenerateSinglePanel("Panel_eight_eight_3", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 8}); + gen_.GenerateSinglePanel("Panel_eight_eight_4", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 8}); + gen_.GenerateSinglePanel("Panel_eight_eight_5", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 8}); + gen_.GenerateSinglePanel("Panel_eight_eight_6", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 8}); + gen_.GenerateSinglePanel("Panel_eight_eight_7", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 8}); + gen_.GenerateSinglePanel("Panel_eight_eight_8", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 8}); + gen_.GenerateSinglePanel("Panel_nine_nine", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 9}); + gen_.GenerateSinglePanel("Panel_nine_nine_2", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 9}); + gen_.GenerateSinglePanel("Panel_nine_nine_3", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 9}); + gen_.GenerateSinglePanel("Panel_nine_nine_4", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 9}); + gen_.GenerateSinglePanel("Panel_nine_nine_5", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 9}); + gen_.GenerateSinglePanel("Panel_nine_nine_6", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 9}); + gen_.GenerateSinglePanel("Panel_nine_nine_7", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 9}); + gen_.GenerateSinglePanel("Panel_nine_nine_8", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 9}); + gen_.GenerateSinglePanel("Panel_nine_nine_9", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 9}); + + // Directional Gallery + gen_.GenerateStaticPanel("Panel_paranoid_paranoid", "welcome back"); + gen_.GeneratePairedPanels("Panel_salt_pepper", "Panel_pepper_salt", kBottom, kBlack); + gen_.GenerateSinglePanel("Panel_ward_forward", kMiddle, kBlue, {.reuse_solution = true}); + gen_.GenerateSinglePanel("Panel_hind_behind", kMiddle, kBlue, {.reuse_solution = true}); + gen_.GenerateSinglePanel("Panel_rig_right", kMiddle, kBlue, {.reuse_solution = true}); + gen_.GenerateSinglePanel("Panel_windward_forward", kMiddle, kPurple, {.reuse_solution = true}); + gen_.GenerateSinglePanel("Panel_light_right", kMiddle, kPurple, {.reuse_solution = true}); + gen_.GenerateSinglePanel("Panel_rewind_behind", kMiddle, kPurple, {.reuse_solution = true}); + gen_.GenerateSinglePanel("Panel_learn_return", kMiddle, kPurple, {.reuse_solution = true}); + gen_.GenerateSinglePanel("Panel_turn_return", kMiddle, kBlue, {.reuse_solution = true}); + + + + + + + + + // The Ecstatic + gen_.GenerateSinglePanel("Panel_soundgram_1", kTop, kYellow); + gen_.GenerateSinglePanel("Panel_soundgram_2", kTop, kYellow); + // Panel_scrambled_1: eggs? scrambled eggs! + // Panel_scrambled_2: vegetables? salad! + gen_.GenerateSinglePanel("Panel_anagram_6_1", kMiddle, kYellow, {.exact_len = 6}); + gen_.GenerateSinglePanel("Panel_anagram_6_2", kMiddle, kYellow, {.exact_len = 6}); + gen_.GenerateSinglePanel("Panel_anagram_7_1", kMiddle, kYellow, {.exact_len = 7}); + gen_.GenerateSinglePanel("Panel_anagram_7_2", kMiddle, kYellow, {.exact_len = 7}); + gen_.GenerateSinglePanel("Panel_anagram_7_3", kMiddle, kYellow, {.exact_len = 7}); + gen_.GenerateSinglePanel("Panel_anagram_7_4", kMiddle, kYellow, {.exact_len = 7}); + gen_.GenerateSinglePanel("Panel_anagram_8_1", kMiddle, kYellow, {.exact_len = 8}); + gen_.GenerateSinglePanel("Panel_anagram_8_2", kMiddle, kYellow, {.exact_len = 8}); + gen_.GenerateSinglePanel("Panel_anagram_8_3", kMiddle, kYellow, {.exact_len = 8}); + gen_.GenerateSinglePanel("Panel_anagram_9_1", kMiddle, kYellow, {.exact_len = 9}); + + // The Red + gen_.GenerateSinglePanel("Panel_red_top_1", kTop, kRed); + gen_.GenerateSinglePanel("Panel_red_top_2", kTop, kRed); + gen_.GenerateSinglePanel("Panel_red_top_3", kTop, kRed); + gen_.GenerateSinglePanel("Panel_red_top_4", kTop, kRed); + //gen_.GeneratePanelStack("Panel_red_top_5", kRed, "Panel_red_mid_2", kRed, "", {}); // slow + gen_.GenerateSinglePanel("Panel_red_mid_1", kMiddle, kRed); + gen_.GenerateSinglePanel("Panel_red_mid_3", kMiddle, kRed); + gen_.GeneratePanelStack("", {}, "Panel_red_mid_4", kRed, "Panel_red_bot_4", kRed); + gen_.GeneratePanelStack("", {}, "Panel_red_mid_5", kRed, "Panel_red_bot_5", kRed); + gen_.GenerateSinglePanel("Panel_red_bot_1", kBottom, kRed, {.max_answer_len = 7}); + gen_.GenerateSinglePanel("Panel_red_bot_2", kBottom, kRed, {.max_answer_len = 7}); + gen_.GenerateSinglePanel("Panel_red_bot_3", kBottom, kRed, {.max_answer_len = 7}); + gen_.GenerateSinglePanel("Panel_red_bot_6", kBottom, kRed, {.max_answer_len = 7}); + + // The Artistic + gen_.GeneratePanelStack("Panel_blue_top_1", kBlue, "", {}, "Panel_red_bot_1", kRed); + gen_.GeneratePanelStack("", {}, "Panel_red_mid_2", kRed, "Panel_blue_bot_2", kBlue); + gen_.GeneratePanelStack("", {}, "Panel_blue_mid_3", kBlue, "Panel_red_bot_3", kRed); + gen_.GeneratePanelStack("Panel_red_top_4", kRed, "Panel_blue_mid_4", kBlue, "", {}); + gen_.GeneratePanelStack("Panel_yellow_top_5", kYellow, "", {}, "Panel_blue_bot_5", kBlue); + gen_.GeneratePanelStack("Panel_blue_top_6", kBlue, "Panel_yellow_mid_6", kYellow, "", {}); + // gen_.GeneratePanelStack("", {}, "Panel_blue_mid_7", kBlue, "Panel_yellow_bot_7", kYellow); + gen_.GeneratePanelStack("", {}, "Panel_yellow_mid_8", kYellow, "Panel_black_bot_8", kBlack); + // gen_.GeneratePanelStack("Panel_black_top_9", kBlack, "", {}, "Panel_yellow_bot_9", kYellow); + //gen_.GeneratePanelStack("Panel_yellow_top_10", kYellow, "", {}, "Panel_black_bot_10", kBlack); // slow + gen_.GeneratePanelStack("Panel_black_top_11", kBlack, "Panel_yellow_mid_11", kYellow, "", {}); + gen_.GeneratePanelStack("Panel_black_top_12", kBlack, "", {}, "Panel_red_bot_12", kRed); + //gen_.GeneratePanelStack("Panel_red_top_13", kRed, "", {}, "Panel_black_bot_13", kBlack); // slow + gen_.GeneratePanelStack("", {}, "Panel_black_mid_14", kBlack, "Panel_red_bot_14", kRed); + gen_.GeneratePanelStack("Panel_black_top_15", kBlack, "Panel_red_mid_15", kRed, "", {}); + gen_.GenerateSinglePanel("Panel_answer_1", kBottom, kRed); + gen_.GenerateSinglePanel("Panel_answer_2", kTop, kBlack); + gen_.GenerateSinglePanel("Panel_answer_3", kMiddle, kBlue, {.max_answer_len = 4}); + gen_.GenerateSinglePanel("Panel_answer_4", kTop, kYellow); + gen_.GenerateOneRoadManyTurns("Panel_artistic_artistic", "Panel_answer_1", "Panel_answer_2", "Panel_answer_3", "Panel_answer_4"); + + + + + + + + + + + + + // Pilgrim Room + // gen_.GenerateSinglePanel("Panel_pilgrim", kMiddle, kBlue, {.reuse_solution = true}); + gen_.GenerateSinglePanel("Panel_shortcut", kMiddle, kYellow, {.multiword = true, .max_answer_len = 20}); + gen_.GenerateComboPanel("Panel_lingo_12", kMiddle, kPurple, kMiddle, kRed); + gen_.GenerateSinglePanel("Panel_lingo_1", kMiddle, kPurple, {.reuse_solution = true}); + gen_.GenerateSinglePanel("Panel_lingo_8", kMiddle, kBlack); + // Panel_lingo_7: 906234? strand room! + // Panel_lingo_13: floss paths? crossroads! + gen_.GenerateComboPanel("Panel_lingo_4", kBottom, kWhite, kMiddle, kPurple); + gen_.GenerateComboPanel("Panel_lingo_6", kBottom, kBlack, kBottom, kWhite); + gen_.GenerateSinglePanel("Panel_lingo_3", kBottom, kWhite); + gen_.GenerateComboPanel("Panel_lingo_10", kBottom, kBlack, kMiddle, kRed); + gen_.GenerateSinglePanel("Panel_lingo_2", kBottom, kWhite); + gen_.GenerateSinglePanel("Panel_lingo_5", kMiddle, kYellow, {.multiword = true, .max_answer_len = 20}); + gen_.GenerateSinglePanel("Panel_lingo_11", kMiddle, kYellow, {.multiword = true, .max_answer_len = 20}); + // Panel_lingo_9: this? pilgrim room! + + std::ifstream level1("../level1.tscn"); + std::ofstream output("newlevel.tscn"); + std::string line; + std::string name; + std::string question; + std::string answer; + while (std::getline(level1, line)) { + if (line.substr(0, 18) == "[node name=\"Panel_") { + std::string stripstart = line.substr(12); + name = stripstart.substr(0, stripstart.find("\"")); + + if (gen_.IsPanelRandomized(name)) { + std::tie(question, answer) = gen_.GetPanel(name); + } else { + name = ""; + } + } + + if (line.empty()) { + name = ""; + } + + if (!name.empty() && line.substr(0, 7) == "text = ") { + std::string stripstart = line.substr(8); + output << "text = \"" << question << "\"" << std::endl; + //question = stripstart.substr(0, stripstart.find("\"")); + } else if (!name.empty() && line.substr(0, 9) == "answer = ") { + std::string stripstart = line.substr(10); + //std::string answer = stripstart.substr(0, stripstart.find("\"")); + + //std::cout << name << ": " << question << "? " << answer << "!" << std::endl; + output << "answer = \"" << answer << "\"" << std::endl; + } else { + output << line << "\n"; + } + } + } + +private: + + unsigned int seed_; + Generator gen_; +}; + +int main(int argc, char** argv) { + std::random_device randomDevice; + unsigned int seed = randomDevice() % 1000000; + + Randomizer randomizer(seed); + randomizer.Run(); + + return 0; +} diff --git a/vendor/verbly b/vendor/verbly new file mode 160000 index 0000000..e5d8d42 --- /dev/null +++ b/vendor/verbly @@ -0,0 +1 @@ +Subproject commit e5d8d42eae6ce486678d87e33c1a7c26e2a6c1a1 -- cgit 1.4.1