From 9a6abe3ca3fafa1eaedadbb3ac2be65d299d3ca5 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 4 Nov 2023 10:20:46 -0400 Subject: added secret symmetry puzzles --- ext/wittle_generator/wittle_generator.cpp | 74 ++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) (limited to 'ext/wittle_generator') diff --git a/ext/wittle_generator/wittle_generator.cpp b/ext/wittle_generator/wittle_generator.cpp index 0e86b27..7951d15 100644 --- a/ext/wittle_generator/wittle_generator.cpp +++ b/ext/wittle_generator/wittle_generator.cpp @@ -4,6 +4,20 @@ #include "Generate.h" #include "Random.h" +void MakeSecretSymmetryGrid(Generate& generator) { + for (int x : {0, 6, 8, 14}) { + for (int y : {0, 6, 8, 14}) { + generator.setSymbol(Decoration::Start, x, y); + } + } + for (int x : {0, 14}) { + for (int y : {2, 4, 10, 12}) { + generator.setSymbol(Decoration::Exit, x, y); + generator.setSymbol(Decoration::Exit, y, x); + } + } +} + Rice::Object wittle_generator_generate_easy(Rice::Object /* self */) { Generate generator; @@ -1051,7 +1065,7 @@ Rice::Object wittle_generator_generate_medium(Rice::Object /* self */) { Rice::Object wittle_generator_generate_expert(Rice::Object /* self */) { Generate generator; - int choice = Random::rand() % 46; + int choice = Random::rand() % 50; std::cout << "Generate EXPERT: choice " << std::dec << choice << std::endl; switch (choice) { @@ -1608,6 +1622,64 @@ Rice::Object wittle_generator_generate_expert(Rice::Object /* self */) { {Decoration::Stone | Decoration::Color::Yellow, 3}}}); break; } + case 46: { + generator.setGridSize(7, 7); + generator.setSymmetry((Random::rand() % 2) == 0 + ? Panel::Symmetry::Vertical + : Panel::Symmetry::Horizontal); + generator.setFlag(Generate::WriteInvisible); + generator.setFlag(Generate::DisableDotIntersection); + MakeSecretSymmetryGrid(generator); + generator.generate( + 7, 7, + {{{Decoration::Dot | Decoration::Color::Cyan, 2}, + {Decoration::Dot | Decoration::Color::Yellow, 2}, + {Decoration::Triangle | Decoration::Color::Orange, 4}}}); + break; + } + case 47: { + generator.setGridSize(7, 7); + generator.setSymmetry((Random::rand() % 2) == 0 + ? Panel::Symmetry::ParallelH + : Panel::Symmetry::ParallelV); + generator.setFlag(Generate::WriteInvisible); + generator.setFlag(Generate::DisableDotIntersection); + MakeSecretSymmetryGrid(generator); + generator.generate( + 7, 7, + {{{Decoration::Dot | Decoration::Color::Cyan, 2}, + {Decoration::Dot | Decoration::Color::Yellow, 2}, + {Decoration::Triangle | Decoration::Color::Orange, 4}}}); + break; + } + case 48: { + generator.setGridSize(7, 7); + generator.setSymmetry(Panel::Symmetry::Rotational); + generator.setFlag(Generate::WriteInvisible); + generator.setFlag(Generate::DisableDotIntersection); + MakeSecretSymmetryGrid(generator); + generator.generate( + 7, 7, + {{{Decoration::Dot | Decoration::Color::Cyan, 2}, + {Decoration::Dot | Decoration::Color::Yellow, 2}, + {Decoration::Triangle | Decoration::Color::Orange, 4}}}); + break; + } + case 49: { + generator.setGridSize(7, 7); + generator.setSymmetry((Random::rand() % 2) == 0 + ? Panel::Symmetry::ParallelHFlip + : Panel::Symmetry::ParallelVFlip); + generator.setFlag(Generate::WriteInvisible); + generator.setFlag(Generate::DisableDotIntersection); + MakeSecretSymmetryGrid(generator); + generator.generate( + 7, 7, + {{{Decoration::Dot | Decoration::Color::Cyan, 2}, + {Decoration::Dot | Decoration::Color::Yellow, 2}, + {Decoration::Triangle | Decoration::Color::Orange, 4}}}); + break; + } } Rice::String str(generator.AsCode()); -- cgit 1.4.1