Skip to content

Commit

Permalink
variables reflect real depth limits
Browse files Browse the repository at this point in the history
(mscSNpDepth was both wrong and unused)
  • Loading branch information
nescitus committed Apr 29, 2021
1 parent 36f3691 commit e8d84c8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ sources/.vs/rodent-iv/v15/.suo
sources/.vs/rodent-iv/v15/Browse.VC.db
sources/x64/Release/rodent-iv.iobj
*.log
sources/.vs/rodent-iv/v15/Browse.VC.opendb
2 changes: 1 addition & 1 deletion sources/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ sBook MainBook;
void PrintVersion() {
std::string OutStr;

OutStr = "id name Rodent IV 0.32";
OutStr = "id name Rodent IV 0.33";

#if defined(DEBUG)

Expand Down
1 change: 1 addition & 0 deletions sources/src/rodent.h
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,7 @@ class cEngine {
static const int mscSnpDepth; // max depth at which static null move pruning is applied
static const int mscRazorDepth; // max depth at which razoring is applied
static const int mscFutDepth; // max depth at which futility pruning is applied
static const int mscSingDepth; // min depth at which singular extension is applied
static const int mscSEEmargin; // margin for SEE pruning of bad captures
static int msLmrSize[2][MAX_PLY][MAX_MOVES];

Expand Down
25 changes: 14 additions & 11 deletions sources/src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@ If not, see <http://www.gnu.org/licenses/>.
#include <cstring>
#include <cmath>

const int cEngine::mscSnpDepth = 3; // max depth at which static null move pruning is applied
// bench 16 31281168 nodes searched in 28031, speed 1115909 nps (Score: 2.590)

const int cEngine::mscSnpDepth = 7; // max depth at which static null move pruning is applied
const int cEngine::mscRazorDepth = 4; // max depth at which razoring is applied
const int cEngine::mscFutDepth = 6; // max depth at which futility pruning is applied
const int cEngine::mscSingDepth = 5; // min depth at which singular extension is applied
const int cEngine::mscSEEmargin = 113; // margin for SEE pruning of bad captures (113 means that at depth 2 losing NxP will be accepted)

// this variable controls when evaluation function needs to be called for the sake of pruning
Expand Down Expand Up @@ -442,7 +445,7 @@ int cEngine::SearchRoot(POS *p, int ply, int alpha, int beta, int depth, int *pv
int hashScore = -INF;

bool flagInCheck;
bool flagExtended;
bool isExtended;
bool isPv = (alpha != beta - 1);
bool canSing = false;

Expand Down Expand Up @@ -477,7 +480,7 @@ int cEngine::SearchRoot(POS *p, int ply, int alpha, int beta, int depth, int *pv

// PREPARE FOR SINGULAR EXTENSION, SENPAI-STYLE

if (isPv && depth > 5) {
if (isPv && depth > mscSingDepth) {
if (Trans.Retrieve(p->mHashKey, &singMove, &singScore, &hashFlag, alpha, beta, depth - 4, ply)) {
if (hashFlag & LOWER) {
canSing = true;
Expand Down Expand Up @@ -547,7 +550,7 @@ int cEngine::SearchRoot(POS *p, int ply, int alpha, int beta, int depth, int *pv

// GATHER INFO ABOUT THE MOVE

flagExtended = false;
isExtended = false;
mv_played[movesTried] = move;
movesTried++;
if (!ply && movesTried > 1) mFlRootChoice = true;
Expand All @@ -565,7 +568,7 @@ int cEngine::SearchRoot(POS *p, int ply, int alpha, int beta, int depth, int *pv

if (isPv || depth < 8) {
newDepth += p->InCheck();
flagExtended = true;
isExtended = true;
};

// 2. pawn to 7th rank extension at the tips of pv-line
Expand All @@ -575,18 +578,18 @@ int cEngine::SearchRoot(POS *p, int ply, int alpha, int beta, int depth, int *pv
&& p->TpOnSq(Tsq(move)) == P
&& (SqBb(Tsq(move)) & (RANK_2_BB | RANK_7_BB))) {
newDepth += 1;
flagExtended = true;
isExtended = true;
};

// 3. singular extension, Senpai-style

if (isPv && depth > 5 && move == singMove && canSing && flagExtended == false) {
if (isPv && depth > mscSingDepth && move == singMove && canSing && isExtended == false) {
int new_alpha = -singScore - 50;
int mockPv;
int sc = Search(p, ply + 1, new_alpha, new_alpha + 1, depth - 4, false, -1, -1, &mockPv);
if (sc <= new_alpha) {
newDepth += 1;
flagExtended = true;
isExtended = true;
}
}

Expand Down Expand Up @@ -782,7 +785,7 @@ int cEngine::Search(POS *p, int ply, int alpha, int beta, int depth, bool wasNul

// PREPARE FOR SINGULAR EXTENSION, SENPAI-STYLE

if (isPv && depth > 5) {
if (isPv && depth > mscSingDepth) {
if (Trans.Retrieve(p->mHashKey, &singMove, &singScore, &hashFlag, alpha, beta, depth - 4, ply)) {
if (hashFlag & LOWER) {
canSing = true;
Expand Down Expand Up @@ -833,7 +836,7 @@ int cEngine::Search(POS *p, int ply, int alpha, int beta, int depth, bool wasNul

if (flagPrunableNode
&& Par.searchSkill > 7
&& depth <= 7
&& depth <= mscSnpDepth
&& eval < MAX_EVAL
&& p->MayNull()
&& !wasNull) {
Expand Down Expand Up @@ -1026,7 +1029,7 @@ int cEngine::Search(POS *p, int ply, int alpha, int beta, int depth, bool wasNul
// 4. singular extension, Senpai-style

if (isPv
&& depth > 5
&& depth > mscSingDepth
&& move == singMove
&& canSing) {
int newAlpha = -singScore - 50;
Expand Down

0 comments on commit e8d84c8

Please sign in to comment.