about summary refs log tree commit diff stats
path: root/Source/Randomizer2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Randomizer2.cpp')
-rw-r--r--Source/Randomizer2.cpp47
1 files changed, 37 insertions, 10 deletions
diff --git a/Source/Randomizer2.cpp b/Source/Randomizer2.cpp index b1cdc1f..db90f4c 100644 --- a/Source/Randomizer2.cpp +++ b/Source/Randomizer2.cpp
@@ -307,15 +307,12 @@ void Randomizer2::RandomizeSymmetry() {
307 Puzzle p; 307 Puzzle p;
308 p.NewGrid(4, 4); 308 p.NewGrid(4, 4);
309 p.symmetry = Puzzle::Symmetry::XY; 309 p.symmetry = Puzzle::Symmetry::XY;
310 p.grid[6][0].start = true; 310 p.grid[8][0].start = true;
311 p.grid[0][6].start = true; 311 p.grid[0][8].start = true;
312 p.grid[4][0].end = Cell::Dir::UP; 312 p.grid[0][0].end = Cell::Dir::LEFT;
313 p.grid[2][6].end = Cell::Dir::DOWN; 313 p.grid[8][8].end = Cell::Dir::RIGHT;
314
315 p.grid[5][0].gap = Cell::Gap::BREAK;
316 p.grid[1][6].gap = Cell::Gap::BREAK;
317 314
318 std::vector<Pos> cutEdges = Randomizer2Core::CutSymmetricalEdgePairs(p, 3); 315 std::vector<Pos> cutEdges = Randomizer2Core::CutSymmetricalEdgePairs(p, 7);
319 for (int i=0; i<cutEdges.size(); i++) { 316 for (int i=0; i<cutEdges.size(); i++) {
320 Pos pos = cutEdges[i]; 317 Pos pos = cutEdges[i];
321 if (i%2 == 0) { 318 if (i%2 == 0) {
@@ -326,9 +323,39 @@ void Randomizer2::RandomizeSymmetry() {
326 } 323 }
327 } 324 }
328 325
329 p.grid[1][6].gap = Cell::Gap::NONE; 326 _serializer.WritePuzzle(p, 0x83);
327 }
328 { // Melting
329 Puzzle p;
330 p.NewGrid(6, 6);
331 p.symmetry = Puzzle::Symmetry::XY;
332 p.grid[12][0].start = true;
333 p.grid[0][12].start = true;
334 p.grid[0][0].end = Cell::Dir::LEFT;
335 p.grid[12][12].end = Cell::Dir::RIGHT;
336 Puzzle q = p;
330 337
331 _serializer.WritePuzzle(p, 0x81); 338 std::vector<Pos> cutEdges = Randomizer2Core::CutSymmetricalEdgePairs(p, 15);
339 for (int i=0; i<cutEdges.size(); i++) {
340 Pos pos = cutEdges[i];
341 Pos sym = p.GetSymmetricalPos(pos.x, pos.y);
342
343 if (i%2 == 0) {
344 p.grid[pos.x][pos.y].gap = Cell::Gap::BREAK;
345 } else {
346 p.grid[sym.x][sym.y].gap = Cell::Gap::BREAK;
347 }
348
349 if (pos.x < sym.x) {
350 q.grid[pos.x][pos.y].gap = Cell::Gap::BREAK;
351 } else {
352 q.grid[sym.x][sym.y].gap = Cell::Gap::BREAK;
353 }
354 }
355
356 _serializer.WritePuzzle(p, 0x84); // Melting 1
357 _serializer.WritePuzzle(q, 0x82); // Melting 2
358 _serializer.WritePuzzle(q, 0x343A); // Melting 3
332 } 359 }
333} 360}
334 361