mirror of
https://review.haiku-os.org/haiku
synced 2025-01-31 02:35:03 +01:00
451cbc4a94
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
38 lines
635 B
C++
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
|