From da6dcacf4314463e33c29a0a2831fb3bf80f4d4c Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Tue, 26 Nov 2019 10:06:47 -0800 Subject: WIP on end of glass factory --- Source/Randomizer2.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++++-- Source/Randomizer2Core.cpp | 20 ++++++++++++++--- 2 files changed, 71 insertions(+), 5 deletions(-) diff --git a/Source/Randomizer2.cpp b/Source/Randomizer2.cpp index 4968666..b1cdc1f 100644 --- a/Source/Randomizer2.cpp +++ b/Source/Randomizer2.cpp @@ -270,14 +270,66 @@ void Randomizer2::RandomizeSymmetry() { p.grid[1][6].gap = Cell::Gap::BREAK; for (Pos pos : Randomizer2Core::CutSymmetricalEdgePairs(p, 1)) { - std::string text = std::to_string(pos.x) + " " + std::to_string(pos.y); - OutputDebugStringA(text.c_str()); p.grid[pos.x][pos.y].gap = Cell::Gap::BREAK; Pos sym = p.GetSymmetricalPos(pos.x, pos.y); p.grid[sym.x][sym.y].gap = Cell::Gap::BREAK; } _serializer.WritePuzzle(p, 0x8D); } + { // Rotational 2 + Puzzle p; + p.NewGrid(3, 3); + p.symmetry = Puzzle::Symmetry::XY; + p.grid[6][0].start = true; + p.grid[0][6].start = true; + p.grid[4][0].end = Cell::Dir::UP; + p.grid[2][6].end = Cell::Dir::DOWN; + + p.grid[5][0].gap = Cell::Gap::BREAK; + p.grid[1][6].gap = Cell::Gap::BREAK; + + std::vector cutEdges = Randomizer2Core::CutSymmetricalEdgePairs(p, 3); + for (int i=0; i cutEdges = Randomizer2Core::CutSymmetricalEdgePairs(p, 3); + for (int i=0; i Randomizer2Core::CutSymmetricalEdgePairs(const Puzzle& p, size_ for (int y=0; y Randomizer2Core::CutEdgesInternal(const Puzzle& p, int xMin, int xMax, int yMin, int yMax, size_t numEdges) { @@ -36,6 +49,7 @@ std::vector Randomizer2Core::CutEdgesInternal(const Puzzle& p, int xMin, in if (p.grid[x][y].gap != Cell::Gap::NONE) continue; if (p.grid[x][y].start) continue; if (p.grid[x][y].end != Cell::Dir::NONE) continue; + if (p.symmetry == Puzzle::Symmetry::XY && x > y) continue; // Only allow cuts bottom-left of the diagonal // If the puzzle already has a sequence, don't cut along it. bool inSequence = false; @@ -51,7 +65,7 @@ std::vector Randomizer2Core::CutEdgesInternal(const Puzzle& p, int xMin, in std::vector cutEdges; for (int i=0; i 0) { int edge = Random::RandInt(0, static_cast(edges.size() - 1)); Pos pos = edges[edge]; edges.erase(edges.begin() + edge); -- cgit 1.4.1