diff options
Diffstat (limited to 'Source/Solver.cpp')
-rw-r--r-- | Source/Solver.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Source/Solver.cpp b/Source/Solver.cpp index 2813027..74fa099 100644 --- a/Source/Solver.cpp +++ b/Source/Solver.cpp | |||
@@ -21,7 +21,7 @@ std::vector<Puzzle> Solver::Solve(Puzzle& p) { | |||
21 | } | 21 | } |
22 | 22 | ||
23 | void Solver::SolveLoop(Puzzle& p, int x, int y, std::vector<Puzzle>& solutions) { | 23 | void Solver::SolveLoop(Puzzle& p, int x, int y, std::vector<Puzzle>& solutions) { |
24 | // Stop trying to solve once we reach our goal | 24 | // Stop trying to solve once we reach our goal |
25 | if (solutions.size() >= MAX_SOLUTIONS) return; | 25 | if (solutions.size() >= MAX_SOLUTIONS) return; |
26 | Cell cell = p.GetCell(x, y); | 26 | Cell cell = p.GetCell(x, y); |
27 | if (cell.undefined) return; | 27 | if (cell.undefined) return; |
@@ -30,7 +30,6 @@ void Solver::SolveLoop(Puzzle& p, int x, int y, std::vector<Puzzle>& solutions) | |||
30 | if (p.symmetry == Puzzle::Symmetry::NONE) { | 30 | if (p.symmetry == Puzzle::Symmetry::NONE) { |
31 | if (cell.color != Cell::Color::NONE) return; // Collided with ourselves | 31 | if (cell.color != Cell::Color::NONE) return; // Collided with ourselves |
32 | p.grid[x][y].color = Cell::Color::BLACK; // Otherwise, mark this cell as visited | 32 | p.grid[x][y].color = Cell::Color::BLACK; // Otherwise, mark this cell as visited |
33 | p.sequence.emplace_back(x, y); | ||
34 | } else { | 33 | } else { |
35 | // Get the symmetrical position, and try coloring it | 34 | // Get the symmetrical position, and try coloring it |
36 | auto sym = p.GetSymmetricalPos(x, y); | 35 | auto sym = p.GetSymmetricalPos(x, y); |
@@ -44,6 +43,7 @@ void Solver::SolveLoop(Puzzle& p, int x, int y, std::vector<Puzzle>& solutions) | |||
44 | } | 43 | } |
45 | p.grid[x][y].color = Cell::Color::BLUE; // Otherwise, mark this cell as visited | 44 | p.grid[x][y].color = Cell::Color::BLUE; // Otherwise, mark this cell as visited |
46 | } | 45 | } |
46 | p.sequence.emplace_back(x, y); | ||
47 | 47 | ||
48 | if (cell.end != Cell::Dir::NONE) { | 48 | if (cell.end != Cell::Dir::NONE) { |
49 | // Reached an endpoint, validate solution and keep going -- there may be other endpoints | 49 | // Reached an endpoint, validate solution and keep going -- there may be other endpoints |