From 489583486bd9d31de5bec8751d7e63997c325fd3 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 30 Oct 2023 00:18:04 -0400 Subject: added archive page and some expert puzzles --- ext/wittle_generator/wittle_generator.cpp | 132 +++++++++++++++++++++++++++++- 1 file changed, 129 insertions(+), 3 deletions(-) (limited to 'ext') diff --git a/ext/wittle_generator/wittle_generator.cpp b/ext/wittle_generator/wittle_generator.cpp index e1b5323..f3d2947 100644 --- a/ext/wittle_generator/wittle_generator.cpp +++ b/ext/wittle_generator/wittle_generator.cpp @@ -392,7 +392,6 @@ Rice::Object wittle_generator_generate_easy(Rice::Object /* self */) { {{{Decoration::Star | Decoration::Color::Magenta, 6}, {Decoration::Stone | Decoration::Color::Orange, 4}, {Decoration::Stone | Decoration::Color::Green, 4}}}); - generator.place_gaps(8); break; } } @@ -404,7 +403,7 @@ Rice::Object wittle_generator_generate_easy(Rice::Object /* self */) { Rice::Object wittle_generator_generate_medium(Rice::Object /* self */) { Generate generator; - int choice = Random::rand() % 30; + int choice = Random::rand() % 33; std::cout << "Generate MEDIUM: choice " << std::dec << choice << std::endl; switch (choice) { @@ -679,6 +678,132 @@ Rice::Object wittle_generator_generate_medium(Rice::Object /* self */) { 4, 4, {{{Decoration::Triangle | Decoration::Color::Orange, 8}}}); break; } + case 30: { + generator.setFlag(Generate::RegularStartEnd); + generator.setFlag(Generate::LongestPath); + generator.setFlag(Generate::FullGaps); + generator.generate( + 6, 6, {{{Decoration::Dot_Intersection, 12}, {Decoration::Gap, 18}}}); + break; + } + case 31: { + generator.generate(5, 5, + {{{Decoration::Start, 8}, + {Decoration::Exit, 1}, + {Decoration::Dot_Intersection, 36}}}); + break; + } + case 32: { + generator.setFlag(Generate::RegularStartEnd); + generator.setSymmetry(Panel::Horizontal); + generator.generate( + 6, 6, + {{{Decoration::Triangle | Decoration::Color::Orange, 12}, + {Decoration::Start, 1}, + {Decoration::Exit, 1}}}); + break; + } + } + + Rice::String str(generator.AsCode()); + return str; +} + +Rice::Object wittle_generator_generate_expert(Rice::Object /* self */) { + Generate generator; + + int choice = Random::rand() % 8; + std::cout << "Generate EXPERT: choice " << std::dec << choice << std::endl; + + switch (choice) { + case 0: { + generator.setFlag(Generate::StartEdgeOnly); + generator.setSymmetry(Panel::Rotational); + generator.generate( + 6, 6, + {{{Decoration::Triangle | Decoration::Color::Orange, 12}, + {Decoration::Start, 1}, + {Decoration::Exit, 1}}}); + break; + } + case 1: { + generator.setFlag(Generate::StartEdgeOnly); + generator.setFlag(Generate::WriteInvisible); + generator.setSymmetry(Panel::Rotational); + generator.generate(7, 7, + {{{Decoration::Dot | Decoration::Color::Blue, 4}, + {Decoration::Dot | Decoration::Color::Yellow, 4}, + {Decoration::Dot, 7}, + {Decoration::Start, 1}, + {Decoration::Exit, 1}}}); + break; + } + case 2: { + generator.setFlag(Generate::StartEdgeOnly); + generator.setFlag(Generate::WriteInvisible); + generator.setSymmetry(Panel::Rotational); + generator.generate(7, 7, + {{{Decoration::Stone | Decoration::Color::Black, 6}, + {Decoration::Stone | Decoration::Color::White, 6}, + {Decoration::Start, 1}, + {Decoration::Exit, 1}}}); + break; + } + case 3: { + generator.setFlag(Generate::StartEdgeOnly); + generator.setFlag(Generate::WriteInvisible); + generator.setSymmetry(Panel::Rotational); + generator.generate(7, 7, + {{{Decoration::Star | Decoration::Color::Orange, 6}, + {Decoration::Star | Decoration::Color::Green, 6}, + {Decoration::Start, 1}, + {Decoration::Exit, 1}}}); + break; + } + case 4: { + generator.setFlag(Generate::StartEdgeOnly); + generator.setFlag(Generate::WriteInvisible); + generator.setFlag(Generate::RequireCombineShapes); + generator.setSymmetry(Panel::Rotational); + generator.generate(5, 5, + {{{Decoration::Poly | Decoration::Color::Yellow, 3}, + {Decoration::Start, 1}, + {Decoration::Exit, 1}}}); + break; + } + case 5: { + generator.setFlag(Generate::StartEdgeOnly); + generator.setFlag(Generate::WriteInvisible); + generator.setSymmetry(Panel::Rotational); + generator.generate(7, 7, + {{{Decoration::Dot | Decoration::Color::Blue, 2}, + {Decoration::Dot | Decoration::Color::Yellow, 2}, + {Decoration::Dot, 8}, + {Decoration::Eraser | Decoration::Color::Purple, 1}, + {Decoration::Start, 1}}}); + break; + } + case 6: { + generator.setFlag(Generate::RegularStartEnd); + generator.generate( + 4, 4, + {{{Decoration::Triangle | Decoration::Color::Orange, 15}, + {Decoration::Eraser | Decoration::Color::Purple, 1}}}); + break; + } + case 7: { + generator.setFlag(Generate::RegularStartEnd); + generator.generate( + 4, 4, + {{{Decoration::Stone | Decoration::Color::White, 1}, + {Decoration::Stone | Decoration::Color::Black, 2}, + {Decoration::Stone | Decoration::Color::Red, 2}, + {Decoration::Star | Decoration::Color::White, 4}, + {Decoration::Star | Decoration::Color::Black, 3}, + {Decoration::Star | Decoration::Color::Red, 3}, + {Decoration::Decoration::Eraser | Decoration::Color::Green, 1}}}); + break; + } } Rice::String str(generator.AsCode()); @@ -689,5 +814,6 @@ extern "C" void Init_wittle_generator() { Rice::Class rb_cWittleGenerator = Rice::define_class("WittleGenerator") .define_method("generate_easy", &wittle_generator_generate_easy) - .define_method("generate_medium", &wittle_generator_generate_medium); + .define_method("generate_medium", &wittle_generator_generate_medium) + .define_method("generate_expert", &wittle_generator_generate_expert); } -- cgit 1.4.1