From 50992a6ab44321fe925c2becaa856a31696076ea Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Mon, 25 Nov 2019 18:02:59 -0800 Subject: Simplified / added two more --- Source/PuzzleSerializer.cpp | 3 +++ Source/Randomizer2.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++++ Source/Randomizer2Core.cpp | 14 +++----------- 3 files changed, 53 insertions(+), 11 deletions(-) (limited to 'Source') diff --git a/Source/PuzzleSerializer.cpp b/Source/PuzzleSerializer.cpp index da7a336..8165fe8 100644 --- a/Source/PuzzleSerializer.cpp +++ b/Source/PuzzleSerializer.cpp @@ -157,17 +157,20 @@ void PuzzleSerializer::ReadExtras(Puzzle& p) { // Note that Y coordinates are reversed: 0.0 (bottom) 1.0 (top) else if (y1 < y2) p.grid[x][y].end = Cell::Dir::DOWN; else if (y1 > y2) p.grid[x][y].end = Cell::Dir::UP; + else assert(false); } else if (_intersectionFlags[i] & Flags::HAS_DOT) { if (x1 < x2) x--; else if (x1 > x2) x++; else if (y1 < y2) y++; else if (y1 > y2) y--; + else assert(false); p.grid[x][y].dot = FlagsToDot(_intersectionFlags[i]); } else if (_intersectionFlags[i] & Flags::HAS_ONE_CONN) { if (x1 < x2) x--; else if (x1 > x2) x++; else if (y1 < y2) y++; else if (y1 > y2) y--; + else assert(false); p.grid[x][y].gap = Cell::Gap::BREAK; gapLocations[i] = Pos{x, y}; } diff --git a/Source/Randomizer2.cpp b/Source/Randomizer2.cpp index 107950d..d2046bb 100644 --- a/Source/Randomizer2.cpp +++ b/Source/Randomizer2.cpp @@ -208,6 +208,53 @@ void Randomizer2::RandomizeSymmetry() { _serializer.WritePuzzle(p, 0x59); } + { // Back wall 4 + Puzzle p; + p.NewGrid(5, 8); + p.symmetry = Puzzle::Symmetry::X; + p.grid[2][16].start = true; + p.grid[8][16].start = true; + p.grid[4][0].end = Cell::Dir::UP; + p.grid[6][0].end = Cell::Dir::UP; + std::vector cutEdges = Randomizer2Core::CutSymmetricalEdgePairs(p, 15); + for (int i=0; i Randomizer2Core::CutSymmetricalEdgePairs(const Puzzle& p, size_ Puzzle copy = p; assert(p.symmetry != Puzzle::Symmetry::NONE); if (p.symmetry == Puzzle::Symmetry::X) { - if (p.width%4 == 1) { - // The puzle has an even width (e.g. 4x4), so it has a midline for symmetry. - // Since this midline is unusable, we cut it pre-emptively. - for (int y=0; y