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