First pass at a sudoku solver: Puzzle Import
Imports a puzzle from a string and displays the restricted puzzle.
This commit is contained in:
commit
bcc5b5097e
8 changed files with 179 additions and 0 deletions
17
solver/cell.cpp
Normal file
17
solver/cell.cpp
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#include "cell.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
Cell::Cell()
|
||||
: state_(Unsolved), value_(0), possibilities_{true, true, true, true, true,
|
||||
true, true, true, true} {}
|
||||
|
||||
Cell::Cell(uint8_t value)
|
||||
: state_(Solved), value_(value), possibilities_{false, false, false,
|
||||
false, false, false,
|
||||
false, false, false} {}
|
||||
|
||||
void Cell::Restrict(uint8_t value) {
|
||||
assert(value >= 1 && value <= 9);
|
||||
possibilities_[value - 1] = false;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue