Update Sudoku Solver to check for naked singles.

This commit is contained in:
Drew Galbraith 2023-04-17 16:48:38 -07:00
parent bcc5b5097e
commit 3dc9f04650
5 changed files with 40 additions and 0 deletions

View file

@ -1,5 +1,6 @@
#include "cell.h"
#include <algorithm>
#include <cassert>
Cell::Cell()
@ -15,3 +16,7 @@ void Cell::Restrict(uint8_t value) {
assert(value >= 1 && value <= 9);
possibilities_[value - 1] = false;
}
uint8_t Cell::NumPossibilities() {
return std::count(possibilities_.begin(), possibilities_.end(), true);
}