Code: Select all
void RootSearch(Thread* t, Move* m, s32 alpha, s32 beta, s32 depth, u64 n) {
s32 mi, j;
Move* mov;
for (mi = 0; mi < n; mi++) {
mov = m + mi;
if (mov->fs == pvs[0][0].fs && mov->ts == pvs[0][0].ts && mov->type == pvs[0][0].type) {
mov->score = 1000000;
break;
}
}
SortRoot(t, move, n);
for (mi = 0; mi < n; mi++) {
mov = m + mi;
MakeMove(t, mov);
mov->score = -Search(t, m + n, -beta, -alpha, depth - 1);
TakeBack(t, mov);
if (mov->score == -ILLEGAL) {
printf("ILLEGAL\n"); // <-----------------------------------------------------------
continue;
}
if (mov->score > alpha) {
printf("\nalpha = %i\n", alpha); // <-----------------------------------------------
alpha = mov->score;
printf("alpha = %i\n\n", alpha); // <-----------------------------------------------
bestMove = *mov;
pvs[ply][ply] = *mov;
for (j = ply + 1; j < pvl[ply + 1]; j++) {
pvs[ply][j] = pvs[ply + 1][j];
}
pvl[ply] = pvl[ply + 1];
}
if (clock() > end) break;
}
}
r n b q k b n r
p p p p p p p p
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
P P P P P P P P
R N B Q K B N R
Enter Command(w):
st 30
r n b q k b n r
p p p p p p p p
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
P P P P P P P P
R N B Q K B N R
Enter Command(w):
go
Begin Depth 1
alpha = -32767
alpha = 35
1 35 0 20 d2d4
Begin Depth 2
alpha = -32767
alpha = 0
alpha = 0
alpha = 1
2 1 0 106 g1f3 d7d5
Begin Depth 3
alpha = -32767
alpha = 35
3 35 0 682 g1f3 g8f6 d2d4
Begin Depth 4
alpha = -32767
alpha = 0
4 0 0 4159 g1f3 g8f6 d2d4 d7d5
Begin Depth 5
alpha = -32767
alpha = 33
5 33 0 19237 g1f3 g8f6 d2d4 d7d5 b1c3
Begin Depth 6
alpha = -32767
alpha = 1
alpha = 1
alpha = 5
6 5 1 72690 e2e4 b8c6 b1c3 e7e5 c3d5 g8f6
Begin Depth 7
alpha = -32767
alpha = 17
alpha = 17
alpha = 28
7 28 1 135203 d2d4 b8c6 g1f3 d7d5 b1c3 g8f6 c1e3
Begin Depth 8
alpha = -32767
alpha = 3
alpha = 3
alpha = 10
alpha = 10
alpha = 14
8 14 4 396105 e2e4 b8c6 d2d4 d7d5 e4d5 d8d5 g1f3 g8f6
Begin Depth 9
alpha = -32767
alpha = 29
9 29 9 1107427 e2e4 b8c6 g1f3 g8f6 b1c3 d7d5 e4d5 f6d5 d2d4
Begin Depth 10
alpha = -32767
alpha = 17
10 17 43 4743732 e2e4 b8c6 g1f3 g8f6 b1c3 d7d5 e4d5 f6d5 c3d5 d8d5
Begin Depth 11
alpha = -32767
alpha = 26
11 26 160 21601527 e2e4 e7e5 g1f3 g8f6 b1c3 b8c6 f1d3 f8d6 e1g1 h8f8 h2h3
Begin Depth 12
alpha = -32767
alpha = 19
12 19 938 106447777 e2e4 e7e5 b1c3 g8f6 g1f3 b8c6 f1c4 f8b4 c3d5 b4d6 d2d3 h8f8
Begin Depth 13
alpha = -32767
alpha = 18
Move Played: E2E4 Score: 19
r n b q k b n r
p p p p p p p p
. . . . . . . .
. . . . . . . .
. . . . P . . .
. . . . . . . .
P P P P . P P P
R N B Q K B N R
Enter Command(b):
setboard 8/8/P2k3p/7P/4PKP1/1BP5/8/8 b - - 0 53
. . . . . . . .
. . . . . . . .
P . . k . . . p
. . . . . . . P
. . . . P K P .
. B P . . . . .
. . . . . . . .
. . . . . . . .
Enter Command(b):
st 1
. . . . . . . .
. . . . . . . .
P . . k . . . p
. . . . . . . P
. . . . P K P .
. B P . . . . .
. . . . . . . .
. . . . . . . .
Enter Command(b):
go
Begin Depth 1
ILLEGAL
ILLEGAL
ILLEGAL
alpha = -32767
alpha = -824
1 -824 0 8 d6c5
Begin Depth 2
alpha = -32767
alpha = -908
ILLEGAL
ILLEGAL
ILLEGAL
2 -908 0 59 d6c5 a6a7
Begin Depth 3
alpha = -32767
alpha = -1521
alpha = -1521
alpha = -940
ILLEGAL
ILLEGAL
ILLEGAL
3 -940 0 358 d6c6 a6a7 c6b7
Begin Depth 4
alpha = -32767
alpha = -888
ILLEGAL
ILLEGAL
ILLEGAL
4 -888 1 1480 d6c6 f4e5 c6b6 b3c4
Begin Depth 5
alpha = -32767
alpha = -864
ILLEGAL
ILLEGAL
ILLEGAL
5 -864 1 2934 d6c6 f4e5 c6b6 b3c4 b6c5
Begin Depth 6
alpha = -32767
alpha = -900
ILLEGAL
ILLEGAL
ILLEGAL
6 -900 2 8015 d6c6 f4e5 c6c7 e5e6 c7b6 b3c4
Begin Depth 7
alpha = -32767
alpha = -900
ILLEGAL
ILLEGAL
ILLEGAL
7 -900 2 13850 d6c6 f4e5 c6b6 b3c4 b6a7 e5e6 a7b6
Begin Depth 8
alpha = -32767
alpha = -935
ILLEGAL
ILLEGAL
ILLEGAL
8 -935 2 53391 d6c6 b3c4 c6b6 f4f5 b6a7 f5g6 a7b6 g6h6
Begin Depth 9
alpha = -32767
alpha = -1464
ILLEGAL
ILLEGAL
ILLEGAL
9 -1464 3 83392 d6c6 a6a7 c6b7 e4e5 b7a7 e5e6 a7b6 e6e7 b6c5
Begin Depth 10
ILLEGAL
ILLEGAL
ILLEGAL
10 -32767 6 717942 d6c6 a6a7 c6b7 e4e5 b7a7 e5e6 a7b6 e6e7 b6c5
Begin Depth 11
ILLEGAL
ILLEGAL
ILLEGAL
11 -32767 19 2673772 d6c6 a6a7 c6b7 e4e5 b7a7 e5e6 a7b6 e6e7 b6c5
Begin Depth 12
ILLEGAL
ILLEGAL
ILLEGAL
12 -32767 39 7184219 d6c6 a6a7 c6b7 e4e5 b7a7 e5e6 a7b6 e6e7 b6c5
Begin Depth 13
resign
. . . . . . . .
. . . . . . . .
P . . k . . . p
. . . . . . . P
. . . . P K P .
. B P . . . . .
. . . . . . . .
. . . . . . . .
Enter Command(b):