Line 250... |
Line 250... |
// *move = moves->data[index[i]];
|
// *move = moves->data[index[i]];
|
// return 1;
|
// return 1;
|
// }
|
// }
|
//}
|
//}
|
// return 0;
|
// return 0;
|
if(!moves|| !moves->len) return 0;
|
//if(!moves|| !moves->len) return 0;
|
else {*move=moves->data[i];return 1;}
|
//else {*move=moves->data[i];return 1;}
|
|
|
|
|
}
|
}
|
//
|
//
|
//void aimoves_crop(AIMoves *moves, unsigned int n)
|
//void aimoves_crop(AIMoves *moves, unsigned int n)
|
Line 596... |
Line 596... |
if (p != type)
|
if (p != type)
|
break;
|
break;
|
x += dx;
|
x += dx;
|
y += dy;
|
y += dy;
|
}
|
}
|
|
/* this two lines create problem in synthesis preprocess ?? */
|
if (out)
|
if (out)
|
*out = p;
|
*out = p;
|
return i;
|
return i;
|
}
|
}
|
|
|
gboolean check_win_full(const Board *b, BCOORD x, BCOORD y,
|
gboolean check_win_full(const Board *b, BCOORD x, BCOORD y,
|
BCOORD *x1, BCOORD *y1, BCOORD *x2, BCOORD *y2)
|
BCOORD *x1, BCOORD *y1, BCOORD *x2, BCOORD *y2)
|
{
|
{
|
int i, c1, c2, xs[] = {1, 1, 0, -1}, ys[] = {0, 1, 1, 1};
|
int i, c1, c2, xs[] = {1, 1, 0, -1}, ys[] = {0, 1, 1, 1};
|
PIECE type;
|
PIECE type;
|
|
PIECE p;
|
|
|
type = piece_at(b, x, y);
|
type = piece_at(b, x, y);
|
if (type != PIECE_BLACK && type != PIECE_WHITE)
|
if (type != PIECE_BLACK && type != PIECE_WHITE)
|
return FALSE;
|
return FALSE;
|
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
c1 = count_pieces(b, x, y, type, xs[i], ys[i], 0);
|
c1 = count_pieces(b, x, y, type, xs[i], ys[i], &p);
|
c2 = count_pieces(b, x, y, type, -xs[i], -ys[i], 0);
|
c2 = count_pieces(b, x, y, type, -xs[i], -ys[i], &p);
|
if (c1 + c2 > connect_k) {
|
if (c1 + c2 > connect_k) {
|
if (x1)
|
//if (x1)
|
*x1 = x + xs[i] * (c1 - 1);
|
// *x1 = x + xs[i] * (c1 - 1);
|
if (y1)
|
//if (y1)
|
*y1 = y + ys[i] * (c1 - 1);
|
// *y1 = y + ys[i] * (c1 - 1);
|
if (x2)
|
//if (x2)
|
*x2 = x - xs[i] * (c2 - 1);
|
// *x2 = x - xs[i] * (c2 - 1);
|
if (y2)
|
//if (y2)
|
*y2 = y - ys[i] * (c2 - 1);
|
// *y2 = y - ys[i] * (c2 - 1);
|
return TRUE;
|
return TRUE;
|
}
|
}
|
}
|
}
|
return FALSE;
|
return FALSE;
|
}
|
}
|