bugfix: didnt play move in enemy's mate in one
This commit is contained in:
1 parent
573361374c
commit
3b41c7765b
1 file changed
+3
-2
+3
-2
@@ -136,8 +136,6 @@ SearchResults PVS(Board board, int depth, int alpha, int beta) {
|
|||||||
GenerateMoves(board, board.sideToMove);
|
GenerateMoves(board, board.sideToMove);
|
||||||
SortMoves(board);
|
SortMoves(board);
|
||||||
|
|
||||||
if (board.InCheck(board.sideToMove)) depth++;
|
|
||||||
|
|
||||||
if (board.currentMoveIndex == 0) {
|
if (board.currentMoveIndex == 0) {
|
||||||
if (board.InCheck(board.sideToMove)) { // checkmate
|
if (board.InCheck(board.sideToMove)) { // checkmate
|
||||||
return -49000 + ply;
|
return -49000 + ply;
|
||||||
@@ -183,6 +181,7 @@ SearchResults PVS(Board board, int depth, int alpha, int beta) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
results.score = alpha;
|
results.score = alpha;
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
@@ -195,6 +194,8 @@ static SearchResults ID(Board &board, SearchParams params) {
|
|||||||
int inc = board.sideToMove ? params.binc : params.winc;
|
int inc = board.sideToMove ? params.binc : params.winc;
|
||||||
|
|
||||||
SearchResults safeResults;
|
SearchResults safeResults;
|
||||||
|
safeResults.score = -50000;
|
||||||
|
|
||||||
for (int depth = 1; depth <= 99; depth++) {
|
for (int depth = 1; depth <= 99; depth++) {
|
||||||
int timeRemaining = (fullTime / 20) + (inc / 2);
|
int timeRemaining = (fullTime / 20) + (inc / 2);
|
||||||
timeToSearch = timeRemaining;
|
timeToSearch = timeRemaining;
|
||||||
|
|||||||
Reference in new issue
Block a user