summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-02-15 10:04:06 -0500
committerStar Rauchenberger <fefferburbia@gmail.com>2023-02-15 10:04:06 -0500
commitcebfd065c029788f3d6a8cc33b9401a708052335 (patch)
tree58690adae1b1174f4054cf9850eed66963ca43f7
downloadlingo-randomizer-cebfd065c029788f3d6a8cc33b9401a708052335.tar.gz
lingo-randomizer-cebfd065c029788f3d6a8cc33b9401a708052335.tar.bz2
lingo-randomizer-cebfd065c029788f3d6a8cc33b9401a708052335.zip
Did a buncha work
-rw-r--r--.gitignore2
-rw-r--r--.gitmodules3
-rw-r--r--CMakeLists.txt13
-rw-r--r--generator.cpp675
-rw-r--r--generator.h230
-rw-r--r--main.cpp550
m---------vendor/verbly0
7 files changed, 1473 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d76b74e --- /dev/null +++ b/.gitignore
@@ -0,0 +1,2 @@
1build
2.DS_Store
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..d812b5e --- /dev/null +++ b/.gitmodules
@@ -0,0 +1,3 @@
1[submodule "vendor/verbly"]
2 path = vendor/verbly
3 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 @@
1cmake_minimum_required (VERSION 3.1)
2project (lingo_randomizer)
3
4set(CMAKE_BUILD_TYPE Debug)
5
6add_subdirectory(vendor/verbly)
7
8include_directories(vendor/verbly/lib)
9
10add_executable(lingo_randomizer main.cpp generator.cpp)
11set_property(TARGET lingo_randomizer PROPERTY CXX_STANDARD 17)
12set_property(TARGET lingo_randomizer PROPERTY CXX_STANDARD_REQUIRED ON)
13target_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 @@
1#include "generator.h"
2#include <algorithm>
3#include <iostream>
4
5verbly::filter Generator::MakeHintFilter(verbly::filter subfilter, Height height, Colour colour, FilterDirection filter_direction)
6{
7 switch (colour) {
8 case kWhite: {
9 switch (height) {
10 case kBottom: {
11 return (verbly::word::synonyms %= subfilter);
12 }
13 case kTop: {
14 return (verbly::form::pronunciations %=
15 verbly::filter("homophones", false,
16 (verbly::pronunciation::forms %= (subfilter && verbly::filter(
17 verbly::form::id,
18 verbly::filter::comparison::field_does_not_equal,
19 verbly::form::id)))));
20 }
21 case kMiddle: {
22 return subfilter;
23 }
24 default: break; // Not supported yet.
25 }
26 break;
27 }
28 case kBlack: {
29 switch (height) {
30 case kBottom: {
31 return (verbly::word::antonyms %= subfilter);
32 }
33 case kMiddle: {
34 return (verbly::form::antogram %= subfilter);
35 }
36 case kTop: {
37 return (verbly::pronunciation::antophone %= subfilter);
38 }
39 default: break; // Not supported yet.
40 }
41 break;
42 }
43 case kBrown: {
44 break; // Not supported yet.
45 }
46 case kRed: {
47 switch (height) {
48 case kTop: {
49 if (filter_direction == kTowardSolution)
50 {
51 return (verbly::pronunciation::merophones %= subfilter);
52 } else {
53 return (verbly::pronunciation::holophones %= subfilter);
54 }
55 }
56 case kMiddle: {
57 if (filter_direction == kTowardSolution)
58 {
59 return (verbly::form::merographs %= subfilter);
60 } else {
61 return (verbly::form::holographs %= subfilter);
62 }
63 }
64 case kBottom: {
65 if (filter_direction == kTowardSolution)
66 {
67 return (verbly::notion::partMeronyms %=
68 verbly::filter("partMeronyms", false,
69 subfilter && verbly::filter(
70 verbly::form::id,
71 verbly::filter::comparison::field_does_not_equal,
72 verbly::form::id)));
73 } else {
74 return (verbly::notion::partHolonyms %=
75 verbly::filter("partHolonyms", false,
76 subfilter && verbly::filter(
77 verbly::form::id,
78 verbly::filter::comparison::field_does_not_equal,
79 verbly::form::id)));
80 }
81 }
82 default: break; // Not supported yet.
83 }
84 break;
85 }
86 case kBlue: {
87 switch (height) {
88 case kTop: {
89 if (filter_direction == kTowardSolution)
90 {
91 return (verbly::pronunciation::holophones %= subfilter);
92 } else {
93 return (verbly::pronunciation::merophones %= subfilter);
94 }
95 }
96 case kMiddle: {
97 if (filter_direction == kTowardSolution)
98 {
99 return (verbly::form::holographs %= subfilter);
100 } else {
101 return (verbly::form::merographs %= subfilter);
102 }
103 }
104 case kBottom: {
105 if (filter_direction == kTowardSolution)
106 {
107 return (verbly::notion::partHolonyms %=
108 verbly::filter("partHolonyms", false,
109 subfilter && verbly::filter(
110 verbly::form::id,
111 verbly::filter::comparison::field_does_not_equal,
112 verbly::form::id)));
113 } else {
114 return (verbly::notion::partMeronyms %=
115 verbly::filter("partMeronyms", false,
116 subfilter && verbly::filter(
117 verbly::form::id,
118 verbly::filter::comparison::field_does_not_equal,
119 verbly::form::id)));
120 }
121 }
122 default: break; // Not supported yet.
123 }
124 break;
125 }
126 case kPurple: {
127 switch (height) {
128 case kMiddle: {
129 return (verbly::form::holographs %=
130 verbly::filter("midpurp", false,
131 (verbly::form::length >= 4 && (verbly::form::merographs %=
132 (subfilter && verbly::filter(
133 verbly::form::id,
134 verbly::filter::comparison::field_does_not_equal,
135 verbly::form::id))))));
136 }
137 case kTop: {
138 return (verbly::pronunciation::rhymes %= subfilter);
139 }
140 default: break; // Not supported yet.
141 }
142 break;
143 }
144 case kYellow: {
145 switch (height) {
146 case kTop: {
147 return (verbly::pronunciation::anaphones %= (subfilter && verbly::filter(
148 verbly::pronunciation::id,
149 verbly::filter::comparison::field_does_not_equal,
150 verbly::pronunciation::id)));
151 }
152 case kMiddle: {
153 return (verbly::form::anagrams %= (subfilter && verbly::filter(
154 verbly::form::id,
155 verbly::filter::comparison::field_does_not_equal,
156 verbly::form::id)));
157 }
158 default: break; // Not supported yet.
159 }
160 break;
161 }
162 case kGreen: {
163 if (filter_direction == kTowardSolution)
164 {
165 switch (height) {
166 case kBottom: {
167 verbly::filter whitelist =
168 (verbly::notion::wnid == 109287968) // Geological formations
169 || (verbly::notion::wnid == 109208496) // Asterisms (collections of stars)
170 || (verbly::notion::wnid == 109239740) // Celestial bodies
171 || (verbly::notion::wnid == 109277686) // Exterrestrial objects (comets and meteroids)
172 || (verbly::notion::wnid == 109403211) // Radiators (supposedly natural radiators but actually these are just pictures of radiators)
173 || (verbly::notion::wnid == 109416076) // Rocks
174 || (verbly::notion::wnid == 105442131) // Chromosomes
175 || (verbly::notion::wnid == 100324978) // Tightrope walking
176 || (verbly::notion::wnid == 100326094) // Rock climbing
177 || (verbly::notion::wnid == 100433458) // Contact sports
178 || (verbly::notion::wnid == 100433802) // Gymnastics
179 || (verbly::notion::wnid == 100439826) // Track and field
180 || (verbly::notion::wnid == 100440747) // Skiing
181 || (verbly::notion::wnid == 100441824) // Water sport
182 || (verbly::notion::wnid == 100445351) // Rowing
183 || (verbly::notion::wnid == 100446980) // Archery
184 // TODO: add more sports
185 || (verbly::notion::wnid == 100021939) // Artifacts
186 || (verbly::notion::wnid == 101471682) // Vertebrates
187 ;
188
189 verbly::filter blacklist =
190 (verbly::notion::wnid == 106883725) // swastika
191 || (verbly::notion::wnid == 104416901) // tetraskele
192 || (verbly::notion::wnid == 102512053) // fish
193 || (verbly::notion::wnid == 103575691) // instrument of execution
194 || (verbly::notion::wnid == 103829563) // noose
195 || (verbly::notion::wnid == 103663910) // life support
196 ;
197
198 return subfilter
199 && (verbly::notion::fullHypernyms %= whitelist)
200 && !(verbly::notion::fullHypernyms %= blacklist)
201 && (verbly::notion::partOfSpeech == verbly::part_of_speech::noun)
202 && (verbly::notion::numOfImages >= 1);
203 }
204 case kMiddle: {
205 return subfilter;
206 }
207 default: break; // Never supported.
208 }
209 } else {
210 return (verbly::form::text == "picture");
211 }
212 break;
213 }
214 default: break; // Not supported yet.
215 }
216 return {};
217}
218
219std::string ApplyWanderlust(const std::string& word) {
220 std::string result;
221 for (char ch : word) {
222 if (ch == 'w') {
223 result += '1';
224 } else if (ch == 'a') {
225 result += '2';
226 } else if (ch == 'n') {
227 result += '3';
228 } else if (ch == 'd') {
229 result += '4';
230 } else if (ch == 'e') {
231 result += '5';
232 } else if (ch == 'r') {
233 result += '6';
234 } else if (ch == 'l') {
235 result += '7';
236 } else if (ch == 'u') {
237 result += '8';
238 } else if (ch == 's') {
239 result += '9';
240 } else if (ch == 't') {
241 result += '0';
242 } else if (ch == ' ') {
243 result += ' ';
244 }
245 }
246 return result;
247}
248
249void Generator::GenerateStaticPanel(std::string name, std::string question, std::string answer) {
250 SavePanel(name, question, answer.empty() ? question : answer, {});
251}
252
253void Generator::GenerateSinglePanel(std::string name, Height height, Colour colour, GenerateOptions options) {
254 while (!GenerateSinglePanelImpl(name, height, colour, options));
255}
256
257bool Generator::GenerateSinglePanelImpl(std::string name, Height height, Colour colour, GenerateOptions options) {
258 verbly::form solution;
259 if (options.reuse_solution) {
260 const std::string& word = reusable_.at(std::uniform_int_distribution<int>(0, reusable_.size()-1)(rng_));
261 if (options.max_answer_len > 0 && word.size() > options.max_answer_len) return false;
262 solution = database_->forms(verbly::form::text == word).first();
263 } else {
264 verbly::filter forward = MakeHintFilter({}, height, colour, kTowardSolution);
265 std::vector<verbly::form> solutions = database_->forms(forward && GetWordFilter(kTowardSolution, options)).all();
266 solution = solutions.front();//solutions.at(std::uniform_int_distribution<int>(0, solutions.size())(rng_));
267 }
268
269 if (!options.unique_pool.empty() && pools_[options.unique_pool].count(solution.getText())) {
270 return false;
271 }
272 if (options.palindrome != kPalindromeUnspecified) {
273 std::string reversed = solution.getText();
274 std::reverse(reversed.begin(), reversed.end());
275
276 if ((options.palindrome == kForcePalindrome && reversed != solution.getText()) ||
277 (options.palindrome == kRejectPalindrome && reversed == solution.getText())) {
278 return false;
279 }
280 }
281
282 // Finish early if this is a middle white.
283 if (height == kMiddle && colour == kWhite) {
284 SavePanel(name, solution.getText(), solution.getText(), options);
285 return true;
286 }
287
288 verbly::filter questionFilter = MakeHintFilter(solution, height, colour, kTowardQuestion);
289 std::vector<verbly::form> questions = database_->forms(questionFilter && GetWordFilter(kTowardQuestion, options)).all();//, verbly::order(verbly::form::id), 0).all();
290 if (questions.size() < 1) return false;
291 verbly::form question = questions.front();// questions.at(std::uniform_int_distribution<int>(0, questions.size())(rng_));
292
293 if (IsClueTrivial(height, colour, question, solution)) {
294 return false;
295 }
296
297 SavePanel(name, question.getText(), solution.getText(), options);
298 if (!options.copy_to.empty()) {
299 SavePanel(options.copy_to, question.getText(), solution.getText(), options);
300 }
301
302 return true;
303}
304
305void Generator::GenerateDoublePanel(std::string name1, std::string name2, Height height, Colour colour, GenerateOptions options) {
306 while (!GenerateDoublePanelImpl(name1, name2, height, colour, options));
307}
308
309bool Generator::GenerateDoublePanelImpl(std::string name1, std::string name2, Height height, Colour colour, GenerateOptions options) {
310 verbly::form solution;
311 if (options.reuse_solution) {
312 const std::string& word = reusable_.at(std::uniform_int_distribution<int>(0, reusable_.size()-1)(rng_));
313 if (options.max_answer_len > 0 && word.size() > options.max_answer_len) return false;
314 solution = database_->forms(verbly::form::text == word).first();
315 } else {
316 verbly::filter forward = MakeHintFilter({}, height, colour, kTowardSolution);
317 std::vector<verbly::form> solutions = database_->forms(forward && GetWordFilter(kTowardSolution, options)).all();
318 solution = solutions.front();//solutions.at(std::uniform_int_distribution<int>(0, solutions.size())(rng_));
319 }
320
321 if (!options.unique_pool.empty() && pools_[options.unique_pool].count(solution.getText())) {
322 return false;
323 }
324
325 // Finish early if this is a middle white.
326 if (height == kMiddle && colour == kWhite) {
327 SavePanel(name1, solution.getText(), solution.getText(), options);
328 SavePanel(name2, solution.getText(), solution.getText(), options);
329 return true;
330 }
331
332 verbly::filter questionFilter = MakeHintFilter(solution, height, colour, kTowardQuestion);
333 std::vector<verbly::form> questions = database_->forms(questionFilter && GetWordFilter(kTowardQuestion, options), {}, 2).all();
334 if (questions.size() < 2) return false;
335
336 //std::shuffle(questions.begin(), questions.end(), rng_);
337
338 if (IsClueTrivial(height, colour, questions[0], solution) || IsClueTrivial(height, colour, questions[1], solution)) {
339 return false;
340 }
341
342 SavePanel(name1, questions[0].getText(), solution.getText(), options);
343 SavePanel(name2, questions[1].getText(), solution.getText(), options);
344
345 return true;
346}
347
348void Generator::GenerateCohintedPanels(std::string name1, std::string name2, Height height, Colour colour, GenerateOptions options) {
349 while (!GenerateCohintedPanelsImpl(name1, name2, height, colour, options));
350}
351
352bool Generator::GenerateCohintedPanelsImpl(std::string name1, std::string name2, Height height, Colour colour, GenerateOptions options) {
353 verbly::filter backward = MakeHintFilter({}, height, colour, kTowardQuestion);
354 std::vector<verbly::form> questions = database_->forms(backward && GetWordFilter(kTowardQuestion, options)).all();//, verbly::order(verbly::form::id), 0).all();
355 verbly::form question = questions.front();// solutions.at(std::uniform_int_distribution<int>(0, solutions.size())(rng_));
356
357 // Finish early if this is a middle white.
358 if (height == kMiddle && colour == kWhite) {
359 SavePanel(name1, question.getText(), question.getText(), options);
360 SavePanel(name2, question.getText(), question.getText(), options);
361 return true;
362 }
363
364 verbly::filter solutionFilter = MakeHintFilter(question, height, colour, kTowardSolution);
365 std::vector<verbly::form> solutions = database_->forms(solutionFilter && GetWordFilter(kTowardSolution, options), {}, 2).all();
366 if (solutions.size() < 2) return false;
367
368 //std::shuffle(questions.begin(), questions.end(), rng_);
369
370 if (IsClueTrivial(height, colour, question, solutions[0]) || IsClueTrivial(height, colour, question, solutions[1])) {
371 return false;
372 }
373
374 SavePanel(name1, question.getText(), solutions[0].getText(), options);
375 SavePanel(name2, question.getText(), solutions[1].getText(), options);
376
377 return true;
378}
379
380void Generator::GeneratePairedPanels(std::string name1, std::string name2, Height height, Colour colour, GenerateOptions options) {
381 while (!GeneratePairedPanelsImpl(name1, name2, height, colour, options));
382}
383
384bool Generator::GeneratePairedPanelsImpl(std::string name1, std::string name2, Height height, Colour colour, GenerateOptions options) {
385 Colour effectiveColour = (height == kMiddle && colour == kWhite) ? kBlack : colour;
386 Height effectiveHeight = (height == kMiddle && colour == kWhite) ? kBottom : height;
387
388 verbly::filter forward = MakeHintFilter({}, effectiveHeight, effectiveColour, kTowardSolution);
389 std::vector<verbly::form> solutions = database_->forms(forward && GetWordFilter(kTowardSolution, options)).all();
390 verbly::form solution = solutions.front();//solutions.at(std::uniform_int_distribution<int>(0, solutions.size())(rng_));
391
392 verbly::filter questionFilter = MakeHintFilter(solution, effectiveHeight, effectiveColour, kTowardQuestion);
393 std::vector<verbly::form> questions = database_->forms(questionFilter && GetWordFilter(kTowardQuestion, options)).all();//, verbly::order(verbly::form::id), 0).all();
394 if (questions.size() < 1) return false;
395 verbly::form question = questions.front();// questions.at(std::uniform_int_distribution<int>(0, questions.size())(rng_));
396
397 if (IsClueTrivial(height, effectiveColour, question, solution)) {
398 return false;
399 }
400
401 if (options.palindrome != kPalindromeUnspecified) {
402 std::string reversed = question.getText();
403 std::reverse(reversed.begin(), reversed.end());
404
405 if ((options.palindrome == kForcePalindrome && reversed != question.getText()) ||
406 (options.palindrome == kRejectPalindrome && reversed == question.getText())) {
407 return false;
408 }
409 }
410
411 if (height == kMiddle && colour == kWhite) {
412 SavePanel(name1, question.getText(), question.getText(), options);
413 SavePanel(name2, solution.getText(), solution.getText(), options);
414 if (!options.copy_to.empty() && !options.copy_to2.empty()) {
415 SavePanel(options.copy_to, question.getText(), question.getText(), options);
416 SavePanel(options.copy_to2, solution.getText(), solution.getText(), options);
417 }
418 } else {
419 SavePanel(name1, question.getText(), solution.getText(), options);
420 SavePanel(name2, solution.getText(), question.getText(), options);
421 if (!options.copy_to.empty() && !options.copy_to2.empty()) {
422 SavePanel(options.copy_to, question.getText(), solution.getText(), options);
423 SavePanel(options.copy_to2, solution.getText(), question.getText(), options);
424 }
425 }
426
427 return true;
428}
429
430void 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) {
431 while (!GeneratePanelStackImpl(top_name, top_colour, middle_name, middle_colour, bottom_name, bottom_colour, options));
432}
433
434bool 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) {
435 verbly::form solution;
436 if (options.reuse_solution) {
437 const std::string& word = reusable_.at(std::uniform_int_distribution<int>(0, reusable_.size()-1)(rng_));
438 if (options.max_answer_len > 0 && word.size() > options.max_answer_len) return false;
439 solution = database_->forms(verbly::form::text == word).first();
440 } else {
441 verbly::filter forward = GetWordFilter(kTowardSolution, options);
442 if (!top_name.empty()) {
443 forward &= MakeHintFilter({}, kTop, top_colour, kTowardSolution);
444 }
445 if (!middle_name.empty()) {
446 forward &= MakeHintFilter({}, kMiddle, middle_colour, kTowardSolution);
447 }
448 if (!bottom_name.empty()) {
449 forward &= MakeHintFilter({}, kBottom, bottom_colour, kTowardSolution);
450 }
451 std::vector<verbly::form> solutions = database_->forms(forward).all();
452 solution = solutions.front();//solutions.at(std::uniform_int_distribution<int>(0, solutions.size())(rng_));
453 }
454
455 if (!options.unique_pool.empty() && pools_[options.unique_pool].count(solution.getText())) {
456 return false;
457 }
458
459 std::string top_hint;
460 std::string middle_hint;
461 std::string bottom_hint;
462
463 if (!top_name.empty()) {
464 verbly::filter questionFilter = MakeHintFilter(solution, kTop, top_colour, kTowardQuestion);
465 std::vector<verbly::form> questions = database_->forms(questionFilter && GetWordFilter(kTowardQuestion, options), {}, 1).all();
466 if (questions.empty()) return false;
467 top_hint = questions.front().getText();
468
469 if (IsClueTrivial(kTop, top_colour, questions.front(), solution)) {
470 return false;
471 }
472 }
473
474 if (!middle_name.empty()) {
475 verbly::filter questionFilter = MakeHintFilter(solution, kMiddle, middle_colour, kTowardQuestion);
476 std::vector<verbly::form> questions = database_->forms(questionFilter && GetWordFilter(kTowardQuestion, options), {}, 1).all();
477 if (questions.empty()) return false;
478 middle_hint = questions.front().getText();
479
480 if (IsClueTrivial(kMiddle, middle_colour, questions.front(), solution)) {
481 return false;
482 }
483 }
484
485 if (!bottom_name.empty()) {
486 verbly::filter questionFilter = MakeHintFilter(solution, kBottom, bottom_colour, kTowardQuestion);
487 std::vector<verbly::form> questions = database_->forms(questionFilter && GetWordFilter(kTowardQuestion, options), {}, 1).all();
488 if (questions.empty()) return false;
489 bottom_hint = questions.front().getText();
490
491 if (IsClueTrivial(kBottom, bottom_colour, questions.front(), solution)) {
492 return false;
493 }
494 }
495
496 if (!top_name.empty()) {
497 SavePanel(top_name, top_hint, solution.getText(), options);
498 }
499 if (!middle_name.empty()) {
500 SavePanel(middle_name, middle_hint, solution.getText(), options);
501 }
502 if (!bottom_name.empty()) {
503 SavePanel(bottom_name, bottom_hint, solution.getText(), options);
504 }
505
506 return true;
507}
508
509void Generator::GenerateOrangeNumberPanel(std::string name) {
510 std::string solution = wanderlust_->GetWord(rng_);
511 std::string question = ApplyWanderlust(solution);
512
513 SavePanel(name, question, solution);
514}
515
516void Generator::GenerateOrangeWordPanel(std::string name) {
517 std::string question = wanderlust_->GetWord(rng_);
518 std::string solution = ApplyWanderlust(question);
519
520 SavePanel(name, question, solution);
521}
522
523void Generator::GenerateOrangeAdditionPanel(std::string name) {
524 auto [question, solution] = wanderlust_->GetPuzzle(rng_);
525
526 SavePanel(name, question, solution);
527}
528
529void Generator::GenerateOneRoadManyTurns(std::string order_name, std::string part1_name, std::string part2_name, std::string part3_name, std::string part4_name) {
530 const auto& [part1_q, part1_a] = panels_.at(part1_name);
531 const auto& [part2_q, part2_a] = panels_.at(part2_name);
532 const auto& [part3_q, part3_a] = panels_.at(part3_name);
533 const auto& [part4_q, part4_a] = panels_.at(part4_name);
534
535 SavePanel(order_name, "order", part1_a + " " + part2_a + " " + part3_a + " " + part4_a);
536}
537
538void Generator::GenerateComboPanel(std::string name, Height left_height, Colour left_colour, Height right_height, Colour right_colour, GenerateOptions options) {
539 while (!GenerateComboPanelImpl(name, left_height, left_colour, right_height, right_colour, options));
540}
541
542bool Generator::GenerateComboPanelImpl(std::string name, Height left_height, Colour left_colour, Height right_height, Colour right_colour, GenerateOptions options) {
543 options.force_two_words = true;
544
545 verbly::form solution = database_->forms(GetWordFilter(kTowardSolution, options)).first();
546 std::string soltext = solution.getText();
547 int spacepos = soltext.find(" ");
548 std::string leftword = soltext.substr(0, spacepos);
549 std::string rightword = soltext.substr(spacepos+1);
550
551 options.force_two_words = false;
552 verbly::filter left_filter = MakeHintFilter(verbly::form::text == leftword, left_height, left_colour, kTowardQuestion);
553 std::vector<verbly::form> left_questions = database_->forms(left_filter && GetWordFilter(kTowardQuestion, options)).all();
554 if (left_questions.size() < 1) return false;
555 verbly::form left_question = left_questions.front();
556
557 verbly::filter right_filter = MakeHintFilter(verbly::form::text == rightword, right_height, right_colour, kTowardQuestion);
558 std::vector<verbly::form> right_questions = database_->forms(right_filter && GetWordFilter(kTowardQuestion, options)).all();
559 if (right_questions.size() < 1) return false;
560 verbly::form right_question = right_questions.front();
561
562 SavePanel(name, left_question.getText() + " " + right_question.getText(), soltext, options);
563
564 return true;
565}
566
567void Generator::GenerateCrossTower(
568 std::string north_tower_name,
569 std::string south_tower_name,
570 std::string east_tower_name,
571 std::string west_tower_name,
572 std::string north_lookout_name,
573 std::string south_lookout_name,
574 std::string east_lookout_name,
575 std::string west_lookout_name,
576 std::string north_other_name1,
577 std::string north_other_name2,
578 std::string north_other_name3,
579 std::string south_other_name1,
580 std::string south_other_name2,
581 std::string south_other_name3,
582 std::string east_other_name1,
583 std::string east_other_name2,
584 std::string east_other_name3,
585 std::string west_other_name1,
586 std::string west_other_name2,
587 std::string west_other_name3)
588{
589 std::vector<std::vector<std::string>> sets = cross_tower_->GetPuzzleSet(rng_);
590
591}
592
593void Generator::SavePanel(std::string name, std::string question, std::string answer, GenerateOptions options) {
594 if (options.save_for_later) {
595 reusable_.push_back(answer);
596 }
597
598 if (!options.unique_pool.empty()) {
599 pools_[options.unique_pool].insert(answer);
600 }
601
602 if (options.obscure_hint) {
603 int numToObscure = (question.size()/3 > 0) ? std::uniform_int_distribution<int>(1, question.size()/3)(rng_) : 1;
604 std::vector<int> indicies(question.size());
605 std::iota(indicies.begin(), indicies.end(), 0);
606 std::shuffle(indicies.begin(), indicies.end(), rng_);
607
608 for (int i=0; i<numToObscure; i++) {
609 if (question[indicies[i]] != ' ') {
610 question[indicies[i]] = '?';
611 }
612 }
613 }
614
615 panels_[name] = std::make_tuple(question, answer);
616
617 std::cout << name << ": " << question << "? " << answer << "!" << std::endl;
618}
619
620verbly::filter Generator::GetWordFilter(FilterDirection dir, GenerateOptions options) const {
621 verbly::filter wordFilter =
622 (verbly::form::proper == false);
623
624 wordFilter &= (
625 !(verbly::word::usageDomains %= (verbly::notion::wnid == 106718862)) // ethnic slurs
626 && !(verbly::notion::wnid == 110630093) // "spastic"
627 && !(verbly::notion::fullHypernyms %= (verbly::notion::wnid == 100844254))); // sexual activity
628
629 if (options.exact_len > 0) {
630 wordFilter &= (verbly::form::length == options.exact_len);
631 } else if (dir == kTowardSolution && options.max_answer_len > 0) {
632 wordFilter &= (verbly::form::length <= options.max_answer_len);
633 } else if (dir == kTowardQuestion && options.max_hint_len > 0) {
634 wordFilter &= (verbly::form::length <= options.max_hint_len);
635 } else {
636 wordFilter &= (verbly::form::length <= 11);
637 }
638
639 if (options.exact_len == 0) {
640 wordFilter &= (verbly::form::length >= 3);
641 }
642
643 if (!options.multiword) {
644 if (options.force_two_words) {
645 wordFilter &= (verbly::form::complexity == 2);
646 } else {
647 wordFilter &= (verbly::form::complexity == 1);
648 }
649 } else {
650 wordFilter &= ((verbly::form::complexity > 1) || (verbly::form::frequency > 2000000));
651 }
652
653 return wordFilter;
654}
655
656bool Generator::IsClueTrivial(Height height, Colour colour, const verbly::form& clue, const verbly::form& solution) const
657{
658 if (height == kTop && colour == kWhite)
659 {
660 return !database_->forms((verbly::filter)clue && (verbly::word::synonyms %= solution)).all().empty();
661 } else if (height == kBottom && colour == kWhite)
662 {
663 return !database_->forms((verbly::filter)clue && (verbly::form::pronunciations %= solution)).all().empty();
664 } else if (height == kBottom && colour == kBlack)
665 {
666 return !database_->forms((verbly::filter)clue && (verbly::form::merographs %= solution)).all().empty()
667 || !database_->forms((verbly::filter)clue && (verbly::form::holographs %= solution)).all().empty();
668 } else if ((height == kMiddle || height == kTop) && colour == kPurple)
669 {
670 return (clue.getId() == solution.getId())
671 || !database_->forms((verbly::filter)clue && (verbly::form::merographs %= solution)).all().empty()
672 || !database_->forms((verbly::filter)clue && (verbly::form::holographs %= solution)).all().empty();
673 }
674 return false;
675}
diff --git a/generator.h b/generator.h new file mode 100644 index 0000000..1381cd3 --- /dev/null +++ b/generator.h
@@ -0,0 +1,230 @@
1#ifndef GENERATOR_H_811386CE
2#define GENERATOR_H_811386CE
3
4#include <string>
5#include <random>
6#include <map>
7#include <tuple>
8#include <memory>
9#include <verbly.h>
10#include <hkutil/string.h>
11
12enum Height {
13 kTop,
14 kMiddle,
15 kBottom,
16 kHeightCount
17};
18
19enum Colour {
20 kWhite,
21 kBlack,
22 kRed,
23 kBlue,
24 kPurple,
25 kBrown,
26 kYellow,
27 kGreen,
28 kOrange,
29 kColourCount
30};
31
32enum FilterDirection {
33 kTowardSolution,
34 kTowardQuestion
35};
36
37enum PalindromeQuery {
38 kPalindromeUnspecified,
39 kForcePalindrome,
40 kRejectPalindrome
41};
42
43struct GenerateOptions {
44 bool obscure_hint = false;
45 int max_answer_len = 0;
46 int max_hint_len = 0;
47 int exact_len = 0;
48 bool multiword = false;
49 bool save_for_later = false;
50 bool reuse_solution = false; // supported by single, double, and stack
51 std::string unique_pool; // supported by single, double, and stack
52 PalindromeQuery palindrome = kPalindromeUnspecified; // only important for middle black. supported by single and paired
53 std::string copy_to; // supported by single and paired
54 std::string copy_to2; // supported by paired
55 bool force_two_words = false;
56};
57
58class Wanderlust {
59public:
60 Wanderlust(const std::string& words_filename, const std::string& puzzles_filename) {
61 std::ifstream words_file(words_filename);
62 std::string line;
63 while (std::getline(words_file, line)) {
64 words_.push_back(line);
65 }
66
67 std::ifstream puzzles_file(puzzles_filename);
68 while (std::getline(puzzles_file, line)) {
69 std::string line2;
70 if (!std::getline(puzzles_file, line2)) {
71 throw std::invalid_argument("Wanderlust file is malformed.");
72 }
73
74 puzzles_.emplace_back(line, line2);
75 }
76 }
77
78 std::tuple<std::string, std::string> GetPuzzle(std::mt19937& rng) const {
79 return puzzles_.at(std::uniform_int_distribution<int>(0, puzzles_.size()-1)(rng));
80 }
81
82 const std::string& GetWord(std::mt19937& rng) const {
83 return words_.at(std::uniform_int_distribution<int>(0, words_.size()-1)(rng));
84 }
85
86private:
87 std::vector<std::tuple<std::string, std::string>> puzzles_;
88 std::vector<std::string> words_;
89};
90
91class CrossTower {
92public:
93 explicit CrossTower(std::string filename) {
94 std::ifstream file(filename);
95 std::string line;
96 while (std::getline(file, line)) {
97 sets_.push_back(hatkirby::split<std::vector<std::string>>(line, " "));
98 }
99 }
100
101 std::vector<std::vector<std::string>> GetPuzzleSet(std::mt19937& rng) const {
102 std::vector<std::vector<std::string>> result = sets_;
103 std::shuffle(result.begin(), result.end(), rng);
104 result.resize(4);
105
106 for (std::vector<std::string>& set : result) {
107 std::shuffle(set.begin(), set.end(), rng);
108 }
109
110 return result;
111 }
112
113private:
114 std::vector<std::vector<std::string>> sets_;
115};
116
117class Generator {
118public:
119
120 explicit Generator(unsigned int seed) : seed_(seed), rng_(seed) {
121 database_ = std::make_unique<verbly::database>("/Users/hatkirby/Dropbox/Programming/verbly-datafiles/d1.3_lingo7");
122 wanderlust_ = std::make_unique<Wanderlust>("../wanderlust_words.txt", "../wanderlust_puzzles.txt");
123 cross_tower_ = std::make_unique<CrossTower>("../cross_tower.txt");
124 }
125
126 // Querying
127 bool IsPanelRandomized(const std::string& name) const {
128 return panels_.count(name);
129 }
130
131 const std::tuple<std::string, std::string>& GetPanel(const std::string& name) const {
132 return panels_.at(name);
133 }
134
135 // Sets the panel's question and answer to static values.
136 void GenerateStaticPanel(std::string name, std::string question, std::string answer = "");
137
138 // Generates a one-block puzzle with the given height and colour.
139 void GenerateSinglePanel(std::string name, Height height, Colour colour, GenerateOptions options = {});
140
141 // Generates a one-block puzzle with the given height and colour, where there is a panel on two faces of the block.
142 // Both puzzles will have the same answer.
143 void GenerateDoublePanel(std::string name1, std::string name2, Height height, Colour colour, GenerateOptions options = {});
144
145 // Generates two puzzles with the same hint but different answers.
146 void GenerateCohintedPanels(std::string name1, std::string name2, Height height, Colour colour, GenerateOptions options = {});
147
148 // Generates two panels at once, where the question for one is the answer to the other.
149 // Colour must be white, black, or yellow.
150 // Middle white is a special case; the puzzles will be antonyms of one another.
151 void GeneratePairedPanels(std::string name1, std::string name2, Height height, Colour colour, GenerateOptions options = {});
152
153 // Generates a vertical stack of panels that all have the same answer.
154 // If a name is left blank, that height will be ignored.
155 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 = {});
156
157 // Generate an orange puzzle, with a number for the hint.
158 void GenerateOrangeNumberPanel(std::string name);
159
160 // Generate an orange puzzle, with a word for the hint.
161 void GenerateOrangeWordPanel(std::string name);
162
163 // Generate an orange puzzle, with an addition problem for the hint.
164 void GenerateOrangeAdditionPanel(std::string name);
165
166 // Generates the ONE ROAD MANY TURNS panel by combining the solutions to four other panels.
167 void GenerateOneRoadManyTurns(std::string order_name, std::string part1_name, std::string part2_name, std::string part3_name, std::string part4_name);
168
169 // Generates a hybrid puzzle where the solution is two words and each word is provided by a different colour/height puzzle.
170 void GenerateComboPanel(std::string name, Height left_height, Colour left_colour, Height right_height, Colour right_colour, GenerateOptions options = {});
171
172 // Generates the cross tower sets-of-four puzzles.
173 void GenerateCrossTower(
174 std::string north_tower_name,
175 std::string south_tower_name,
176 std::string east_tower_name,
177 std::string west_tower_name,
178 std::string north_lookout_name,
179 std::string south_lookout_name,
180 std::string east_lookout_name,
181 std::string west_lookout_name,
182 std::string north_other_name1,
183 std::string north_other_name2,
184 std::string north_other_name3,
185 std::string south_other_name1,
186 std::string south_other_name2,
187 std::string south_other_name3,
188 std::string east_other_name1,
189 std::string east_other_name2,
190 std::string east_other_name3,
191 std::string west_other_name1,
192 std::string west_other_name2,
193 std::string west_other_name3);
194
195private:
196
197 verbly::filter MakeHintFilter(verbly::filter subfilter, Height height, Colour colour, FilterDirection filter_direction);
198
199 bool GenerateSinglePanelImpl(std::string name, Height height, Colour colour, GenerateOptions options);
200
201 bool GenerateDoublePanelImpl(std::string name1, std::string name2, Height height, Colour colour, GenerateOptions options);
202
203 bool GenerateCohintedPanelsImpl(std::string name1, std::string name2, Height height, Colour colour, GenerateOptions options);
204
205 bool GeneratePairedPanelsImpl(std::string name1, std::string name2, Height height, Colour colour, GenerateOptions options);
206
207 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);
208
209 bool GenerateComboPanelImpl(std::string name, Height left_height, Colour left_colour, Height right_height, Colour right_colour, GenerateOptions options);
210
211 void SavePanel(std::string name, std::string question, std::string answer, GenerateOptions options = {});
212
213 verbly::filter GetWordFilter(FilterDirection direction, GenerateOptions options) const;
214
215 bool IsClueTrivial(Height height, Colour colour, const verbly::form& clue, const verbly::form& solution) const;
216
217 unsigned int seed_;
218 std::mt19937 rng_;
219 std::unique_ptr<verbly::database> database_;
220 std::unique_ptr<Wanderlust> wanderlust_;
221 std::unique_ptr<CrossTower> cross_tower_;
222
223 // name, question, answer
224 std::map<std::string, std::tuple<std::string, std::string>> panels_;
225
226 std::vector<std::string> reusable_;
227 std::map<std::string, std::set<std::string>> pools_;
228};
229
230#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 @@
1#include <random>
2#include <fstream>
3#include <iostream>
4#include <string>
5#include "generator.h"
6
7class Randomizer {
8public:
9
10 explicit Randomizer(unsigned int seed) : seed_(seed), gen_(seed) {}
11
12 void Run() {
13 // Entry room
14 gen_.GenerateStaticPanel("Panel_hi_hi", "hewwo");
15 gen_.GenerateStaticPanel("Panel_type_type", "mode");
16 gen_.GenerateStaticPanel("Panel_this_this", "normal");
17 gen_.GenerateStaticPanel("Panel_write_write", "random seed");
18 gen_.GenerateStaticPanel("Panel_same_same", std::to_string(seed_));
19 gen_.GenerateSinglePanel("Panel_hidden_hidden", kMiddle, kWhite);
20 gen_.GenerateSinglePanel("Panel_hi_high", kTop, kWhite);
21 gen_.GenerateSinglePanel("Panel_low_low", kBottom, kWhite, {.max_answer_len = 7});
22 gen_.GenerateSinglePanel("Panel_forward_forward", kMiddle, kWhite, {.obscure_hint = true, .max_answer_len = 20});
23 gen_.GenerateSinglePanel("Panel_between_between", kMiddle, kWhite, {.obscure_hint = true, .max_answer_len = 20});
24 gen_.GenerateSinglePanel("Panel_backward_backward", kMiddle, kWhite, {.obscure_hint = true, .max_answer_len = 20});
25 gen_.GenerateSinglePanel("Panel_secret_secret", kMiddle, kWhite, {.obscure_hint = true, .max_answer_len = 20});
26
27 // The Traveled
28 gen_.GenerateSinglePanel("Panel_open_open", kMiddle, kWhite, {.obscure_hint = true, .unique_pool = "traveled"});
29 gen_.GenerateSinglePanel("Panel_close_near", kBottom, kWhite, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "traveled"});
30 gen_.GenerateDoublePanel("Panel_compose_write", "Panel_record_write", kBottom, kWhite, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "traveled"});
31 gen_.GenerateSinglePanel("Panel_category_type", kBottom, kWhite, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "traveled"});
32 gen_.GenerateSinglePanel("Panel_hello_hi", kBottom, kWhite, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "traveled"});
33 gen_.GenerateDoublePanel("Panel_duplicate_same", "Panel_identical_same", kBottom, kWhite, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "traveled"});
34 gen_.GenerateSinglePanel("Panel_distant_far", kBottom, kWhite, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "traveled"});
35 gen_.GenerateSinglePanel("Panel_hay_straw", kBottom, kWhite, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "traveled"});
36 gen_.GenerateDoublePanel("Panel_giggle_laugh", "Panel_chuckle_laugh", kBottom, kWhite, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "traveled"});
37 gen_.GenerateSinglePanel("Panel_snitch_rat", kBottom, kWhite, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "traveled"});
38 gen_.GenerateSinglePanel("Panel_concealed_hidden", kBottom, kWhite, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "traveled"});
39 gen_.GenerateDoublePanel("Panel_plunge_fall", "Panel_autumn_fall", kBottom, kWhite, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "traveled"});
40 gen_.GenerateSinglePanel("Panel_growths_warts", kBottom, kWhite, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "traveled"});
41
42 // The Agreeable
43 gen_.GenerateSinglePanel("Panel_close_open", kBottom, kBlack, {.max_answer_len = 6, .unique_pool = "agreeable"});
44 gen_.GenerateSinglePanel("Panel_retool_looter", kMiddle, kBlack, {.save_for_later = true, .unique_pool = "agreeable", .palindrome = kRejectPalindrome});
45 gen_.GenerateSinglePanel("Panel_drawer_reward", kMiddle, kBlack, {.save_for_later = true, .unique_pool = "agreeable", .palindrome = kRejectPalindrome});
46 gen_.GenerateSinglePanel("Panel_read_write", kBottom, kBlack, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "agreeable"});
47 gen_.GenerateSinglePanel("Panel_different_same", kBottom, kBlack, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "agreeable"});
48 gen_.GenerateSinglePanel("Panel_bye_hi", kBottom, kBlack, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "agreeable"});
49 gen_.GenerateSinglePanel("Panel_low_high", kBottom, kBlack, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "agreeable"});
50 gen_.GenerateSinglePanel("Panel_alive_dead", kBottom, kBlack, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "agreeable"});
51 gen_.GenerateSinglePanel("Panel_that_this", kBottom, kBlack, {.max_answer_len = 7, .save_for_later = true, .unique_pool = "agreeable"});
52 gen_.GenerateSinglePanel("Panel_stressed_desserts", kMiddle, kBlack, {.unique_pool = "agreeable", .palindrome = kRejectPalindrome});
53 gen_.GenerateSinglePanel("Panel_star_rats", kMiddle, kBlack, {.unique_pool = "agreeable", .palindrome = kRejectPalindrome});
54 gen_.GenerateSinglePanel("Panel_tame_mate", kTop, kBlack, {.unique_pool = "agreeable"});
55 gen_.GenerateSinglePanel("Panel_cat_tack", kTop, kBlack, {.unique_pool = "agreeable"});
56 gen_.GeneratePairedPanels("Panel_leaf_feel", "Panel_feel_leaf", kTop, kBlack, {.obscure_hint = true, .save_for_later = true});
57 gen_.GeneratePairedPanels("Panel_warts_straw", "Panel_straw_warts", kMiddle, kBlack, {.obscure_hint = true, .save_for_later = true, .palindrome = kRejectPalindrome});
58 gen_.GeneratePairedPanels("Panel_near_far", "Panel_far_near", kBottom, kBlack, {.obscure_hint = true, .save_for_later = true});
59 // Panel_left_wrong: left? wrong!
60 gen_.GenerateSinglePanel("Panel_black_white", kBottom, kBlack, {.max_answer_len = 7});
61 gen_.GeneratePairedPanels("Panel_left_right", "Panel_right_left", kBottom, kBlack, {.obscure_hint = true});
62
63 // The Seeker
64 gen_.GenerateSinglePanel("Panel_entrance_entrance", kMiddle, kWhite, {.obscure_hint = true, .save_for_later = true, .unique_pool = "seeker"});
65 gen_.GenerateSinglePanel("Panel_bear_bear", kMiddle, kWhite, {.obscure_hint = true, .save_for_later = true, .unique_pool = "seeker"});
66 gen_.GenerateDoublePanel("Panel_mine_mine", "Panel_mine_mine_2", kMiddle, kWhite, {.obscure_hint = true, .save_for_later = true, .unique_pool = "seeker"});
67 gen_.GenerateSinglePanel("Panel_bow_bow", kMiddle, kWhite, {.obscure_hint = true, .save_for_later = true, .unique_pool = "seeker"});
68 gen_.GenerateSinglePanel("Panel_does_does", kMiddle, kWhite, {.obscure_hint = true, .save_for_later = true, .unique_pool = "seeker"});
69 gen_.GenerateDoublePanel("Panel_mobile_mobile", "Panel_mobile_mobile_2", kMiddle, kWhite, {.obscure_hint = true, .save_for_later = true, .unique_pool = "seeker"});
70 gen_.GeneratePanelStack("Panel_desert_dessert", kWhite, "Panel_desert_desert", kWhite, "", {}, {.obscure_hint = true, .save_for_later = true, .unique_pool = "seeker"});
71 gen_.GeneratePanelStack("Panel_sow_so", kWhite, "Panel_sow_sow", kWhite, "", {}, {.obscure_hint = true, .save_for_later = true, .unique_pool = "seeker"});
72 gen_.GenerateDoublePanel("Panel_two_to", "Panel_two_too", kTop, kWhite, {.save_for_later = true, .unique_pool = "seeker"});
73 gen_.GenerateSinglePanel("Panel_write_right", kTop, kWhite, {.save_for_later = true, .unique_pool = "seeker"});
74 gen_.GenerateSinglePanel("Panel_you_ewe", kTop, kWhite, {.save_for_later = true, .unique_pool = "seeker"});
75 gen_.GenerateDoublePanel("Panel_not_knot", "Panel_not_naught", kTop, kWhite, {.save_for_later = true, .unique_pool = "seeker"});
76 gen_.GenerateSinglePanel("Panel_bear_bare", kTop, kWhite, {.save_for_later = true, .unique_pool = "seeker"});
77
78 // The Tenacious
79 gen_.GenerateSinglePanel("Panel_slaughter_laughter", kMiddle, kRed, {.unique_pool = "tenacious"});
80 gen_.GenerateSinglePanel("Panel_dread_dead", kMiddle, kRed, {.unique_pool = "tenacious"});
81 gen_.GenerateSinglePanel("Panel_massacred_sacred", kMiddle, kRed, {.unique_pool = "tenacious"});
82 gen_.GenerateSinglePanel("Panel_decay_day", kMiddle, kRed, {.unique_pool = "tenacious"});
83 gen_.GeneratePairedPanels("Panel_solos_solos", "Panel_solos_solos_2", kMiddle, kBlack, {.palindrome = kForcePalindrome});
84 gen_.GeneratePairedPanels("Panel_racecar_racecar", "Panel_racecar_racecar_2", kMiddle, kBlack, {.palindrome = kForcePalindrome});
85 gen_.GeneratePairedPanels("Panel_level_level", "Panel_level_level_2", kMiddle, kBlack, {.palindrome = kForcePalindrome});
86
87 // The Bold
88 gen_.GenerateSinglePanel("Panel_heartbreak_brake", kTop, kRed, {.save_for_later = true, .unique_pool = "bold"});
89 gen_.GenerateSinglePanel("Panel_airplane_plain", kTop, kRed, {.save_for_later = true, .unique_pool = "bold"});
90 gen_.GenerateSinglePanel("Panel_nightmare_knight", kTop, kRed, {.save_for_later = true, .unique_pool = "bold"});
91 gen_.GenerateSinglePanel("Panel_sign_sigh", kTop, kRed, {.save_for_later = true, .unique_pool = "bold"});
92 gen_.GenerateSinglePanel("Panel_unopened_open", kMiddle, kRed, {.save_for_later = true, .unique_pool = "bold"});
93 gen_.GenerateDoublePanel("Panel_undead_dead", "Panel_deadline_dead", kMiddle, kRed, {.save_for_later = true, .unique_pool = "bold"});
94 gen_.GenerateSinglePanel("Panel_sushi_hi", kMiddle, kRed, {.reuse_solution = true, .unique_pool = "bold"});
95 gen_.GenerateSinglePanel("Panel_thistle_this", kMiddle, kRed, {.reuse_solution = true, .unique_pool = "bold"});
96 gen_.GenerateDoublePanel("Panel_landmass_mass", "Panel_massacred_mass", kMiddle, kRed, {.save_for_later = true, .unique_pool = "bold"});
97 gen_.GenerateDoublePanel("Panel_face_eye", "Panel_needle_eye", kBottom, kRed, {.max_answer_len = 6, .unique_pool = "bold"});
98 gen_.GenerateSinglePanel("Panel_foot_toe", kBottom, kRed, {.max_answer_len = 6, .unique_pool = "bold"});
99 gen_.GenerateDoublePanel("Panel_mouth_teeth", "Panel_saw_teeth", kBottom, kRed, {.max_answer_len = 6, .unique_pool = "bold"});
100 gen_.GenerateSinglePanel("Panel_hand_finger", kBottom, kRed, {.max_answer_len = 6, .unique_pool = "bold"});
101
102 // The Steady
103
104 // The Undeterred
105 gen_.GenerateSinglePanel("Panel_two_toucan", kTop, kBlue, {.unique_pool = "undeterred", .reuse_solution = true});
106 gen_.GenerateDoublePanel("Panel_ice_eyesight", "Panel_height_eyesight", kTop, kBlue, {.unique_pool = "undeterred", .max_answer_len = 6});
107 gen_.GenerateSinglePanel("Panel_eye_hi", kTop, kBlue, {.unique_pool = "undeterred", .reuse_solution = true});
108 gen_.GenerateSinglePanel("Panel_pen_open", kMiddle, kBlue, {.max_answer_len = 4, .unique_pool = "undeterred"});
109 gen_.GenerateSinglePanel("Panel_not_notice", kMiddle, kBlue, {.unique_pool = "undeterred", .max_answer_len = 6});
110 gen_.GenerateDoublePanel("Panel_just_readjust", "Panel_read_readjust", kMiddle, kBlue, {.unique_pool = "undeterred"});
111 gen_.GenerateSinglePanel("Panel_ate_primate", kMiddle, kBlue, {.unique_pool = "undeterred", .reuse_solution = true});
112 gen_.GenerateSinglePanel("Panel_bone_skeleton", kBottom, kBlue, {.max_answer_len = 7, .unique_pool = "undeterred"});
113 gen_.GenerateDoublePanel("Panel_mouth_face", "Panel_eye_face", kBottom, kBlue, {.max_answer_len = 4, .unique_pool = "undeterred"});
114 gen_.GenerateSinglePanel("Panel_toucan_bird", kBottom, kBlue, {.max_answer_len = 4, .unique_pool = "undeterred"});
115 gen_.GenerateSinglePanel("Panel_primate_mammal", kBottom, kBlue, {.max_answer_len = 6, .unique_pool = "undeterred"});
116 gen_.GenerateDoublePanel("Panel_continent_planet", "Panel_ocean_planet", kBottom, kBlue, {.max_answer_len = 6, .unique_pool = "undeterred"});
117 gen_.GenerateSinglePanel("Panel_wall_room", kBottom, kBlue, {.max_answer_len = 4, .unique_pool = "undeterred"});
118
119 // The Discerning
120 gen_.GenerateSinglePanel("Panel_nope_open", kMiddle, kYellow, {.max_answer_len = 4, .unique_pool = "discerning"});
121 gen_.GenerateSinglePanel("Panel_hits_this", kMiddle, kYellow, {.save_for_later = true, .unique_pool = "discerning"});
122 gen_.GenerateDoublePanel("Panel_warred_drawer", "Panel_redraw_drawer", kMiddle, kYellow, {.save_for_later = true, .unique_pool = "discerning"});
123 gen_.GenerateSinglePanel("Panel_adder_dread", kMiddle, kYellow, {.save_for_later = true, .unique_pool = "discerning"});
124 gen_.GenerateSinglePanel("Panel_laughters_slaughter", kMiddle, kYellow, {.save_for_later = true, .unique_pool = "discerning"});
125 gen_.GenerateDoublePanel("Panel_stone_notes", "Panel_onset_notes", kMiddle, kYellow, {.save_for_later = true, .unique_pool = "discerning"});
126 gen_.GenerateSinglePanel("Panel_rat_art", kMiddle, kYellow, {.save_for_later = true, .unique_pool = "discerning"});
127 gen_.GenerateSinglePanel("Panel_dusty_study", kMiddle, kYellow, {.save_for_later = true, .unique_pool = "discerning"});
128 gen_.GenerateDoublePanel("Panel_arts_star", "Panel_tsar_star", kMiddle, kYellow, {.save_for_later = true, .unique_pool = "discerning"});
129 gen_.GenerateSinglePanel("Panel_state_taste", kMiddle, kYellow, {.save_for_later = true, .unique_pool = "discerning"});
130 gen_.GenerateSinglePanel("Panel_react_trace", kMiddle, kYellow, {.save_for_later = true, .unique_pool = "discerning"});
131 gen_.GenerateDoublePanel("Panel_dear_read", "Panel_dare_read", kMiddle, kYellow, {.save_for_later = true, .unique_pool = "discerning"});
132 gen_.GenerateSinglePanel("Panel_seam_same", kMiddle, kYellow, {.save_for_later = true, .unique_pool = "discerning"});
133
134 // Crossroads
135 gen_.GeneratePairedPanels("Panel_sword_words", "Panel_words_sword", kMiddle, kYellow);
136 gen_.GeneratePairedPanels("Panel_turn_runt", "Panel_turn_runt2", kMiddle, kYellow);
137 // Panel_runt3: runt? return!
138 gen_.GenerateSinglePanel("Panel_corner", kTop, kYellow, {.multiword = true});
139 gen_.GenerateSinglePanel("Panel_order_chaos", kBottom, kBlack, {.max_answer_len = 7});
140 gen_.GenerateSinglePanel("Panel_swap_wasp", kMiddle, kYellow);
141 gen_.GenerateCohintedPanels("Panel_lost_lots", "Panel_lost_slot", kMiddle, kYellow);
142 gen_.GenerateSinglePanel("Panel_gel", kTop, kYellow);
143 gen_.GenerateSinglePanel("Panel_though", kTop, kYellow);
144 gen_.GenerateSinglePanel("Panel_eyes_see_shuffle", kMiddle, kYellow, {.multiword = true});
145 gen_.GenerateSinglePanel("Panel_theeyes_theeyes", kMiddle, kWhite, {.multiword = true, .obscure_hint = true, .max_answer_len = 20});
146 gen_.GenerateDoublePanel("Panel_amen_mean", "Panel_name_mean", kMiddle, kYellow);
147 gen_.GenerateSinglePanel("Panel_behind", kMiddle, kYellow, {.multiword = true});
148 gen_.GenerateSinglePanel("Panel_crossroads_crossroads", kMiddle, kWhite, {.obscure_hint = true, .max_answer_len = 20});
149 gen_.GenerateSinglePanel("Panel_corner_corner", kMiddle, kWhite, {.obscure_hint = true, .max_answer_len = 20});
150 gen_.GenerateSinglePanel("Panel_hollow_hollow", kMiddle, kWhite, {.obscure_hint = true, .max_answer_len = 20});
151 gen_.GeneratePairedPanels("Panel_far_far", "Panel_near_near", kMiddle, kWhite, {.obscure_hint = true, .max_answer_len = 20});
152 gen_.GenerateSinglePanel("Panel_lost_found", kBottom, kBlack, {.max_answer_len = 7});
153 gen_.GenerateSinglePanel("Panel_clockwise_counterclockwise", kBottom, kBlack, {.max_answer_len = 20});
154
155 // Panel_past_present: past? present!
156 // Panel_future_present: future? present!
157 // Panel_future_past: future? past!
158 // Panel_past_future: past? future!
159 // Panel_past_past: past? past!
160 // Panel_pinecone_pine: pinecone? pine!
161 // Panel_acorn_oak: acorn? oak!
162
163 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"});
164 gen_.GenerateSinglePanel("Panel_middle_middle", kMiddle, kWhite, {.obscure_hint = true, .max_answer_len = 20, .copy_to = "Panel_middle_middle_2"});
165 gen_.GenerateSinglePanel("Panel_shortcuts", kMiddle, kYellow, {.multiword = true});
166 gen_.GenerateSinglePanel("Panel_tower", kMiddle, kYellow, {.multiword = true});
167
168 // The Perceptive
169 gen_.GenerateSinglePanel("Panel_trace_trace", kMiddle, kWhite, {.obscure_hint = true});
170 // Panel_path_lock: path? lock!
171 // Panel_path_knot: path? knot!
172 // Panel_path_lost: path? lost!
173 gen_.GenerateSinglePanel("Panel_look_look", kBottom, kWhite, {.max_answer_len = 7});
174 // Panel_path_open: path? open!
175 // Panel_path_help: path? help!
176 // Panel_path_hunt: path? hunt!
177 // Panel_path_nest: path? nest!
178 // Panel_path_look: path? look!
179 gen_.GenerateSinglePanel("Panel_down_up", kBottom, kBlack, {.max_answer_len = 7});
180 gen_.GenerateSinglePanel("Panel_strays_maze", kTop, kPurple, {.reuse_solution = true});
181 gen_.GenerateSinglePanel("Panel_daze_maze", kMiddle, kPurple, {.max_answer_len = 6, .reuse_solution = true});
182 gen_.GenerateSinglePanel("Panel_reflow_flower", kMiddle, kYellow);
183 gen_.GenerateSinglePanel("Panel_leap_jump", kBottom, kWhite, {.max_answer_len = 7});
184 gen_.GenerateSinglePanel("Panel_hide_seek", kBottom, kBlack, {.max_answer_len = 7});
185 gen_.GenerateSinglePanel("Panel_hide_seek_2", kBottom, kBlack, {.max_answer_len = 7});
186 gen_.GenerateSinglePanel("Panel_hide_seek_3", kBottom, kBlack, {.max_answer_len = 7});
187 gen_.GenerateSinglePanel("Panel_hide_seek_4", kBottom, kBlack, {.max_answer_len = 7});
188
189 // The Observant
190
191 // Knight/Night
192 gen_.GenerateSinglePanel("Panel_rat_tar", kMiddle, kBlack, {.palindrome = kRejectPalindrome});
193 gen_.GenerateSinglePanel("Panel_discover_recover", kMiddle, kPurple, {.max_answer_len = 7});
194 gen_.GenerateSinglePanel("Panel_deadend_deadened", kTop, kWhite, {.multiword = true});
195 gen_.GenerateSinglePanel("Panel_deadend_deadend", kMiddle, kWhite, {.multiword = true, .obscure_hint = true});
196 gen_.GenerateSinglePanel("Panel_warner_corner", kTop, kPurple);
197 gen_.GenerateSinglePanel("Panel_lies_lies", kMiddle, kWhite, {.obscure_hint = true, .max_answer_len = 20});
198 gen_.GeneratePairedPanels("Panel_night_knight", "Panel_knight_night", kMiddle, kBlue);
199 gen_.GenerateSinglePanel("Panel_bee_be", kMiddle, kRed);
200 gen_.GenerateSinglePanel("Panel_new_knew", kMiddle, kBlue, {.max_answer_len = 4});
201 gen_.GenerateSinglePanel("Panel_fore_for", kMiddle, kRed);
202 gen_.GenerateCohintedPanels("Panel_trusted_trust", "Panel_trusted_rusted", kMiddle, kRed, {.save_for_later = true});
203 gen_.GenerateCohintedPanels("Panel_rust_trust", "Panel_rust_crust", kMiddle, kBlue, {.max_answer_len = 5, .save_for_later = true});
204 gen_.GenerateSinglePanel("Panel_encrusted_rust", kMiddle, kRed, {.save_for_later = true});
205 gen_.GenerateCohintedPanels("Panel_adjust_readjust", "Panel_adjust_adjusted", kMiddle, kBlue, {.max_answer_len = 6, .save_for_later = true});
206 gen_.GenerateSinglePanel("Panel_adjust_readjusted", kMiddle, kBlue, {.save_for_later = true});
207 gen_.GeneratePairedPanels("Panel_before_fore", "Panel_be_before", kMiddle, kRed, {.obscure_hint = true});
208 gen_.GenerateSinglePanel("Panel_trust_crust", kMiddle, kPurple, {.reuse_solution = true});
209 gen_.GenerateSinglePanel("Panel_trust_crust_2", kMiddle, kPurple, {.reuse_solution = true});
210 gen_.GenerateSinglePanel("Panel_trusted_readjusted", kMiddle, kPurple, {.reuse_solution = true});
211
212 // The Initiated
213 gen_.GenerateSinglePanel("Panel_locked_knocked", kMiddle, kPurple, {.max_hint_len = 5, .max_answer_len = 5, .reuse_solution = true, .unique_pool = "initiated"});
214 gen_.GenerateSinglePanel("Panel_daughter_laughter", kMiddle, kPurple, {.reuse_solution = true, .unique_pool = "initiated"});
215 gen_.GenerateDoublePanel("Panel_move_love", "Panel_stove_love", kMiddle, kPurple, {.reuse_solution = true, .unique_pool = "initiated"});
216 gen_.GenerateSinglePanel("Panel_scope_type", kMiddle, kPurple, {.reuse_solution = true, .unique_pool = "initiated"});
217 gen_.GenerateSinglePanel("Panel_abyss_this", kMiddle, kPurple, {.max_hint_len = 6, .reuse_solution = true, .unique_pool = "initiated"});
218 gen_.GenerateDoublePanel("Panel_sweat_great", "Panel_beat_great", kMiddle, kPurple, {.max_hint_len = 6, .reuse_solution = true, .unique_pool = "initiated"});
219 gen_.GenerateSinglePanel("Panel_alumni_hi", kTop, kPurple, {.reuse_solution = true, .unique_pool = "initiated"});
220 gen_.GenerateSinglePanel("Panel_wrath_path", kMiddle, kPurple, {.max_hint_len = 6, .reuse_solution = true, .unique_pool = "initiated"});
221 gen_.GenerateDoublePanel("Panel_knight_write", "Panel_byte_write", kTop, kPurple, {.reuse_solution = true, .unique_pool = "initiated"});
222 gen_.GenerateSinglePanel("Panel_maim_same", kTop, kPurple, {.reuse_solution = true, .unique_pool = "initiated"});
223 gen_.GenerateSinglePanel("Panel_bare_bear", kTop, kPurple, {.reuse_solution = true, .unique_pool = "initiated"});
224 gen_.GeneratePanelStack("Panel_chair_bear", kPurple, "", {}, "Panel_cost_most", kPurple, {.reuse_solution = true, .unique_pool = "initiated"});
225 gen_.GenerateSinglePanel("Panel_bed_dead", kMiddle, kPurple, {.max_hint_len = 6, .reuse_solution = true, .unique_pool = "initiated"});
226
227 // The Bearer
228 // Panel_north_missing: ? north!
229 // Panel_diamonds_missing: ? diamonds!
230 // Panel_fire_missing: ? fire!
231 // Panel_winter_missing: ? winter!
232 gen_.GenerateSinglePanel("Panel_shortcut_shortcut", kMiddle, kWhite, {.obscure_hint = true, .max_answer_len = 20});
233 // Panel_north_north: ? north!
234 // Panel_mouth_south: sound? south!
235 // Panel_yeast_east: yeast? east!
236 // Panel_wet_west: wet? west!
237 // Panel_fire_fire: ? fire!
238 // Panel_earth_earth: earth? earth!
239 // Panel_water_water: water? water!
240 // Panel_air_air: air? air!
241 // Panel_winter_winter: ? winter!
242 // Panel_diamonds_diamonds: ? diamonds!
243 // Panel_spades_spades: spades? spades!
244 // Panel_clubs_clubs: clubs? clubs!
245 // Panel_hearts_hearts: hearts? hearts!
246 // Panel_part_rap: part? rap!
247 // Panel_heart_tar: heart? tar!
248 // Panel_smile_lime: smile? lime!
249 // Panel_snow_won: snow? won!
250 // Panel_warts_star: warts? star!
251 // Panel_pots_top: pots? top!
252 // Panel_silent_list: silent? list!
253 // Panel_silent_list_2: silent? list!
254 // Panel_tent_net: tent? net!
255 // Panel_peace_ape: peace? ape!
256 // Panel_space_cape: space? cape!
257 // Panel_bowl_low: bowl? low!
258
259 // Wanderlust
260 gen_.GenerateOrangeNumberPanel("Panel_lust");
261 gen_.GenerateOrangeNumberPanel("Panel_read");
262 gen_.GenerateOrangeNumberPanel("Panel_sew");
263 gen_.GenerateOrangeNumberPanel("Panel_dead");
264 gen_.GenerateOrangeNumberPanel("Panel_1234567890_wanderlust");
265 gen_.GenerateOrangeNumberPanel("Panel_834283054_undaunted");
266 gen_.GenerateOrangeWordPanel("Panel_learn");
267 gen_.GenerateOrangeWordPanel("Panel_dust");
268 gen_.GenerateOrangeWordPanel("Panel_star");
269 gen_.GenerateOrangeWordPanel("Panel_wander");
270 gen_.GenerateOrangeWordPanel("Panel_wanderlust_1234567890");
271 gen_.GenerateOrangeAdditionPanel("Panel_dads_ale_dead_1");
272 gen_.GenerateOrangeAdditionPanel("Panel_art_art_eat_2");
273 gen_.GenerateOrangeAdditionPanel("Panel_deer_wren_rats_3");
274 gen_.GenerateOrangeAdditionPanel("Panel_learns_unsew_unrest_4");
275 gen_.GenerateOrangeAdditionPanel("Panel_drawl_runs_enter_5");
276 gen_.GenerateOrangeAdditionPanel("Panel_reads_rust_lawns_6");
277 gen_.GenerateOrangeAdditionPanel("Panel_waded_wee_warts_7");
278
279 // The Wise
280 // Panel_kitten_cat: kitten? cat!
281 // Panel_cat_kitten: cat? kitten!
282 // Panel_puppy_dog: puppy? dog!
283 // Panel_adult_child: adult? child!
284 // Panel_bread_mold: bread? mold!
285 // Panel_dinosaur_fossil: dinosaur? fossil!
286 // Panel_oak_acorn: oak? acorn!
287 // Panel_corpse_skeleton: corpse? skeleton!
288 // Panel_before_ere: before? ere!
289 // Panel_your_thy: your? thy!
290 // Panel_betwixt_between: betwixt? between!
291 // Panel_nigh_near: nigh? near!
292 // Panel_connexion_connection: connexion? connection!
293 // Panel_thou_you: thou? you!
294
295 // Art Gallery
296 gen_.GenerateSinglePanel("Panel_eon_one", kMiddle, kYellow, {.max_answer_len = 5});
297 gen_.GenerateSinglePanel("Panel_to_two", kMiddle, kRed);
298 gen_.GenerateSinglePanel("Panel_free_three", kMiddle, kPurple, {.reuse_solution = true, .max_hint_len = 5});
299 gen_.GenerateSinglePanel("Panel_our_four", kMiddle, kBlue, {.reuse_solution = true});
300 gen_.GenerateSinglePanel("Panel_house_neighborhood", kBottom, kBlue, {.max_answer_len = 6});
301 gen_.GenerateStaticPanel("Panel_path_road", "path", "road"); // can't randomise brown yet
302 gen_.GenerateSinglePanel("Panel_park_drive", kBottom, kBlack, {.max_answer_len = 6});
303 gen_.GenerateSinglePanel("Panel_carriage_horse", kBottom, kRed, {.max_answer_len = 6});
304 gen_.GenerateSinglePanel("Panel_an_many", kMiddle, kBlue, {.max_answer_len = 4});
305 gen_.GenerateSinglePanel("Panel_may_many", kMiddle, kBlue, {.max_answer_len = 4});
306 gen_.GenerateSinglePanel("Panel_any_many", kMiddle, kBlue, {.max_answer_len = 4});
307 gen_.GenerateSinglePanel("Panel_man_many", kMiddle, kBlue, {.max_answer_len = 4});
308 gen_.GenerateSinglePanel("Panel_urns_turns", kMiddle, kBlue, {.reuse_solution = true});
309 gen_.GenerateSinglePanel("Panel_learns_turns", kMiddle, kPurple, {.reuse_solution = true, .max_answer_len = 5});
310 gen_.GenerateSinglePanel("Panel_runts_turns", kMiddle, kYellow);
311 gen_.GenerateOrangeAdditionPanel("Panel_send_use_turns");
312 gen_.GenerateOrangeWordPanel("Panel_trust_06890");
313 gen_.GenerateOrangeNumberPanel("Panel_06890_trust");
314 gen_.GenerateOneRoadManyTurns("Panel_order_onepathmanyturns", "Panel_eon_one", "Panel_path_road", "Panel_any_many", "Panel_send_use_turns");
315
316 // Rhyme Rooms
317 gen_.GeneratePanelStack("Panel_ascend_rhyme", kPurple, "", {}, "Panel_ascend_syn", kWhite, {.unique_pool = "rhyme"});
318 gen_.GeneratePanelStack("Panel_double_rhyme", kPurple, "", {}, "Panel_double_syn", kWhite, {.unique_pool = "rhyme"});
319 gen_.GeneratePanelStack("Panel_blocked_rhyme", kPurple, "", {}, "Panel_blocked_syn", kWhite, {.unique_pool = "rhyme"});
320 gen_.GeneratePanelStack("Panel_rise_rhyme", kPurple, "", {}, "Panel_rise_syn", kWhite, {.unique_pool = "rhyme"});
321 gen_.GeneratePanelStack("Panel_crystal_rhyme", kPurple, "", {}, "Panel_crystal_syn", kWhite, {.unique_pool = "rhyme"});
322 gen_.GeneratePanelStack("Panel_creative_rhyme", kPurple, "", {}, "Panel_creative_syn", kWhite, {.unique_pool = "rhyme"});
323 gen_.GeneratePanelStack("Panel_child_rhyme", kPurple, "", {}, "Panel_child_syn", kWhite, {.unique_pool = "rhyme"});
324 gen_.GeneratePanelStack("Panel_hidden_rhyme", kPurple, "", {}, "Panel_hidden_syn", kWhite, {.unique_pool = "rhyme"});
325 gen_.GeneratePanelStack("Panel_word_rhyme", kPurple, "", {}, "Panel_word_whole", kBlue, {.unique_pool = "rhyme"});
326 gen_.GeneratePanelStack("Panel_silent_rhyme", kPurple, "", {}, "Panel_silent_syn", kWhite, {.unique_pool = "rhyme"});
327 gen_.GeneratePanelStack("Panel_bones_rhyme", kPurple, "", {}, "Panel_bones_syn", kWhite, {.unique_pool = "rhyme"});
328 gen_.GeneratePanelStack("Panel_sentence_rhyme", kPurple, "", {}, "Panel_sentence_whole", kBlue, {.unique_pool = "rhyme"});
329 gen_.GeneratePanelStack("Panel_dream_rhyme", kPurple, "", {}, "Panel_dream_syn", kWhite, {.unique_pool = "rhyme"});
330 gen_.GeneratePanelStack("Panel_mystery_rhyme", kPurple, "", {}, "Panel_mystery_syn", kWhite, {.unique_pool = "rhyme"});
331 gen_.GeneratePanelStack("Panel_jump_rhyme", kPurple, "", {}, "Panel_jump_syn", kWhite, {.unique_pool = "rhyme"});
332 gen_.GeneratePanelStack("Panel_fall_rhyme", kPurple, "", {}, "Panel_fall_syn", kWhite, {.unique_pool = "rhyme"});
333 //gen_.GeneratePanelStack("Panel_return_rhyme", kPurple, "", {}, "Panel_return_ant", kBlack, {.unique_pool = "rhyme"});
334 //gen_.GeneratePanelStack("Panel_descend_rhyme", kPurple, "", {}, "Panel_descend_ant", kBlack, {.unique_pool = "rhyme"});
335 // ^ commenting those out for now because they take disproportionately long to generate currently
336 gen_.GenerateSinglePanel("Panel_leap_leap", kMiddle, kWhite, {.obscure_hint = true});
337
338 // The Optimistic
339 gen_.GenerateSinglePanel("Panel_backside_1", kMiddle, kWhite, {.obscure_hint = true});
340 gen_.GenerateSinglePanel("Panel_backside_2", kMiddle, kWhite, {.obscure_hint = true});
341 gen_.GenerateSinglePanel("Panel_backside_3", kMiddle, kWhite, {.obscure_hint = true});
342 gen_.GenerateSinglePanel("Panel_backside_4", kMiddle, kWhite, {.obscure_hint = true});
343 gen_.GenerateSinglePanel("Panel_backside_5", kMiddle, kWhite, {.obscure_hint = true});
344 gen_.GenerateSinglePanel("Panel_farther_far", kMiddle, kRed);
345 // Panel_first_first: first? first!
346 // Panel_second_second: second? second!
347 // Panel_third_third: third? third!
348 // Panel_fourth_fourth: fourth? fourth!
349
350 // Number Hunt
351 gen_.GenerateSinglePanel("Panel_zero_zero", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 10});
352 gen_.GenerateSinglePanel("Panel_one_one", kMiddle, kWhite, {.exact_len = 1});
353 gen_.GenerateSinglePanel("Panel_two_two", kMiddle, kWhite, {.exact_len = 2});
354 gen_.GenerateSinglePanel("Panel_two_two_2", kMiddle, kWhite, {.exact_len = 2});
355 gen_.GenerateSinglePanel("Panel_three_three", kMiddle, kWhite, {.exact_len = 3});
356 gen_.GenerateSinglePanel("Panel_three_three_2", kMiddle, kWhite, {.exact_len = 3});
357 gen_.GenerateSinglePanel("Panel_three_three_3", kMiddle, kWhite, {.exact_len = 3});
358 gen_.GenerateSinglePanel("Panel_four_four", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 4});
359 gen_.GenerateSinglePanel("Panel_four_four_2", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 4});
360 gen_.GenerateSinglePanel("Panel_four_four_3", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 4});
361 gen_.GenerateSinglePanel("Panel_four_four_4", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 4});
362 gen_.GenerateSinglePanel("Panel_five_five", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 5});
363 gen_.GenerateSinglePanel("Panel_five_five_2", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 5});
364 gen_.GenerateSinglePanel("Panel_five_five_3", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 5});
365 gen_.GenerateSinglePanel("Panel_five_five_4", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 5});
366 gen_.GenerateSinglePanel("Panel_five_five_5", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 5});
367 gen_.GenerateSinglePanel("Panel_six_six", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 6});
368 gen_.GenerateSinglePanel("Panel_six_six_2", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 6});
369 gen_.GenerateSinglePanel("Panel_six_six_3", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 6});
370 gen_.GenerateSinglePanel("Panel_six_six_4", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 6});
371 gen_.GenerateSinglePanel("Panel_six_six_5", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 6});
372 gen_.GenerateSinglePanel("Panel_six_six_6", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 6});
373 gen_.GenerateSinglePanel("Panel_seven_seven", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 7});
374 gen_.GenerateSinglePanel("Panel_seven_seven_2", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 7});
375 gen_.GenerateSinglePanel("Panel_seven_seven_3", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 7});
376 gen_.GenerateSinglePanel("Panel_seven_seven_4", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 7});
377 gen_.GenerateSinglePanel("Panel_seven_seven_5", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 7});
378 gen_.GenerateSinglePanel("Panel_seven_seven_6", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 7});
379 gen_.GenerateSinglePanel("Panel_seven_seven_7", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 7});
380 gen_.GenerateSinglePanel("Panel_eight_eight", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 8});
381 gen_.GenerateSinglePanel("Panel_eight_eight_2", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 8});
382 gen_.GenerateSinglePanel("Panel_eight_eight_3", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 8});
383 gen_.GenerateSinglePanel("Panel_eight_eight_4", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 8});
384 gen_.GenerateSinglePanel("Panel_eight_eight_5", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 8});
385 gen_.GenerateSinglePanel("Panel_eight_eight_6", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 8});
386 gen_.GenerateSinglePanel("Panel_eight_eight_7", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 8});
387 gen_.GenerateSinglePanel("Panel_eight_eight_8", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 8});
388 gen_.GenerateSinglePanel("Panel_nine_nine", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 9});
389 gen_.GenerateSinglePanel("Panel_nine_nine_2", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 9});
390 gen_.GenerateSinglePanel("Panel_nine_nine_3", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 9});
391 gen_.GenerateSinglePanel("Panel_nine_nine_4", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 9});
392 gen_.GenerateSinglePanel("Panel_nine_nine_5", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 9});
393 gen_.GenerateSinglePanel("Panel_nine_nine_6", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 9});
394 gen_.GenerateSinglePanel("Panel_nine_nine_7", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 9});
395 gen_.GenerateSinglePanel("Panel_nine_nine_8", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 9});
396 gen_.GenerateSinglePanel("Panel_nine_nine_9", kMiddle, kWhite, {.obscure_hint = true, .exact_len = 9});
397
398 // Directional Gallery
399 gen_.GenerateStaticPanel("Panel_paranoid_paranoid", "welcome back");
400 gen_.GeneratePairedPanels("Panel_salt_pepper", "Panel_pepper_salt", kBottom, kBlack);
401 gen_.GenerateSinglePanel("Panel_ward_forward", kMiddle, kBlue, {.reuse_solution = true});
402 gen_.GenerateSinglePanel("Panel_hind_behind", kMiddle, kBlue, {.reuse_solution = true});
403 gen_.GenerateSinglePanel("Panel_rig_right", kMiddle, kBlue, {.reuse_solution = true});
404 gen_.GenerateSinglePanel("Panel_windward_forward", kMiddle, kPurple, {.reuse_solution = true});
405 gen_.GenerateSinglePanel("Panel_light_right", kMiddle, kPurple, {.reuse_solution = true});
406 gen_.GenerateSinglePanel("Panel_rewind_behind", kMiddle, kPurple, {.reuse_solution = true});
407 gen_.GenerateSinglePanel("Panel_learn_return", kMiddle, kPurple, {.reuse_solution = true});
408 gen_.GenerateSinglePanel("Panel_turn_return", kMiddle, kBlue, {.reuse_solution = true});
409
410
411
412
413
414
415
416
417 // The Ecstatic
418 gen_.GenerateSinglePanel("Panel_soundgram_1", kTop, kYellow);
419 gen_.GenerateSinglePanel("Panel_soundgram_2", kTop, kYellow);
420 // Panel_scrambled_1: eggs? scrambled eggs!
421 // Panel_scrambled_2: vegetables? salad!
422 gen_.GenerateSinglePanel("Panel_anagram_6_1", kMiddle, kYellow, {.exact_len = 6});
423 gen_.GenerateSinglePanel("Panel_anagram_6_2", kMiddle, kYellow, {.exact_len = 6});
424 gen_.GenerateSinglePanel("Panel_anagram_7_1", kMiddle, kYellow, {.exact_len = 7});
425 gen_.GenerateSinglePanel("Panel_anagram_7_2", kMiddle, kYellow, {.exact_len = 7});
426 gen_.GenerateSinglePanel("Panel_anagram_7_3", kMiddle, kYellow, {.exact_len = 7});
427 gen_.GenerateSinglePanel("Panel_anagram_7_4", kMiddle, kYellow, {.exact_len = 7});
428 gen_.GenerateSinglePanel("Panel_anagram_8_1", kMiddle, kYellow, {.exact_len = 8});
429 gen_.GenerateSinglePanel("Panel_anagram_8_2", kMiddle, kYellow, {.exact_len = 8});
430 gen_.GenerateSinglePanel("Panel_anagram_8_3", kMiddle, kYellow, {.exact_len = 8});
431 gen_.GenerateSinglePanel("Panel_anagram_9_1", kMiddle, kYellow, {.exact_len = 9});
432
433 // The Red
434 gen_.GenerateSinglePanel("Panel_red_top_1", kTop, kRed);
435 gen_.GenerateSinglePanel("Panel_red_top_2", kTop, kRed);
436 gen_.GenerateSinglePanel("Panel_red_top_3", kTop, kRed);
437 gen_.GenerateSinglePanel("Panel_red_top_4", kTop, kRed);
438 //gen_.GeneratePanelStack("Panel_red_top_5", kRed, "Panel_red_mid_2", kRed, "", {}); // slow
439 gen_.GenerateSinglePanel("Panel_red_mid_1", kMiddle, kRed);
440 gen_.GenerateSinglePanel("Panel_red_mid_3", kMiddle, kRed);
441 gen_.GeneratePanelStack("", {}, "Panel_red_mid_4", kRed, "Panel_red_bot_4", kRed);
442 gen_.GeneratePanelStack("", {}, "Panel_red_mid_5", kRed, "Panel_red_bot_5", kRed);
443 gen_.GenerateSinglePanel("Panel_red_bot_1", kBottom, kRed, {.max_answer_len = 7});
444 gen_.GenerateSinglePanel("Panel_red_bot_2", kBottom, kRed, {.max_answer_len = 7});
445 gen_.GenerateSinglePanel("Panel_red_bot_3", kBottom, kRed, {.max_answer_len = 7});
446 gen_.GenerateSinglePanel("Panel_red_bot_6", kBottom, kRed, {.max_answer_len = 7});
447
448 // The Artistic
449 gen_.GeneratePanelStack("Panel_blue_top_1", kBlue, "", {}, "Panel_red_bot_1", kRed);
450 gen_.GeneratePanelStack("", {}, "Panel_red_mid_2", kRed, "Panel_blue_bot_2", kBlue);
451 gen_.GeneratePanelStack("", {}, "Panel_blue_mid_3", kBlue, "Panel_red_bot_3", kRed);
452 gen_.GeneratePanelStack("Panel_red_top_4", kRed, "Panel_blue_mid_4", kBlue, "", {});
453 gen_.GeneratePanelStack("Panel_yellow_top_5", kYellow, "", {}, "Panel_blue_bot_5", kBlue);
454 gen_.GeneratePanelStack("Panel_blue_top_6", kBlue, "Panel_yellow_mid_6", kYellow, "", {});
455 // gen_.GeneratePanelStack("", {}, "Panel_blue_mid_7", kBlue, "Panel_yellow_bot_7", kYellow);
456 gen_.GeneratePanelStack("", {}, "Panel_yellow_mid_8", kYellow, "Panel_black_bot_8", kBlack);
457 // gen_.GeneratePanelStack("Panel_black_top_9", kBlack, "", {}, "Panel_yellow_bot_9", kYellow);
458 //gen_.GeneratePanelStack("Panel_yellow_top_10", kYellow, "", {}, "Panel_black_bot_10", kBlack); // slow
459 gen_.GeneratePanelStack("Panel_black_top_11", kBlack, "Panel_yellow_mid_11", kYellow, "", {});
460 gen_.GeneratePanelStack("Panel_black_top_12", kBlack, "", {}, "Panel_red_bot_12", kRed);
461 //gen_.GeneratePanelStack("Panel_red_top_13", kRed, "", {}, "Panel_black_bot_13", kBlack); // slow
462 gen_.GeneratePanelStack("", {}, "Panel_black_mid_14", kBlack, "Panel_red_bot_14", kRed);
463 gen_.GeneratePanelStack("Panel_black_top_15", kBlack, "Panel_red_mid_15", kRed, "", {});
464 gen_.GenerateSinglePanel("Panel_answer_1", kBottom, kRed);
465 gen_.GenerateSinglePanel("Panel_answer_2", kTop, kBlack);
466 gen_.GenerateSinglePanel("Panel_answer_3", kMiddle, kBlue, {.max_answer_len = 4});
467 gen_.GenerateSinglePanel("Panel_answer_4", kTop, kYellow);
468 gen_.GenerateOneRoadManyTurns("Panel_artistic_artistic", "Panel_answer_1", "Panel_answer_2", "Panel_answer_3", "Panel_answer_4");
469
470
471
472
473
474
475
476
477
478
479
480
481 // Pilgrim Room
482 // gen_.GenerateSinglePanel("Panel_pilgrim", kMiddle, kBlue, {.reuse_solution = true});
483 gen_.GenerateSinglePanel("Panel_shortcut", kMiddle, kYellow, {.multiword = true, .max_answer_len = 20});
484 gen_.GenerateComboPanel("Panel_lingo_12", kMiddle, kPurple, kMiddle, kRed);
485 gen_.GenerateSinglePanel("Panel_lingo_1", kMiddle, kPurple, {.reuse_solution = true});
486 gen_.GenerateSinglePanel("Panel_lingo_8", kMiddle, kBlack);
487 // Panel_lingo_7: 906234? strand room!
488 // Panel_lingo_13: floss paths? crossroads!
489 gen_.GenerateComboPanel("Panel_lingo_4", kBottom, kWhite, kMiddle, kPurple);
490 gen_.GenerateComboPanel("Panel_lingo_6", kBottom, kBlack, kBottom, kWhite);
491 gen_.GenerateSinglePanel("Panel_lingo_3", kBottom, kWhite);
492 gen_.GenerateComboPanel("Panel_lingo_10", kBottom, kBlack, kMiddle, kRed);
493 gen_.GenerateSinglePanel("Panel_lingo_2", kBottom, kWhite);
494 gen_.GenerateSinglePanel("Panel_lingo_5", kMiddle, kYellow, {.multiword = true, .max_answer_len = 20});
495 gen_.GenerateSinglePanel("Panel_lingo_11", kMiddle, kYellow, {.multiword = true, .max_answer_len = 20});
496 // Panel_lingo_9: this? pilgrim room!
497
498 std::ifstream level1("../level1.tscn");
499 std::ofstream output("newlevel.tscn");
500 std::string line;
501 std::string name;
502 std::string question;
503 std::string answer;
504 while (std::getline(level1, line)) {
505 if (line.substr(0, 18) == "[node name=\"Panel_") {
506 std::string stripstart = line.substr(12);
507 name = stripstart.substr(0, stripstart.find("\""));
508
509 if (gen_.IsPanelRandomized(name)) {
510 std::tie(question, answer) = gen_.GetPanel(name);
511 } else {
512 name = "";
513 }
514 }
515
516 if (line.empty()) {
517 name = "";
518 }
519
520 if (!name.empty() && line.substr(0, 7) == "text = ") {
521 std::string stripstart = line.substr(8);
522 output << "text = \"" << question << "\"" << std::endl;
523 //question = stripstart.substr(0, stripstart.find("\""));
524 } else if (!name.empty() && line.substr(0, 9) == "answer = ") {
525 std::string stripstart = line.substr(10);
526 //std::string answer = stripstart.substr(0, stripstart.find("\""));
527
528 //std::cout << name << ": " << question << "? " << answer << "!" << std::endl;
529 output << "answer = \"" << answer << "\"" << std::endl;
530 } else {
531 output << line << "\n";
532 }
533 }
534 }
535
536private:
537
538 unsigned int seed_;
539 Generator gen_;
540};
541
542int main(int argc, char** argv) {
543 std::random_device randomDevice;
544 unsigned int seed = randomDevice() % 1000000;
545
546 Randomizer randomizer(seed);
547 randomizer.Run();
548
549 return 0;
550}
diff --git a/vendor/verbly b/vendor/verbly new file mode 160000
Subproject e5d8d42eae6ce486678d87e33c1a7c26e2a6c1a