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.cpp56
1 files changed, 54 insertions, 2 deletions
diff --git a/Source/Randomizer2.cpp b/Source/Randomizer2.cpp index 4968666..b1cdc1f 100644 --- a/Source/Randomizer2.cpp +++ b/Source/Randomizer2.cpp
@@ -270,14 +270,66 @@ void Randomizer2::RandomizeSymmetry() {
270 p.grid[1][6].gap = Cell::Gap::BREAK; 270 p.grid[1][6].gap = Cell::Gap::BREAK;
271 271
272 for (Pos pos : Randomizer2Core::CutSymmetricalEdgePairs(p, 1)) { 272 for (Pos pos : Randomizer2Core::CutSymmetricalEdgePairs(p, 1)) {
273 std::string text = std::to_string(pos.x) + " " + std::to_string(pos.y);
274 OutputDebugStringA(text.c_str());
275 p.grid[pos.x][pos.y].gap = Cell::Gap::BREAK; 273 p.grid[pos.x][pos.y].gap = Cell::Gap::BREAK;
276 Pos sym = p.GetSymmetricalPos(pos.x, pos.y); 274 Pos sym = p.GetSymmetricalPos(pos.x, pos.y);
277 p.grid[sym.x][sym.y].gap = Cell::Gap::BREAK; 275 p.grid[sym.x][sym.y].gap = Cell::Gap::BREAK;
278 } 276 }
279 _serializer.WritePuzzle(p, 0x8D); 277 _serializer.WritePuzzle(p, 0x8D);
280 } 278 }
279 { // Rotational 2
280 Puzzle p;
281 p.NewGrid(3, 3);
282 p.symmetry = Puzzle::Symmetry::XY;
283 p.grid[6][0].start = true;
284 p.grid[0][6].start = true;
285 p.grid[4][0].end = Cell::Dir::UP;
286 p.grid[2][6].end = Cell::Dir::DOWN;
287
288 p.grid[5][0].gap = Cell::Gap::BREAK;
289 p.grid[1][6].gap = Cell::Gap::BREAK;
290
291 std::vector<Pos> cutEdges = Randomizer2Core::CutSymmetricalEdgePairs(p, 3);
292 for (int i=0; i<cutEdges.size(); i++) {
293 Pos pos = cutEdges[i];
294 if (i%2 == 0) {
295 p.grid[pos.x][pos.y].gap = Cell::Gap::BREAK;
296 } else {
297 Pos sym = p.GetSymmetricalPos(pos.x, pos.y);
298 p.grid[sym.x][sym.y].gap = Cell::Gap::BREAK;
299 }
300 }
301
302 p.grid[1][6].gap = Cell::Gap::NONE;
303
304 _serializer.WritePuzzle(p, 0x81);
305 }
306 { // Rotational 3
307 Puzzle p;
308 p.NewGrid(4, 4);
309 p.symmetry = Puzzle::Symmetry::XY;
310 p.grid[6][0].start = true;
311 p.grid[0][6].start = true;
312 p.grid[4][0].end = Cell::Dir::UP;
313 p.grid[2][6].end = Cell::Dir::DOWN;
314
315 p.grid[5][0].gap = Cell::Gap::BREAK;
316 p.grid[1][6].gap = Cell::Gap::BREAK;
317
318 std::vector<Pos> cutEdges = Randomizer2Core::CutSymmetricalEdgePairs(p, 3);
319 for (int i=0; i<cutEdges.size(); i++) {
320 Pos pos = cutEdges[i];
321 if (i%2 == 0) {
322 p.grid[pos.x][pos.y].gap = Cell::Gap::BREAK;
323 } else {
324 Pos sym = p.GetSymmetricalPos(pos.x, pos.y);
325 p.grid[sym.x][sym.y].gap = Cell::Gap::BREAK;
326 }
327 }
328
329 p.grid[1][6].gap = Cell::Gap::NONE;
330
331 _serializer.WritePuzzle(p, 0x81);
332 }
281} 333}
282 334
283void Randomizer2::RandomizeKeep() { 335void Randomizer2::RandomizeKeep() {