16 //direções de movimento: vertical, horizontal e duas diagonais
17 char dx
[] = {0, 1, 1, 1}, dy
[] = {1, 0, 1, -1};
18 char horiz
[8], vert
[8], diag
[2][15];
26 #define SQU(x) ((x) * (x))
27 #define MAX(x, y) ((x) > (y) ? (x) : (y))
29 void Board::initial_position()
40 centro
[0] = centro
[1] = 15.16;
41 cmx
[0] = cmx
[1] = cmy
[0] = cmy
[1] = 3.5;
42 concentration
[0] = concentration
[1] = 22.0;
43 centralisation
[0] = centralisation
[1] = -21.66;
44 masscenter
[0] = masscenter
[1] = 24.5;
45 quads
[0] = quads
[1] = 0.0;
46 connectedness
[0] = connectedness
[1] = 1.67;
47 uniformity
[0] = uniformity
[1] = 48;
52 void Board::moves(bool player
, int fromX
, int fromY
, MoveList
&to
)
55 horiz
[i
] = vert
[i
] = 0;
57 diag
[0][i
] = diag
[1][i
] = 0;
63 if(both
.test(INDEX(i
, j
))) {
66 diag
[0][DIAG0(i
, j
)]++;
67 diag
[1][DIAG1(i
, j
)]++;
75 if(get(player
, i
, j
)) {
78 for(int m
= -1; m
<= 1; m
+= 2) {
81 x
= i
+ k
* dx
[d
] * m
;
82 y
= j
+ k
* dy
[d
] * m
;
84 y
> 7 || y
< 0) { // fora do tabuleiro
89 x
= i
+ z
* dx
[d
] * m
;
90 y
= j
+ z
* dy
[d
] * m
;
91 if(get(!player
, x
, y
)) { // barrado por inimigo
98 x
= i
+ k
* dx
[d
] * m
;
99 y
= j
+ k
* dy
[d
] * m
;
100 if(!get(player
, x
, y
)) { // não é sobre um amigo
101 to
.push_back(Move(INDEX(i
, j
), INDEX(x
, y
)));
109 bool board_compare(const Board::Comp
& l
, const Board::Comp
& r
) {
110 return l
.first
< r
.first
|| (l
.first
== r
.first
&& l
.second
< r
.second
);