diff options
author | jbzdarkid <jbzdarkid@gmail.com> | 2019-11-25 21:10:50 -0800 |
---|---|---|
committer | jbzdarkid <jbzdarkid@gmail.com> | 2019-11-25 21:10:50 -0800 |
commit | ac83733b590f3c0750bea1de3556ceb24fa0a4b1 (patch) | |
tree | 74aa45ca76603f23c027478af4c2c5aa09eab11e /Source/Randomizer2Core.cpp | |
parent | e10243a64e0c6542c9b74c3bb95f5ebf4a3df7cb (diff) | |
download | witness-tutorializer-ac83733b590f3c0750bea1de3556ceb24fa0a4b1.tar.gz witness-tutorializer-ac83733b590f3c0750bea1de3556ceb24fa0a4b1.tar.bz2 witness-tutorializer-ac83733b590f3c0750bea1de3556ceb24fa0a4b1.zip |
Using PCH to clean up includes
Diffstat (limited to 'Source/Randomizer2Core.cpp')
-rw-r--r-- | Source/Randomizer2Core.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Source/Randomizer2Core.cpp b/Source/Randomizer2Core.cpp index eaefa9a..89294ef 100644 --- a/Source/Randomizer2Core.cpp +++ b/Source/Randomizer2Core.cpp | |||
@@ -1,11 +1,8 @@ | |||
1 | #include "pch.h" | ||
1 | #include "Randomizer2Core.h" | 2 | #include "Randomizer2Core.h" |
2 | #include "Puzzle.h" | 3 | #include "Puzzle.h" |
3 | #include "Random.h" | 4 | #include "Random.h" |
4 | 5 | ||
5 | #include <string> | ||
6 | #include <iostream> | ||
7 | #include <cassert> | ||
8 | |||
9 | std::vector<Pos> Randomizer2Core::CutEdges(const Puzzle& p, size_t numEdges) { | 6 | std::vector<Pos> Randomizer2Core::CutEdges(const Puzzle& p, size_t numEdges) { |
10 | return CutEdgesInternal(p, 0, p.width, 0, p.height, numEdges); | 7 | return CutEdgesInternal(p, 0, p.width, 0, p.height, numEdges); |
11 | } | 8 | } |
@@ -16,17 +13,20 @@ std::vector<Pos> Randomizer2Core::CutInsideEdges(const Puzzle& p, size_t numEdge | |||
16 | 13 | ||
17 | std::vector<Pos> Randomizer2Core::CutSymmetricalEdgePairs(const Puzzle& p, size_t numEdges) { | 14 | std::vector<Pos> Randomizer2Core::CutSymmetricalEdgePairs(const Puzzle& p, size_t numEdges) { |
18 | Puzzle copy = p; | 15 | Puzzle copy = p; |
19 | assert(p.symmetry != Puzzle::Symmetry::NONE); | 16 | // Prevent cuts from landing on the midline |
20 | if (p.symmetry == Puzzle::Symmetry::X) { | 17 | if (p.symmetry == Puzzle::Symmetry::X) { |
21 | // Prevent cuts from landing on the midline | ||
22 | for (int y=0; y<p.height; y++) { | 18 | for (int y=0; y<p.height; y++) { |
23 | copy.grid[p.width/2][y].gap = Cell::Gap::FULL; | 19 | copy.grid[p.width/2][y].gap = Cell::Gap::FULL; |
24 | } | 20 | } |
25 | 21 | } else if (p.symmetry == Puzzle::Symmetry::Y) { | |
26 | return CutEdgesInternal(copy, 0, (p.width-1)/2, 0, p.height, numEdges); | 22 | for (int x=0; x<p.width; x++) { |
23 | copy.grid[x][p.height/2].gap = Cell::Gap::FULL; | ||
24 | } | ||
25 | } else { | ||
26 | assert(p.symmetry == Puzzle::Symmetry::XY); | ||
27 | // Pass, I think? Maybe this matters for odd numbers. | ||
27 | } | 28 | } |
28 | assert(false); | 29 | return CutEdgesInternal(copy, 0, (p.width-1)/2, 0, p.height, numEdges); |
29 | return {}; | ||
30 | } | 30 | } |
31 | 31 | ||
32 | std::vector<Pos> Randomizer2Core::CutEdgesInternal(const Puzzle& p, int xMin, int xMax, int yMin, int yMax, size_t numEdges) { | 32 | std::vector<Pos> Randomizer2Core::CutEdgesInternal(const Puzzle& p, int xMin, int xMax, int yMin, int yMax, size_t numEdges) { |