From 39644676e2716a285fcea6bb81e07f326bda2f68 Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Tue, 3 Dec 2019 10:04:16 -0800 Subject: Started work on symmetry island --- Source/Randomizer2.cpp | 59 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 4 deletions(-) (limited to 'Source/Randomizer2.cpp') diff --git a/Source/Randomizer2.cpp b/Source/Randomizer2.cpp index db90f4c..e1b1712 100644 --- a/Source/Randomizer2.cpp +++ b/Source/Randomizer2.cpp @@ -6,11 +6,13 @@ #include "Solver.h" #include "Windows.h" -Randomizer2::Randomizer2(const PuzzleSerializer& serializer) : _serializer(serializer) {} +Randomizer2::Randomizer2(const PuzzleSerializer& serializer) : _serializer(serializer) { +} void Randomizer2::Randomize() { - RandomizeTutorial(); - RandomizeSymmetry(); + // RandomizeTutorial(); + // RandomizeGlassFactory(); + RandomizeSymmetryIsland(); // RandomizeKeep(); } @@ -144,7 +146,7 @@ void Randomizer2::RandomizeTutorial() { } } -void Randomizer2::RandomizeSymmetry() { +void Randomizer2::RandomizeGlassFactory() { { // Back wall 1 Puzzle p; p.NewGrid(3, 3); @@ -359,6 +361,55 @@ void Randomizer2::RandomizeSymmetry() { } } +void Randomizer2::RandomizeSymmetryIsland() { + { // Entry door + Puzzle p; + p.NewGrid(4, 3); + p.grid[0][6].start = true; + p.grid[8][0].end = Cell::Dir::RIGHT; + p.grid[4][3].gap = Cell::Gap::FULL; + + std::vector corners; + std::vector cells; + std::vector edges; + for (int x=0; x dots; + for (int i=0; i<4; i++) { + int edge = Random::RandInt(0, static_cast(edgesCopy.size() - 1)); + dots.emplace_back(edgesCopy[edge]); + edgesCopy.erase(edgesCopy.begin() + edge); + } + + for (Pos pos : dots) { + p.grid[pos.x][pos.y].dot = Cell::Dot::BLACK; + } + + auto solutions = Solver::Solve(p); + if (solutions.size() > 0 && solutions.size() < 10) { + std::string text = std::to_string(solutions.size()) + "\n"; + OutputDebugStringA(text.c_str()); + break; + } + + for (Pos pos : dots) { + p.grid[pos.x][pos.y].dot = Cell::Dot::NONE; + } + } + + _serializer.WritePuzzle(p, 0xB0); + } +} + void Randomizer2::RandomizeKeep() { { // Hedges 1 Puzzle p; -- cgit 1.4.1