Newer
Older
value_ = value;
for (int i = 0; i < GRID_SIDE; ++i)
forbidden_[i] = false;
}
inline bool Block::is_forbidden(int value) const throw (Error) {
return forbidden_[value - 1];
}
inline bool Block::is_set() const {
return value_ != 0;
throw Error("Invalid forbid value.", EXIT_INV_VAL);
if (value_ == val)
throw Error("Try to forbid whereas case is set.", EXIT_INV_GRID);
throw Error("All possibilities are forbidden.", EXIT_INV_GRID);
inline ostream &operator<<(ostream &stream, const Block &blk) {
if (blk.value_ == 0)
stream << " ";
else
stream << blk.value_;
return stream;
}
inline int Block::forbidden_count() const
{
int count = 0;
for (int i = 0; i < GRID_SIDE; ++i)
if (forbidden_[i])
++count;
return count;
}