Logo Search packages:      
Sourcecode: vdr-plugin-sudoku version File versions  Download package

void Puzzle::set ( Pos  pos,
unsigned int  number 
) [virtual]

Set the number into this cell.

Reimplemented from Sudoku::Numbers.

Definition at line 100 of file puzzle.cpp.

References Sudoku::Pos::col(), compute_numbers(), Sudoku::DIM, given(), Sudoku::Pos::reg(), Sudoku::Pos::row(), and Sudoku::Numbers::set().

Referenced by SudokuPlugin::Menu::ProcessKey(), Sudoku::Solver::reset_at(), Sudoku::Solver::set_first_at(), and Sudoku::Solver::set_next_at().

{
  assert (pos <= Pos::last());
  assert (0 <= number && number <= DIM);

  if (!given(pos) && get(pos) != number)
  {
    Numbers::set(pos, number);

    // Refresh possible numbers of all affected cells.
    for (Pos p = Pos::first(); p <= Pos::last(); p = p.next())
      if (p.col() == pos.col() || p.row() == pos.row() || p.reg() == pos.reg())
        compute_numbers(p);
  }
}


Generated by  Doxygen 1.6.0   Back to index