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

void Puzzle::generate ( unsigned int  givens_count,
bool  symmetric = true 
)

Generate a new puzzle.

Definition at line 117 of file puzzle.cpp.

References BackTrack::Algorithm::find_next_solution(), reset(), and BackTrack::Algorithm::solution_is_valid().

Referenced by SudokuPlugin::Menu::ProcessKey(), Puzzle(), and SudokuPlugin::Plugin::Start().

{
  // Search a random non-ambiguous puzzle.
  for (bool found = false; !found;)
  {
    Generator generator(*this, givens_count, symmetric, symmetric ? 500 : 2000);
    generator.find_next_solution();
    found = generator.solution_is_valid();
  }
  reset();
}


Generated by  Doxygen 1.6.0   Back to index