Hi all!
Very small improvement:
don't try verify the "checks" after null move pruning (first ply).
It is unnecessary, because the opponent had to leave the check.
-Tamás
Small improvement
Moderators: hgm, Rebel, chrisw
-
- Posts: 276
- Joined: Sat Mar 04, 2017 12:24 pm
- Location: Hungary
-
- Posts: 2488
- Joined: Tue Aug 30, 2016 8:19 pm
- Full name: Rasmus Althoff
Re: Small improvement
Not sure whether I understand correctly... but when one side leaves check, this can generate check for the other side, isn't that an issue?
-
- Posts: 276
- Joined: Sat Mar 04, 2017 12:24 pm
- Location: Hungary
Re: Small improvement
After null move, the check verify is unnecessary.
If you predefine the outcome of a move, the code is even simpler.
Code: Select all
if (nullOK)
{
TakeNullMove(); // eg: replace side
Score = -AlphaBeta(-beta, -beta+1, depth-4, false, true);
// This call: AlphaBeta -> next node for opponent
// No need to verify again the check at next node
TakeBackNull(); // eg: replace side
if (Score >= beta) {
return Score;
}
}
Code: Select all
function AlphaBeta(alpha, beta, depth, nullMove, afterNullMove) {
......
if (afterNullMove == false) { // Unnecessary after null move (at first node)
inCheck = isCheck();
}
......
}
-
- Posts: 2929
- Joined: Sat Jan 22, 2011 12:42 am
- Location: NL
Re: Small improvement
You can do even better if you test for alignment of the origin (Queen-alignment) and destination (Superpiece or Amazon alignment). If neither matches, the move cannot be a checking move.
-
- Posts: 276
- Joined: Sat Mar 04, 2017 12:24 pm
- Location: Hungary