summaryrefslogtreecommitdiff
path: root/src/cell.h
blob: 40008463a1d53c5cb58988fccb25d853dfa548ca (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

#ifndef __INCLUDED_SUDOKUSOLVER_CELL__
#define __INCLUDED_SUDOKUSOLVER_CELL__

class Cell {
	
public:
	/**
	 * @brief default constructor
	 * */
	Cell();
	
	/**
	 * @brief copy constructor
	 * */
	Cell(const Cell & other);
	
	/**
	 * @brief assignment operator
	 * */
	void assign(const Cell & other);
	
	// inspectors

	/**
	 * @brief return true if a given value is a valid possibility for this cell
	 * */
	inline int possibility(const int value) { return cell_possibility[value]; }
		
	/**
	 * @brief return true of the current value for this cell is a valid possibility
	 * */
	inline bool valid() const { return cell_valid; }
	
	/**
	 * @brief return the current value for this cell_possibility
	 * */
	inline int value() const { return cell_value; }

	// mutators
	
	/**
	 * @brief set wether or not the given value is a valid possibility for a this cell
	 * */
	void set_possibility(int value, bool possible = true);
	
	/**
	 * @brief set wether or not this cell is valid
	 * */
	void set_valid(bool valid);
	
	/**
	 * @brief set the value for this cell
	 * */
	void set_value(int value);
		
private:
	bool cell_possibility[9];
	bool cell_valid;
	int cell_value;
};

#endif // __INCLUDED_SUDOKUSOLVER_CELL__