Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
lib
centering3x3.cc
Go to the documentation of this file.
1
/* centering3x3.cc
2
*/
3
#include "
osl/centering3x3.h
"
4
#include "
osl/square.h
"
5
6
osl::Centering3x3::
7
Table::Table
()
8
{
9
centers.fill(
Square::STAND
());
10
for
(
int
y=1; y<=9; ++y)
11
{
12
for
(
int
x=1; x<=9; ++x)
13
{
14
const
Square
src =
Square
(x,y);
15
centers[src.
index
()] =
adjustCenterNaive
(src);
16
}
17
}
18
}
19
20
namespace
21
{
22
int
adjustCenterXY(
int
xy)
23
{
24
if
(xy == 1)
25
return
xy+1;
26
else
if
(xy == 9)
27
return
xy-1;
28
return
xy;
29
}
30
}
// anonymous namespace
31
32
const
osl::Square
osl::
33
Centering3x3::adjustCenterNaive
(
Square
src)
34
{
35
const
int
x = adjustCenterXY(src.
x
());
36
const
int
y = adjustCenterXY(src.
y
());
37
return
Square
(x, y);
38
}
39
40
/* ------------------------------------------------------------------------- */
41
// ;;; Local Variables:
42
// ;;; mode:c++
43
// ;;; c-basic-offset:2
44
// ;;; End:
Generated on Sun Jul 21 2013 13:37:23 by
1.8.4