diff options
author | jbzdarkid <jbzdarkid@gmail.com> | 2019-11-19 09:42:45 -0800 |
---|---|---|
committer | jbzdarkid <jbzdarkid@gmail.com> | 2019-11-19 09:42:45 -0800 |
commit | 52b01775c2c94f08786696cae7836ca56f683739 (patch) | |
tree | d6d7d7604c8f5d793be28bcf21753b02d7d31bb7 /Source/Randomizer2Core.cpp | |
parent | 7a13ef0a94f6ed4989677530b1b37e1af0692fc7 (diff) | |
download | witness-tutorializer-52b01775c2c94f08786696cae7836ca56f683739.tar.gz witness-tutorializer-52b01775c2c94f08786696cae7836ca56f683739.tar.bz2 witness-tutorializer-52b01775c2c94f08786696cae7836ca56f683739.zip |
Fix RNG -- this will break seeds, though.
Diffstat (limited to 'Source/Randomizer2Core.cpp')
-rw-r--r-- | Source/Randomizer2Core.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Source/Randomizer2Core.cpp b/Source/Randomizer2Core.cpp index 0310ae2..c34fec6 100644 --- a/Source/Randomizer2Core.cpp +++ b/Source/Randomizer2Core.cpp | |||
@@ -77,15 +77,22 @@ std::vector<Pos> Randomizer2Core::CutEdgesInternal(const Puzzle& p, std::vector< | |||
77 | return cutEdges; | 77 | return cutEdges; |
78 | } | 78 | } |
79 | 79 | ||
80 | #ifndef NDEBUG | ||
81 | #include <Windows.h> | ||
82 | #endif | ||
83 | |||
80 | void Randomizer2Core::DebugColorGrid(const std::vector<std::vector<int>>& colorGrid) { | 84 | void Randomizer2Core::DebugColorGrid(const std::vector<std::vector<int>>& colorGrid) { |
85 | #ifndef NDEBUG | ||
81 | for (int y=0; y<colorGrid[0].size(); y++) { | 86 | for (int y=0; y<colorGrid[0].size(); y++) { |
82 | std::string row; | 87 | std::string row; |
83 | for (int x=0; x<colorGrid.size(); x++) { | 88 | for (int x=0; x<colorGrid.size(); x++) { |
84 | row += std::to_string(colorGrid[x][y]); | 89 | row += std::to_string(colorGrid[x][y]); |
85 | } | 90 | } |
86 | std::cerr << row << std::endl; | 91 | row += "\n"; |
92 | OutputDebugStringA(row.c_str()); | ||
87 | } | 93 | } |
88 | std::cerr << std::endl; | 94 | OutputDebugStringA("\n"); |
95 | #endif | ||
89 | } | 96 | } |
90 | 97 | ||
91 | void Randomizer2Core::FloodFill(const Puzzle& p, std::vector<std::vector<int>>& colorGrid, int color, int x, int y) { | 98 | void Randomizer2Core::FloodFill(const Puzzle& p, std::vector<std::vector<int>>& colorGrid, int color, int x, int y) { |
@@ -102,7 +109,7 @@ void Randomizer2Core::FloodFill(const Puzzle& p, std::vector<std::vector<int>>& | |||
102 | void Randomizer2Core::FloodFillOutside(const Puzzle& p, std::vector<std::vector<int>>& colorGrid, int x, int y) { | 109 | void Randomizer2Core::FloodFillOutside(const Puzzle& p, std::vector<std::vector<int>>& colorGrid, int x, int y) { |
103 | if (!p.SafeCell(x, y)) return; | 110 | if (!p.SafeCell(x, y)) return; |
104 | if (colorGrid[x][y] != 0) return; // Already processed. | 111 | if (colorGrid[x][y] != 0) return; // Already processed. |
105 | if (x%2 != y%2 && p.grid[x][y].gap != Cell::Gap::FULL) return; // Only flood-fill through full gaps | 112 | if (x%2 != y%2 && p.grid[x][y].gap == Cell::Gap::NONE) return; // Only flood-fill through gaps |
106 | colorGrid[x][y] = 1; // Outside color | 113 | colorGrid[x][y] = 1; // Outside color |
107 | 114 | ||
108 | FloodFillOutside(p, colorGrid, x, y+1); | 115 | FloodFillOutside(p, colorGrid, x, y+1); |