-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnewInternalupdateArray.cpp
More file actions
75 lines (67 loc) · 3.9 KB
/
Copy pathnewInternalupdateArray.cpp
File metadata and controls
75 lines (67 loc) · 3.9 KB
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
newInternalupdateArray
void PuzzleClass::UpdateInternalArray(int FLAG){
if (FLAG == 1){
//(*this->externalhistoryArray)->ResetexternalArray(1);
std::cout << "numbers possible++ for PuzzleArray[2][0]: " << PuzzleArray[2][0].Getnumberpossible() << std::endl;
std::cout << "Locationi = " << (*this->externalhistoryArray)->Getlocationi() << std::endl;
for (int a = 0; a < 9; ++a){
for (int b = 0; b < 9; ++b){
}
}
this->i = (*this->externalhistoryArray)->Getlocationi();
for (this->j = 0; this->j < 9; ++(this->j)){
if (((this->PuzzleArray[this->i][this->j].GetValue()) == 0) && ((*this->externalhistoryArray)->Getlocationj() != this->j)){
this->PuzzleArray[this->i][this->j].UpdateinternalhistoryArray((*this->externalhistoryArray)->GetValue());
this->PuzzleArray[this->i][this->j].UpdatePossibilities(1);
}
}
std::cout << "numbers possible+ for PuzzleArray[2][0]: " << PuzzleArray[2][0].Getnumberpossible() << std::endl;
this->j = (*this->externalhistoryArray)->Getlocationj();
std::cout << "Locationj = " << (*this->externalhistoryArray)->Getlocationj() << std::endl;
std::cout << "Value in question = " << (*this->externalhistoryArray)->GetValue() << std::endl;
for (this->i = 0; this->i < 9; ++i){
if (((this->PuzzleArray[this->i][this->j].GetValue()) == 0) && ((*this->externalhistoryArray)->Getlocationi() != this->j)){
this->PuzzleArray[this->i][this->j].UpdateinternalhistoryArray((*this->externalhistoryArray)->GetValue());
this->PuzzleArray[this->i][this->j].UpdatePossibilities(1);
}
}
std::cout << "numbers possible+ for PuzzleArray[2][0]: " << PuzzleArray[2][0].Getnumberpossible() << std::endl;
this->squarei = ((*this->externalhistoryArray)->Getlocationi() / 3);
this->squarej = ((*this->externalhistoryArray)->Getlocationj() / 3);
for(int i = 0; i < 3; ++i){
for(int j = 0; j < 3; ++j){
if (((this->PuzzleArray[i + (3 * squarei)][j + (3 * squarej)].GetValue()) == 0) && (((*this->externalhistoryArray)->Getlocationi()) != (i + (3 * squarei))) && (((*this->externalhistoryArray)->Getlocationj()) != (j + (3 * squarej)))){
this->PuzzleArray[i + (3 * squarei)][j + (3 * squarej)].UpdateinternalhistoryArray((*this->externalhistoryArray)->GetValue());
this->PuzzleArray[i + (3 * squarei)][j + (3 * squarej)].UpdatePossibilities(1);
}
}
}
std::cout << "numbers possible+ for PuzzleArray[2][0]: " << PuzzleArray[2][0].Getnumberpossible() << std::endl;
}
else if (FLAG == -1){
this->squarei = ((*this->externalhistoryArray)->Getlocationi() / 3);
this->squarej = ((*this->externalhistoryArray)->Getlocationj() / 3);
for(int i = 0; i < 3; ++i){
for(int j = 0; j < 3; ++j){
if (((this->PuzzleArray[i + (3 * squarei)][j + (3 * squarej)].GetValue()) == 0) && (((*this->externalhistoryArray)->Getlocationi()) != (i + (3 * squarei))) && (((*this->externalhistoryArray)->Getlocationj()) != (j + (3 * squarej)))){
this->PuzzleArray[i + (3 * squarei)][j + (3 * squarej)].UpdatePossibilities(-1);
}
}
}
std::cout << "numbers possible- for PuzzleArray[2][0]: " << PuzzleArray[2][0].Getnumberpossible() << std::endl;
this->j = (*this->externalhistoryArray)->Getlocationj();
for (this->i = 0; this->i < 9; ++i){
if (((this->PuzzleArray[this->i][this->j].GetValue()) == 0) && ((*this->externalhistoryArray)->Getlocationi() != this->i)){
this->PuzzleArray[this->i][this->j].UpdatePossibilities(-1);
}
}
std::cout << "numbers possible- for PuzzleArray[2][0]: " << PuzzleArray[2][0].Getnumberpossible() << std::endl;
this->i = (*this->externalhistoryArray)->Getlocationi();
for (this->j = 0; this->j < 9; ++(this->j)){
if (((this->PuzzleArray[this->i][this->j].GetValue()) == 0) && ((*this->externalhistoryArray)->Getlocationj() != this->j)){
this->PuzzleArray[this->i][this->j].UpdatePossibilities(-1);
}
}
std::cout << "numbers possible- for PuzzleArray[2][0]: " << PuzzleArray[2][0].Getnumberpossible() << std::endl;
}
}