summary refs log tree commit diff stats
path: root/generator
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-12-12 14:48:42 -0500
committerStar Rauchenberger <fefferburbia@gmail.com>2023-12-12 14:48:42 -0500
commit1e34d9d675a50f1ccc1a43d3c2fed94ba3e5351b (patch)
tree71be5a368ff26a859dfa2a84076b76aba2a14497 /generator
parentfa2a7d48ae0f357e5b87619d0727868e54c34258 (diff)
downloadlingo-randomizer-1e34d9d675a50f1ccc1a43d3c2fed94ba3e5351b.tar.gz
lingo-randomizer-1e34d9d675a50f1ccc1a43d3c2fed94ba3e5351b.tar.bz2
lingo-randomizer-1e34d9d675a50f1ccc1a43d3c2fed94ba3e5351b.zip
Removed some trivial puzzles
Diffstat (limited to 'generator')
-rw-r--r--generator/CMakeLists.txt2
-rw-r--r--generator/generator.cpp13
2 files changed, 14 insertions, 1 deletions
diff --git a/generator/CMakeLists.txt b/generator/CMakeLists.txt index 3b66720..fb5dc3c 100644 --- a/generator/CMakeLists.txt +++ b/generator/CMakeLists.txt
@@ -3,7 +3,7 @@ project (generator)
3 3
4add_subdirectory(vendor/fmt) 4add_subdirectory(vendor/fmt)
5 5
6include_directories(../vendor/hkutil vendor/fmt/include) 6include_directories(vendor/hkutil vendor/fmt/include)
7 7
8add_executable(generator generator.cpp main.cpp) 8add_executable(generator generator.cpp main.cpp)
9set_property(TARGET generator PROPERTY CXX_STANDARD 17) 9set_property(TARGET generator PROPERTY CXX_STANDARD 17)
diff --git a/generator/generator.cpp b/generator/generator.cpp index 49018c8..0639492 100644 --- a/generator/generator.cpp +++ b/generator/generator.cpp
@@ -374,6 +374,10 @@ void generator::run() {
374 for (size_t f_id2 : all_forms) { 374 for (size_t f_id2 : all_forms) {
375 if (f_id1 != f_id2) { 375 if (f_id1 != f_id2) {
376 Form& form = forms_.at(f_id1); 376 Form& form = forms_.at(f_id1);
377 Form& form2 = forms_.at(f_id2);
378 if (form.anagram_set_id == form2.anagram_set_id) {
379 continue;
380 }
377 form.puzzles[kYellowTop].insert(f_id2); 381 form.puzzles[kYellowTop].insert(f_id2);
378 } 382 }
379 } 383 }
@@ -427,6 +431,9 @@ void generator::run() {
427 for (size_t f_id1 : pronunciation.form_ids) { 431 for (size_t f_id1 : pronunciation.form_ids) {
428 for (size_t f_id2 : all_forms) { 432 for (size_t f_id2 : all_forms) {
429 Form& form = forms_.at(f_id1); 433 Form& form = forms_.at(f_id1);
434 if (form.reverse_form_id == f_id2) {
435 continue;
436 }
430 form.puzzles[kBlackTop].insert(f_id2); 437 form.puzzles[kBlackTop].insert(f_id2);
431 } 438 }
432 } 439 }
@@ -573,6 +580,12 @@ void generator::run() {
573 for (size_t mero_form_id : merophone.form_ids) { 580 for (size_t mero_form_id : merophone.form_ids) {
574 Form& mero_form = forms_.at(mero_form_id); 581 Form& mero_form = forms_.at(mero_form_id);
575 582
583 if (holo_form.text.find(mero_form.text) !=
584 std::string::npos) {
585 // We don't want top puzzles that are also middle puzzles.
586 continue;
587 }
588
576 bool word_overlap = false; 589 bool word_overlap = false;
577 for (size_t holo_word_id : holo_form.word_ids) { 590 for (size_t holo_word_id : holo_form.word_ids) {
578 for (size_t mero_word_id : mero_form.word_ids) { 591 for (size_t mero_word_id : mero_form.word_ids) {