From 059e44fa16b649938d79597bcf8f41bf4aa136ab Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Fri, 22 Nov 2019 10:04:19 -0800 Subject: fix more asymmetrical gap bugs --- Source/Randomizer2Core.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'Source/Randomizer2Core.cpp') diff --git a/Source/Randomizer2Core.cpp b/Source/Randomizer2Core.cpp index dcb9fd2..8ef2301 100644 --- a/Source/Randomizer2Core.cpp +++ b/Source/Randomizer2Core.cpp @@ -15,9 +15,16 @@ std::vector Randomizer2Core::CutInsideEdges(const Puzzle& p, size_t numEdge } std::vector Randomizer2Core::CutSymmetricalEdgePairs(const Puzzle& p, size_t numEdges) { + Puzzle copy = p; assert(p.symmetry != Puzzle::Symmetry::NONE); if (p.symmetry == Puzzle::Symmetry::X) { - return CutEdgesInternal(p, 0, (p.width-1)/2, 0, p.height, numEdges); + if (p.width%4 == 1) { // Puzzle is even, so we need to prevent cutting the centerline + for (int y=0; y Randomizer2Core::CutEdgesInternal(const Puzzle& p, int xMin, in void Randomizer2Core::DebugColorGrid(const std::vector>& colorGrid) { #ifndef NDEBUG + static std::string colors = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; for (int y=0; y 1 (color of outside) or * (any colored cell) or -1 (edge/intersection not part of any region) - - 0 -> {} (this is a special edge case, which I don't need right now) - 1 -> 0 (uncolored / ready to color) - 2 -> -*/ +// Color key: +// 0 (default): Uncolored +// 1: Outside color and separator color +// 2+: Flood-filled region color std::tuple>, int> Randomizer2Core::CreateColorGrid(const Puzzle& p) { std::vector> colorGrid; colorGrid.resize(p.width); -- cgit 1.4.1