42 |
m_matrix[i] = input.m_matrix[i]; |
m_matrix[i] = input.m_matrix[i]; |
43 |
} |
} |
44 |
|
|
45 |
|
void SolutionInt::set(unsigned char input[MAX_SIZE]) |
46 |
|
{ |
47 |
|
for (int i=0; i<m_size; i++) |
48 |
|
m_matrix[i] = input[i]; |
49 |
|
} |
50 |
|
|
51 |
bool SolutionInt::getMatrix(int x, int y) |
bool SolutionInt::getMatrix(int x, int y) |
52 |
{ |
{ |
53 |
return (m_matrix[x] == y); |
return (m_matrix[x] == y); |
69 |
return false; |
return false; |
70 |
return true; |
return true; |
71 |
} |
} |
72 |
/* |
|
|
bool SolutionInt::operator !=(const Solution& s) |
|
|
{ |
|
|
const SolutionInt& sol = dynamic_cast<const SolutionInt&>(s); |
|
|
return !operator==(s); |
|
|
} |
|
|
*/ |
|
73 |
Solution* SolutionInt::copy() |
Solution* SolutionInt::copy() |
74 |
{ |
{ |
75 |
return new SolutionInt(*this); |
return new SolutionInt(*this); |
77 |
|
|
78 |
void SolutionInt::mirror() |
void SolutionInt::mirror() |
79 |
{ |
{ |
80 |
|
unsigned char temp[MAX_SIZE]; |
81 |
|
for (int i=0; i<m_size; i++) |
82 |
|
temp[i] = (m_size-1) - m_matrix[i]; |
83 |
|
set( temp ); |
84 |
} |
} |
85 |
|
|
86 |
|
|
87 |
void SolutionInt::rotate90() |
void SolutionInt::rotate90() |
88 |
{ |
{ |
89 |
|
unsigned char temp[MAX_SIZE]; |
90 |
|
|
91 |
|
for (int i=0; i<m_size; i++) |
92 |
|
{ |
93 |
|
int x = i; |
94 |
|
int y = m_matrix[i]; |
95 |
|
|
96 |
|
temp[y] = (m_size-1) - i; |
97 |
|
} |
98 |
|
|
99 |
|
set( temp); |
100 |
} |
} |
101 |
|
|