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

Pos Puzzle::next_free ( Pos  pos = Pos::last()  )  const

Get the next free cell with minimal possible numbers.

Definition at line 203 of file puzzle.cpp.

References Sudoku::DIM, and Sudoku::SDIM.

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

{
  unsigned int min_count = DIM+1, min_index = SDIM, i;

  for (pos = (pos+1)%SDIM, i = 0; i < SDIM; ++i, pos = (pos+1)%SDIM)
    if (get(pos) == 0 && count[pos] < min_count)
      min_count = count[pos], min_index = pos;

  return min_index;
}


Generated by  Doxygen 1.6.0   Back to index