Pseudo legal #28

Merged
rektdie merged 14 commits from pseudoLegal into main 2025-03-25 14:16:56 +01:00
Showing only changes of commit 3090dbac8b - Show all commits
+7 -1
View File
@@ -137,6 +137,7 @@ static SearchResults Quiescence(Board board, int alpha, int beta, int ply) {
SearchResults results; SearchResults results;
for (int i = 0; i < board.currentMoveIndex; i++) { for (int i = 0; i < board.currentMoveIndex; i++) {
if (!board.IsLegal(board.moveList[i])) continue;
if (board.moveList[i].IsCapture()) { if (board.moveList[i].IsCapture()) {
Board copy = board; Board copy = board;
copy.MakeMove(board.moveList[i]); copy.MakeMove(board.moveList[i]);
@@ -229,14 +230,18 @@ SearchResults PVS(Board board, int depth, int alpha, int beta, int ply) {
int nodeType = AllNode; int nodeType = AllNode;
SearchResults results(-inf); SearchResults results(-inf);
int moveSeen = 0;
// For all moves // For all moves
for (int i = 0; i < board.currentMoveIndex; i++) { for (int i = 0; i < board.currentMoveIndex; i++) {
Move currMove = board.moveList[i]; Move currMove = board.moveList[i];
if (!board.IsLegal(currMove)) continue;
Board copy = board; Board copy = board;
copy.MakeMove(currMove); copy.MakeMove(currMove);
int reductions = GetReductions(board, currMove, depth, i, ply); int reductions = GetReductions(board, currMove, depth, moveSeen, ply);
// First move (suspected PV node) // First move (suspected PV node)
if (!i) { if (!i) {
@@ -260,6 +265,7 @@ SearchResults PVS(Board board, int depth, int alpha, int beta, int ply) {
score = -PVS<isPV>(copy, depth - 1, -beta, -alpha, ply + 1).score; score = -PVS<isPV>(copy, depth - 1, -beta, -alpha, ply + 1).score;
} }
moveSeen++;
positionIndex--; positionIndex--;
// Fail high (beta cutoff) // Fail high (beta cutoff)