@@ -114,7 +114,7 @@ int Search::alphaBeta(const int depth, int alpha, int beta, const int ply) {
114
114
if (alpha >= beta) return alpha;
115
115
}
116
116
117
- if (depth == 0 ) return quiesce (alpha, beta, ply, 0 );
117
+ if (depth < 1 ) return quiesce (alpha, beta, ply, 0 );
118
118
119
119
Move hashMove = NULL_MOVE;
120
120
int positionScore = 0 ;
@@ -139,19 +139,23 @@ int Search::alphaBeta(const int depth, int alpha, int beta, const int ply) {
139
139
continue ;
140
140
}
141
141
logger.logToFile (move.toString () + " begin\n " );
142
- if (ply == 0 ) {
143
- logger.sendString (" moveStart" , move.toString ());
144
- }
145
142
146
143
hasLegalMoves = true ;
147
144
148
- const int score = -alphaBeta (depth - 1 , -beta, -alpha, ply + 1 );
145
+ int score = 0 ;
146
+
147
+ // late move reductions
148
+ bool shouldFullSearch = true ;
149
+ if (i > 2 && depth > 3 && !move.tactical ()) {
150
+ score = -alphaBeta (depth - 2 , -alpha - 1 , -alpha, ply + 1 );
151
+
152
+ shouldFullSearch = score > alpha;
153
+ }
154
+
155
+ if (shouldFullSearch) score = -alphaBeta (depth - 1 , -beta, -alpha, ply + 1 );
149
156
board.unMakeMove ();
150
157
151
158
logger.logToFile (std::format (" {} end score : {}\n " , move.toString (), score));
152
- if (ply == 0 ) {
153
- logger.sendString (" moveEnd" , move.toString ());
154
- }
155
159
156
160
if (stop) return 0 ;
157
161
0 commit comments