about summary refs log tree commit diff stats
path: root/Source/Randomizer2.cpp
diff options
context:
space:
mode:
authorjbzdarkid <jbzdarkid@gmail.com>2019-11-24 13:56:33 -0800
committerjbzdarkid <jbzdarkid@gmail.com>2019-11-24 13:56:33 -0800
commit88ad92c9382a68532503a351b053de024d116774 (patch)
tree84c415d59c1ddc5b8be7751ef33f1bbdb0c11203 /Source/Randomizer2.cpp
parent3c408f7535fb10118cc8ff219629b6fac0ceabde (diff)
downloadwitness-tutorializer-88ad92c9382a68532503a351b053de024d116774.tar.gz
witness-tutorializer-88ad92c9382a68532503a351b053de024d116774.tar.bz2
witness-tutorializer-88ad92c9382a68532503a351b053de024d116774.zip
next puzzle
Diffstat (limited to 'Source/Randomizer2.cpp')
-rw-r--r--Source/Randomizer2.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/Source/Randomizer2.cpp b/Source/Randomizer2.cpp index 993e7cc..107950d 100644 --- a/Source/Randomizer2.cpp +++ b/Source/Randomizer2.cpp
@@ -175,20 +175,39 @@ void Randomizer2::RandomizeSymmetry() {
175 p.grid[2][0].end = Cell::Dir::UP; 175 p.grid[2][0].end = Cell::Dir::UP;
176 p.grid[6][0].end = Cell::Dir::UP; 176 p.grid[6][0].end = Cell::Dir::UP;
177 std::vector<Pos> cutEdges = Randomizer2Core::CutSymmetricalEdgePairs(p, 4); 177 std::vector<Pos> cutEdges = Randomizer2Core::CutSymmetricalEdgePairs(p, 4);
178 bool alternate = false;
179 for (int i=0; i<cutEdges.size(); i++) { 178 for (int i=0; i<cutEdges.size(); i++) {
180 Pos pos = cutEdges[i]; 179 Pos pos = cutEdges[i];
181 if (alternate) { 180 if (i%2 == 0) {
182 p.grid[pos.x][pos.y].gap = Cell::Gap::BREAK; 181 p.grid[pos.x][pos.y].gap = Cell::Gap::BREAK;
183 } else { 182 } else {
184 Pos sym = p.GetSymmetricalPos(pos.x, pos.y); 183 Pos sym = p.GetSymmetricalPos(pos.x, pos.y);
185 p.grid[sym.x][sym.y].gap = Cell::Gap::BREAK; 184 p.grid[sym.x][sym.y].gap = Cell::Gap::BREAK;
186 } 185 }
187 alternate = !alternate;
188 } 186 }
189 187
190 _serializer.WritePuzzle(p, 0x87); 188 _serializer.WritePuzzle(p, 0x87);
191 } 189 }
190 { // Back wall 3
191 Puzzle p;
192 p.NewGrid(5, 6);
193 p.symmetry = Puzzle::Symmetry::X;
194 p.grid[2][10].start = true;
195 p.grid[8][10].start = true;
196 p.grid[4][0].end = Cell::Dir::UP;
197 p.grid[6][0].end = Cell::Dir::UP;
198 std::vector<Pos> cutEdges = Randomizer2Core::CutSymmetricalEdgePairs(p, 10);
199 for (int i=0; i<cutEdges.size(); i++) {
200 Pos pos = cutEdges[i];
201 if (i%2 == 0) {
202 p.grid[pos.x][pos.y].gap = Cell::Gap::BREAK;
203 } else {
204 Pos sym = p.GetSymmetricalPos(pos.x, pos.y);
205 p.grid[sym.x][sym.y].gap = Cell::Gap::BREAK;
206 }
207 }
208
209 _serializer.WritePuzzle(p, 0x59);
210 }
192} 211}
193 212
194void Randomizer2::RandomizeKeep() { 213void Randomizer2::RandomizeKeep() {