Skip to content

Commit

Permalink
Lmr at root (#15)
Browse files Browse the repository at this point in the history
* Testing LMR at the root, again

* Testing removing the 4 ply depth minimum for root lmr

* LMR at root does not activate for the first few moves as we care more about what the best move is and less about the actual score

* Updated version number

Make also no longer calls clean by default
  • Loading branch information
rosenthj committed May 26, 2019
1 parent 0a0f1e6 commit e2a4144
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ SOURCES=$(wildcard src/general/*.cc src/learning/*.cc src/*.cc)
OBJECTS=$(SOURCES:.cc=.o)
EXECUTABLE:=Winter

all: $(SOURCES) $(EXECUTABLE) clean
all: $(SOURCES) $(EXECUTABLE)

target no_bmi: CFLAGS += -DNO_BMI
no_bmi: all

target ancient: CFLAGS=-c -O3 -Wall -Wno-sign-compare -m64 -DNO_BMI -std=c++11 -Isrc -Isrc/general -Isrc/learning
target ancient: CFLAGS=-c -DNDEBUG -O3 -Wall -Wno-sign-compare -m64 -DNO_BMI -std=c++11 -Isrc -Isrc/general -Isrc/learning
target ancient: LDFLAGS=-Wall -static
ancient: all

target old: CFLAGS=-c -O3 -Wall -Wno-sign-compare -m64 -msse4.2 -DNO_BMI -std=c++11 -Isrc -Isrc/general -Isrc/learning
target old: CFLAGS=-c -DNDEBUG -O3 -Wall -Wno-sign-compare -m64 -msse4.2 -DNO_BMI -std=c++11 -Isrc -Isrc/general -Isrc/learning
target old: LDFLAGS=-Wall -static
old: all

target new: CFLAGS=-c -O3 -Wall -Wno-sign-compare -m64 -mavx2 -mbmi -mbmi2 -std=c++11 -Isrc -Isrc/general -Isrc/learning
target new: CFLAGS=-c -DNDEBUG -O3 -Wall -Wno-sign-compare -m64 -mavx2 -mbmi -mbmi2 -std=c++11 -Isrc -Isrc/general -Isrc/learning
target new: LDFLAGS=-Wall -static
new: all

Expand Down
2 changes: 1 addition & 1 deletion src/general/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
namespace settings {

const std::string engine_name = "Winter";
const std::string engine_version = "0.5.8";
const std::string engine_version = "0.6";
const std::string engine_author = "Jonathan Rosenthal";

const int kNumClusters = 4;
Expand Down
15 changes: 10 additions & 5 deletions src/search.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,7 @@ Score RootSearchLoop(Thread &t, Score original_alpha, Score beta, Depth current_
}
alpha = -1;
}
const bool in_check = t.board.InCheck();
for (size_t i = 0; i < moves.size(); ++i) {
t.set_move(moves[i]);
t.board.Make(moves[i]);
Expand All @@ -1124,11 +1125,15 @@ Score RootSearchLoop(Thread &t, Score original_alpha, Score beta, Depth current_
lower_bound_score = std::max(score, lower_bound_score);
}
else {
// Depth reduction = 0;
// if (!in_check && !board.InCheck() && GetMoveType(moves[i]) <= kDoublePawnMove) {
// reduction = get_lmr_reduction<kPV>(current_depth, i) / 2;
// }
Score score = -AlphaBeta<NodeType::kNW, Mode>(t, -(alpha + 1), -alpha, current_depth - 1);
Depth reduction = 0;
if (!in_check && !t.board.InCheck() && i > 2) {
//Late Move Reduction factor
reduction = get_lmr_reduction<NodeType::kPV>(current_depth, i - 2);
if (GetMoveType(moves[i]) > kDoublePawnMove) {
reduction = (2 * reduction) / 3;
}
}
Score score = -AlphaBeta<NodeType::kNW, Mode>(t, -(alpha + 1), -alpha, current_depth - 1 - reduction);
if (score > alpha) {
score = -AlphaBeta<NodeType::kPV, Mode>(t, -beta, -alpha, current_depth - 1);
}
Expand Down

0 comments on commit e2a4144

Please sign in to comment.