encapsulated doingNullMove
This commit is contained in:
1 parent
bd5f5ac602
commit
3f9ad117ac
2 files changed
+4
-5
No files matched your search
+3
-5
@@ -10,11 +10,9 @@
|
||||
|
||||
namespace SEARCH {
|
||||
|
||||
U64 nodes = 0;
|
||||
U64 nodesToGo = 0;
|
||||
|
||||
static inline int timeToSearch = 0;
|
||||
static inline bool doingNullMove = false;
|
||||
|
||||
inline PVLine pvLine;
|
||||
|
||||
@@ -252,15 +250,15 @@ SearchResults PVS(Board board, int depth, int alpha, int beta, int ply, SearchCo
|
||||
}
|
||||
|
||||
// Null Move Pruning
|
||||
if (!doingNullMove && staticEval >= beta) {
|
||||
if (!ctx.doingNullMove && staticEval >= beta) {
|
||||
if (depth >= 3 && !board.InPossibleZug()) {
|
||||
Board copy = board;
|
||||
bool isLegal = copy.MakeMove(Move());
|
||||
// Always legal so we dont check it
|
||||
|
||||
doingNullMove = true;
|
||||
ctx.doingNullMove = true;
|
||||
int score = -PVS<false, mode>(copy, depth - 3, -beta, -beta + 1, ply + 1, ctx).score;
|
||||
doingNullMove = false;
|
||||
ctx.doingNullMove = false;
|
||||
|
||||
if (searchStopped) return 0;
|
||||
if (score >= beta) return score;
|
||||
|
||||
@@ -109,6 +109,7 @@ public:
|
||||
class SearchContext {
|
||||
public:
|
||||
U64 nodes = 0;
|
||||
bool doingNullMove = false;
|
||||
|
||||
SearchContext(){}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user