haiku/src/apps/sudoku/SudokuSolver.h
Axel Dörfler 451cbc4a94 * SudokuSolver::ComputeSolutions() can now be called more than once without
doubling the solution list.
* ComputeSolutions() will now check if solving the Sudoku is affordable for
  this algorithm (at least 1/6th of the fields must be known). This fixes
  one part of bug #1435.
* SudokuView now checks if the Sudoku is already solved before trying to
  fill in a value from the solution (and then it did not find a free spot,
  surprisingly). This fixes the other part of bug #1435.
* SudokuView now beeps if there was no solution.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22110 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-08-29 13:24:31 +00:00

38 lines
635 B
C++

/*
* Copyright 2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef SUDOKU_SOLVER_H
#define SUDOKU_SOLVER_H
#include <vector>
#include <SupportDefs.h>
class SudokuField;
class SudokuSolver {
public:
SudokuSolver(SudokuField* field);
SudokuSolver();
~SudokuSolver();
void SetTo(SudokuField* field);
void ComputeSolutions();
uint32 CountSolutions();
SudokuField* SolutionAt(uint32 index);
private:
void _MakeEmpty();
typedef std::vector<SudokuField*> SudokuList;
SudokuField* fField;
SudokuList fSolutions;
};
#endif // SUDOKU_SOLVER_H