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
26
solver/cell.h
Normal file
26
solver/cell.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <array>
|
||||
|
||||
class Cell {
|
||||
public:
|
||||
enum State {
|
||||
Unsolved,
|
||||
Solved,
|
||||
};
|
||||
Cell();
|
||||
explicit Cell(uint8_t value);
|
||||
|
||||
void Restrict(uint8_t value);
|
||||
|
||||
bool IsSolved() const { return state_ == Solved; }
|
||||
uint8_t value() const { return value_; }
|
||||
bool IsPossible(uint8_t v) const { return possibilities_[v - 1]; }
|
||||
|
||||
private:
|
||||
State state_;
|
||||
uint8_t value_;
|
||||
std::array<bool, 9> possibilities_;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue