summary refs log tree commit diff stats
path: root/Source/Solver.cpp
diff options
context:
space:
mode:
authorjbzdarkid <jbzdarkid@gmail.com>2019-11-16 10:27:06 -0800
committerjbzdarkid <jbzdarkid@gmail.com>2019-11-16 10:27:06 -0800
commit0baa521ba34d2cd4e0f732f83d23b807605786a2 (patch)
treedfb01163d291ee846c7a5840ffc08e089a7fb8e6 /Source/Solver.cpp
parent0d0abe2ee56382c5751dd12fbca75af87773879f (diff)
downloadwitness-tutorializer-0baa521ba34d2cd4e0f732f83d23b807605786a2.tar.gz
witness-tutorializer-0baa521ba34d2cd4e0f732f83d23b807605786a2.tar.bz2
witness-tutorializer-0baa521ba34d2cd4e0f732f83d23b807605786a2.zip
More and more progress.
Split out functions in serializer
Figured out how to allocate memory (for sequences)
Diffstat (limited to 'Source/Solver.cpp')
-rw-r--r--Source/Solver.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Source/Solver.cpp b/Source/Solver.cpp index bce1482..a8710a2 100644 --- a/Source/Solver.cpp +++ b/Source/Solver.cpp
@@ -30,6 +30,7 @@ void Solver::SolveLoop(Puzzle& p, int x, int y, std::vector<Puzzle>& solutions)
30 if (p.sym == Puzzle::Symmetry::NONE) { 30 if (p.sym == 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(Pos{x, y});
33 } else { 34 } else {
34 /* 35 /*
35 // Get the symmetrical position, and try coloring it 36 // Get the symmetrical position, and try coloring it
@@ -69,6 +70,7 @@ void Solver::SolveLoop(Puzzle& p, int x, int y, std::vector<Puzzle>& solutions)
69 70
70 // Tail recursion: Back out of this cell 71 // Tail recursion: Back out of this cell
71 p.grid[x][y].color = Cell::Color::NONE; 72 p.grid[x][y].color = Cell::Color::NONE;
73 p.sequence.pop_back();
72 if (p.sym != Puzzle::Symmetry::NONE) { 74 if (p.sym != Puzzle::Symmetry::NONE) {
73 /* 75 /*
74 auto sym = p.GetSymmetricalPos(x, y); 76 auto sym = p.GetSymmetricalPos(x, y);