removed adj and pruning disabling during datagen | bench 26088050
This commit is contained in:
1 parent
e6318f6ff4
commit
720fd40176
2 files changed
+3
-51
No files matched your search
+3
-48
@@ -129,12 +129,14 @@ static void PlayGames(int id, std::atomic<int>& positions, std::atomic<bool>& st
|
|||||||
|
|
||||||
const int evenityMargin = 200;
|
const int evenityMargin = 200;
|
||||||
|
|
||||||
|
/*
|
||||||
const int winAdjMoveCount = 3;
|
const int winAdjMoveCount = 3;
|
||||||
const int winAdjScore = 400;
|
const int winAdjScore = 400;
|
||||||
|
|
||||||
const int drawAdjMoveNumber = 40;
|
const int drawAdjMoveNumber = 40;
|
||||||
const int drawAdjMoveCount = 8;
|
const int drawAdjMoveCount = 8;
|
||||||
const int drawAdjScore = 10;
|
const int drawAdjScore = 10;
|
||||||
|
*/
|
||||||
|
|
||||||
while (!stopFlag) {
|
while (!stopFlag) {
|
||||||
Board board;
|
Board board;
|
||||||
@@ -158,14 +160,6 @@ static void PlayGames(int id, std::atomic<int>& positions, std::atomic<bool>& st
|
|||||||
int staticEval = UTILS::ConvertToWhiteRelative(board, NNUE::net.Evaluate(board));
|
int staticEval = UTILS::ConvertToWhiteRelative(board, NNUE::net.Evaluate(board));
|
||||||
int wdl = 1;
|
int wdl = 1;
|
||||||
|
|
||||||
int whiteWinAdjCurrentMoveCount = 0;
|
|
||||||
int blackWinAdjCurrentMoveCount = 0;
|
|
||||||
|
|
||||||
int moveNumber = 0;
|
|
||||||
int drawAdjCurrentMoveCount = 0;
|
|
||||||
|
|
||||||
bool earlyDraw = false;
|
|
||||||
|
|
||||||
while (!IsGameOver(board, ctx.get())) {
|
while (!IsGameOver(board, ctx.get())) {
|
||||||
SearchResults results = SEARCH::SearchPosition<SEARCH::datagen>(board, SearchParams(), ctx.get());
|
SearchResults results = SEARCH::SearchPosition<SEARCH::datagen>(board, SearchParams(), ctx.get());
|
||||||
|
|
||||||
@@ -175,55 +169,16 @@ static void PlayGames(int id, std::atomic<int>& positions, std::atomic<bool>& st
|
|||||||
game.moves.emplace_back(ScoredMove(results.bestMove.ConvertToViriMoveFormat(),
|
game.moves.emplace_back(ScoredMove(results.bestMove.ConvertToViriMoveFormat(),
|
||||||
UTILS::ConvertToWhiteRelative(board, results.score)));
|
UTILS::ConvertToWhiteRelative(board, results.score)));
|
||||||
|
|
||||||
if (moveNumber >= drawAdjMoveNumber) {
|
|
||||||
if (!results.bestMove.IsCapture() && board.GetPieceType(results.bestMove) != Pawn
|
|
||||||
&& results.score > -drawAdjScore && results.score < drawAdjScore) {
|
|
||||||
drawAdjCurrentMoveCount++;
|
|
||||||
|
|
||||||
if (drawAdjCurrentMoveCount >= drawAdjMoveCount) {
|
|
||||||
earlyDraw = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
drawAdjCurrentMoveCount = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
board.MakeMove(results.bestMove);
|
board.MakeMove(results.bestMove);
|
||||||
moveNumber++;
|
|
||||||
ctx->positionHistory[board.positionIndex] = board.hashKey;
|
ctx->positionHistory[board.positionIndex] = board.hashKey;
|
||||||
|
|
||||||
positions++;
|
positions++;
|
||||||
|
|
||||||
// We are checking after making the move, so that's why it's inversed
|
|
||||||
if (board.sideToMove == Black) {
|
|
||||||
if (safeResults.score >= winAdjScore) {
|
|
||||||
whiteWinAdjCurrentMoveCount++;
|
|
||||||
|
|
||||||
if (whiteWinAdjCurrentMoveCount >= winAdjMoveCount)
|
|
||||||
break;
|
|
||||||
} else if (safeResults.score <= winAdjScore) {
|
|
||||||
blackWinAdjCurrentMoveCount++;
|
|
||||||
} else {
|
|
||||||
whiteWinAdjCurrentMoveCount = 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (safeResults.score >= winAdjScore) {
|
|
||||||
blackWinAdjCurrentMoveCount++;
|
|
||||||
|
|
||||||
if (blackWinAdjCurrentMoveCount >= winAdjMoveCount)
|
|
||||||
break;
|
|
||||||
} else if (safeResults.score <= winAdjScore) {
|
|
||||||
whiteWinAdjCurrentMoveCount++;
|
|
||||||
} else {
|
|
||||||
blackWinAdjCurrentMoveCount = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MOVEGEN::GenerateMoves<All>(board);
|
MOVEGEN::GenerateMoves<All>(board);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!earlyDraw && !SEARCH::IsDraw(board, ctx.get())) {
|
if (!SEARCH::IsDraw(board, ctx.get())) {
|
||||||
wdl = board.sideToMove ? 2 : 0;
|
wdl = board.sideToMove ? 2 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -410,8 +410,6 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
|
|||||||
|
|
||||||
bool notMated = results.score > (-MATE_SCORE + MAX_PLY);
|
bool notMated = results.score > (-MATE_SCORE + MAX_PLY);
|
||||||
|
|
||||||
// We disable pruning in PV nodes in datagen
|
|
||||||
if constexpr(!(mode == datagen && isPV)) {
|
|
||||||
// Late move pruning
|
// Late move pruning
|
||||||
// If we are near a leaf node we prune moves
|
// If we are near a leaf node we prune moves
|
||||||
// that are late in the list
|
// that are late in the list
|
||||||
@@ -436,7 +434,6 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
|
|||||||
&& depth <= 5 && staticEval + fpMargin < alpha && notMated) {
|
&& depth <= 5 && staticEval + fpMargin < alpha && notMated) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Board copy = board;
|
Board copy = board;
|
||||||
bool isLegal = copy.MakeMove(currMove);
|
bool isLegal = copy.MakeMove(currMove);
|
||||||
|
|||||||
Reference in new issue
Block a user