#ifndef BOXH #define BOXH #include #include #include #include using namespace std; class sudoku; class row; class col; class reg; class box { static const size_t root = 3; static const size_t n = root * root; static const size_t all[n]; sudoku *p; size_t x; size_t y; set s; bool operator[](size_t i) const { assert(i < n); return s.find(i) != s.end(); } size_t size() const {return s.size();} public: box(): s(all, all + n) {} void set(size_t i); void reset(size_t i); operator row&() const; operator col&() const; operator reg&() const; template void mow_down(size_t i) const; template void only(size_t i) const; template void herd(size_t i) const; template void contingency() const; friend ostream& operator<<(ostream& ost, const box& bo); friend class sudoku; }; #endif