|
@@ -12,7 +12,7 @@ size_t Perft::search(void)
|
|
|
{
|
|
|
size_t result = 0;
|
|
|
auto searcher = [&result] (const MoveInfo& mi, ChessGame& cg, int depth) {
|
|
|
- if (depth > 0) {
|
|
|
+ if (depth > 1) {
|
|
|
UndoInfo ui = cg.doMove(mi);
|
|
|
Perft p{ depth - 1, cg };
|
|
|
result += p.search();
|
|
@@ -25,7 +25,10 @@ size_t Perft::search(void)
|
|
|
|
|
|
Search<decltype(searcher)> search (searcher, chessGame);
|
|
|
|
|
|
- search.iterateAll<WHITE_SIDE>(chessGame, depth);
|
|
|
+ if (chessGame.getTurn() == WHITE_SIDE)
|
|
|
+ search.iterateAll<WHITE_SIDE>(chessGame, depth);
|
|
|
+ else
|
|
|
+ search.iterateAll<BLACK_SIDE>(chessGame, depth);
|
|
|
|
|
|
return result;
|
|
|
}
|
|
@@ -261,4 +264,4 @@ MiniMax::BestMove MiniMax::minimax(int depth)
|
|
|
bestMove.value *= 0.9f;
|
|
|
bestMove.value += v * 0.2f;
|
|
|
return -bestMove;
|
|
|
-}
|
|
|
+}
|