diff --git a/solver.hpp b/solver.hpp index d5ba097..c1bcf6f 100644 --- a/solver.hpp +++ b/solver.hpp @@ -61,7 +61,7 @@ public: for(int col = 0; col < known.M; col++) { int possible_count = 0; for(int n : positions_of_colors[col]) - if(known.possible[n][col]) + if(known.can(n, col)) possible_count++; if(possible_count == 0 && positions_of_colors[col].size() > 0) known.empty_color(col); @@ -69,11 +69,8 @@ public: } void here(vector guess) { for(int n = 0; n < known.N; n++) - if(guess[n] > -1 && known.possible[n][guess[n]]) - for(int col = 0; col < known.M; col++) { - if(col != guess[n]) - known.possible[n][col] = 0; - } + if(guess[n] > -1 && known.can(n, guess[n])) + known.must_be(n, guess[n]); } void not_here(vector guess) { for(int n = 0; n < known.N; n++) @@ -105,7 +102,7 @@ public: // Get number of colors, that can be on their positions int possible_count = 0; for(int n = 0; n < known.N; n++) - if(guess[n] > -1 && known.possible[n][guess[n]]) + if(guess[n] > -1 && known.can(n, guess[n])) possible_count++; // None of these colors are there