27 lines
448 B
C++
27 lines
448 B
C++
#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_;
|
|
};
|