forked from ThomasBouriaud/SudokuResolver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
box.cpp
77 lines (67 loc) · 1.36 KB
/
box.cpp
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
67
68
69
70
71
72
73
74
75
76
77
#include "box.h"
#include <iostream>
#include <string>
BoxGrid::BoxGrid(index line, index column, ValBox v)
:_line(line), _column(column), _value(v), _possibleValue() {};
index BoxGrid::getLine() {
return _line;
}
index BoxGrid::getColumn() {
return _column;
}
ValBox BoxGrid::getValue() {
return _value;
}
std::vector<ValBox> BoxGrid::getPossibleValues() {
return _possibleValue;
}
void BoxGrid::showPossibleValues() {
std::cout << "box(" << _line << ", " << _column << "), possible values : ";
for (auto& i : _possibleValue) {
switch (i) {
case ValBox::ONE:
std::cout << "1, ";
break;
case ValBox::TWO:
std::cout << "2, ";
break;
case ValBox::THREE:
std::cout << "3, ";
break;
case ValBox::FOUR:
std::cout << "4, ";
break;
case ValBox::FIVE:
std::cout << "5, ";
break;
case ValBox::SIX:
std::cout << "6, ";
break;
case ValBox::SEVEN:
std::cout << "7, ";
break;
case ValBox::EIGHT:
std::cout << "8, ";
break;
case ValBox::NINE:
std::cout << "9, ";
break;
case ValBox::UNKNOWN:
std::cout << "x, ";
break;
}
}
std::cout << std::endl;
}
void BoxGrid::setValue(ValBox v) {
_value = v;
}
void BoxGrid::clearPossibleValues() {
_possibleValue.clear();
}
bool BoxGrid::hasAValue() {
return _value != ValBox::UNKNOWN;
}
void BoxGrid::addPossibleValue(ValBox v) {
_possibleValue.push_back(v);
}