summaryrefslogtreecommitdiff
path: root/src/solverwindow.h
blob: 4520c9e2af58c754641fa83043ca551d28a2bae5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66

#ifndef __INCLUDED_SUDOKUSOLVER_SOLVERWINDOW__
#define __INCLUDED_SUDOKUSOLVER_SOLVERWINDOW__

#include <QWidget>

#include "sudoku.h"

class SudokuWidget;

class SolverWindow : public QWidget
{
	Q_OBJECT
	
public:
	SolverWindow();
	
	inline const QString & filename()
	{
		return solverwindow_filename;
	}

public slots:
	
	void load();
	void save();
	void saveas();
	void revert();
	
	/**
	 * @brief try to find a solution by using the rules only
	 * */
	void solve();
	
	/**
	 * @brief try to find a solution by guessing where required
	 * */
	void search();
	
	/**
	 * @brief try to solve a single cell by using the rules only
	 * */
	void step();
	
	void step_constraints();
	void step_coverage();	
	
	/**
	 * @brief try to solve a single cell by guessing where required
	 * */
	void guess();
	
	void clear();
	
	void validate();
	
private:
	void saveToFile(const QString & filename);
	void loadFromFile(const QString & filename);
	
	SudokuWidget	*solverwindow_sudokuwidget;
	Sudoku		solverwindow_revertstate;
	QString		solverwindow_filename;
};

#endif // __INCLUDED_SUDOKUSOLVER_SOLVERWINDOW__