Skip to content

Commit 84ae34f

Browse files
author
gekomad
committed
fix bug mate in 1
1 parent cd4882a commit 84ae34f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Search.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void Search::aspirationWindow(const int depth, const int valWin) {
4040
init();
4141

4242
if (depth == 1) {
43-
valWindow = search(SMP_NO, depth, -_INFINITE, _INFINITE);
43+
valWindow = search(SMP_NO, depth, -_INFINITE - 1, _INFINITE + 1);
4444
} else {
4545
ASSERT(INT_MAX != valWindow);
4646
int tmp = search(SMP_NO, mainDepth, valWindow - VAL_WINDOW, valWindow + VAL_WINDOW);
@@ -356,9 +356,15 @@ void Search::setMainParam(const bool smp, const int depth) {
356356
int Search::search(bool smp, int depth, int alpha, int beta) {
357357
ASSERT_RANGE(depth, 0, MAX_PLY);
358358
if (smp) {
359-
return getSide() ? search<WHITE, SMP_YES>(depth, alpha, beta, &pvLine, bitCount(getBitmap<WHITE>() | getBitmap<BLACK>()), &mainMateIn) : search<BLACK, SMP_YES>(depth, alpha, beta, &pvLine, bitCount(getBitmap<WHITE>() | getBitmap<BLACK>()), &mainMateIn);
359+
return getSide() ? search<WHITE, SMP_YES>(depth, alpha, beta, &pvLine, bitCount(getBitmap<WHITE>() | getBitmap<BLACK>()), &mainMateIn) : search<BLACK, SMP_YES>(depth, alpha, beta, &pvLine,
360+
bitCount(getBitmap<WHITE>() |
361+
getBitmap<BLACK>()),
362+
&mainMateIn);
360363
} else {
361-
return getSide() ? search<WHITE, SMP_NO>(depth, alpha, beta, &pvLine, bitCount(getBitmap<WHITE>() | getBitmap<BLACK>()), &mainMateIn) : search<BLACK, SMP_NO>(depth, alpha, beta, &pvLine, bitCount(getBitmap<WHITE>() | getBitmap<BLACK>()), &mainMateIn);
364+
return getSide() ? search<WHITE, SMP_NO>(depth, alpha, beta, &pvLine, bitCount(getBitmap<WHITE>() | getBitmap<BLACK>()), &mainMateIn) : search<BLACK, SMP_NO>(depth, alpha, beta, &pvLine,
365+
bitCount(getBitmap<WHITE>() |
366+
getBitmap<BLACK>()),
367+
&mainMateIn);
362368
}
363369
}
364370

0 commit comments

Comments
 (0)