#include "solver/cell.h"

#include <algorithm>
#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;
}

uint8_t Cell::NumPossibilities() {
  return std::count(possibilities_.begin(), possibilities_.end(), true);
}
