Skip to content

Commit fda816e

Browse files
send ply 0 moves to js ui
1 parent 95c7367 commit fda816e

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/Search.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,19 @@ int Search::alphaBeta(const int depth, int alpha, int beta, const int ply) {
139139
continue;
140140
}
141141
logger.logToFile(move.toString() + " begin\n");
142+
if (ply == 0) {
143+
logger.sendString("moveStart", move.toString());
144+
}
142145

143146
hasLegalMoves = true;
144147

145148
const int score = -alphaBeta(depth - 1, -beta, -alpha, ply + 1);
149+
board.unMakeMove();
146150

147151
logger.logToFile(std::format("{} end score : {}\n", move.toString(), score));
148-
board.unMakeMove();
152+
if (ply == 0) {
153+
logger.sendString("moveEnd", move.toString());
154+
}
149155

150156
if (stop) return 0;
151157

@@ -311,7 +317,7 @@ Move Search::selectMove(std::vector<ScoredMove>&moves, const int index) {
311317
return selected.move;
312318
}
313319

314-
void Search::storeKillerMove(const Move move, const int ply) {
320+
void Search::storeKillerMove(const Move&move, const int ply) {
315321
if ((move.flag == 0 || move.flag >= 7) && move.promotionType == 0) {
316322
if (killerMoves[ply][0] == move) return;
317323
if (killerMoves[ply][1] == move) return;

src/Search.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class Search {
5454

5555
static Move selectMove(std::vector<ScoredMove>&moves, int index);
5656

57-
void storeKillerMove(Move move, int ply);
57+
void storeKillerMove(const Move&move, int ply);
5858

5959
std::vector<Move> collectPV(int depth) const;
6060
};

0 commit comments

Comments
 (0)