diff --git a/src/Makefile b/src/Makefile
index 53bbc1f4..f57773df 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -36,7 +36,7 @@ PGOBENCH = ./$(EXE) bench 16 1 1000 default time
### Object files
OBJS = benchmark.o bitbase.o bitboard.o endgame.o evaluate.o main.o \
material.o misc.o movegen.o movepick.o pawns.o position.o \
- search.o thread.o timeman.o tt.o uci.o ucioption.o syzygy/tbprobe.o
+ search.o thread.o timeman.o tt.o uci.o ucioption.o
### ==========================================================================
### Section 2. High-level Configuration
@@ -140,7 +140,7 @@ endif
### 3.1 Selecting compiler (default = gcc)
-CXXFLAGS += -Wall -Wcast-qual -fno-exceptions -fno-rtti $(EXTRACXXFLAGS)
+CXXFLAGS += -Wall -Wcast-qual -fno-exceptions -fno-rtti -std=c++11 $(EXTRACXXFLAGS)
LDFLAGS += $(EXTRALDFLAGS)
ifeq ($(COMP),)
@@ -150,7 +150,8 @@ endif
ifeq ($(COMP),gcc)
comp=gcc
CXX=g++
- CXXFLAGS += -ansi -pedantic -Wno-long-long -Wextra -Wshadow
+ CXXFLAGS += -pedantic -Wno-long-long -Wextra -Wshadow
+ LDFLAGS += -Wl,--no-as-needed
endif
ifeq ($(COMP),mingw)
@@ -374,14 +375,14 @@ profile-build:
$(MAKE) ARCH=$(ARCH) COMP=$(COMP) $(profile_prepare)
@echo ""
@echo "Step 1/4. Building executable for benchmark ..."
- @touch *.cpp *.h syzygy/*.cpp syzygy/*.h
+ @touch *.cpp *.h
$(MAKE) ARCH=$(ARCH) COMP=$(COMP) $(profile_make)
@echo ""
@echo "Step 2/4. Running benchmark for pgo-build ..."
@$(PGOBENCH) > /dev/null
@echo ""
@echo "Step 3/4. Building final executable ..."
- @touch *.cpp *.h syzygy/*.cpp syzygy/*.h
+ @touch *.cpp *.h
$(MAKE) ARCH=$(ARCH) COMP=$(COMP) $(profile_use)
@echo ""
@echo "Step 4/4. Deleting profile data ..."
@@ -396,7 +397,7 @@ install:
-strip $(BINDIR)/$(EXE)
clean:
- $(RM) $(EXE) $(EXE).exe *.o .depend *~ core bench.txt *.gcda ./syzygy/*.o ./syzygy/*.gcda
+ $(RM) $(EXE) $(EXE).exe *.o .depend *~ core bench.txt *.gcda
default:
help
@@ -461,7 +462,7 @@ gcc-profile-use:
all
gcc-profile-clean:
- @rm -rf *.gcda *.gcno syzygy/*.gcda syzygy/*.gcno bench.txt
+ @rm -rf *.gcda *.gcno bench.txt
icc-profile-prepare:
$(MAKE) ARCH=$(ARCH) COMP=$(COMP) icc-profile-clean
diff --git a/src/benchmark.cpp b/src/benchmark.cpp
index 605c95ad..cf0a315c 100644
--- a/src/benchmark.cpp
+++ b/src/benchmark.cpp
@@ -17,7 +17,6 @@
along with this program. If not, see .
*/
-#include
#include
#include
#include
@@ -34,7 +33,7 @@ using namespace std;
namespace {
-const char* Defaults[] = {
+const vector Defaults = {
"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
"r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 10",
"8/2p5/3p4/KP5r/1R3p1k/8/4P1P1/8 w - - 0 11",
@@ -108,19 +107,19 @@ void benchmark(const Position& current, istream& is) {
TT.clear();
if (limitType == "time")
- limits.movetime = atoi(limit.c_str()); // movetime is in ms
+ limits.movetime = stoi(limit); // movetime is in ms
else if (limitType == "nodes")
- limits.nodes = atoi(limit.c_str());
+ limits.nodes = stoi(limit);
else if (limitType == "mate")
- limits.mate = atoi(limit.c_str());
+ limits.mate = stoi(limit);
else
- limits.depth = atoi(limit.c_str());
+ limits.depth = stoi(limit);
if (fenFile == "default")
- fens.assign(Defaults, Defaults + 37);
+ fens = Defaults;
else if (fenFile == "current")
fens.push_back(current.fen());
@@ -128,7 +127,7 @@ void benchmark(const Position& current, istream& is) {
else
{
string fen;
- ifstream file(fenFile.c_str());
+ ifstream file(fenFile);
if (!file.is_open())
{
@@ -164,7 +163,7 @@ void benchmark(const Position& current, istream& is) {
}
}
- elapsed = std::max(Time::now() - elapsed, Time::point(1)); // Avoid a 'divide by zero'
+ elapsed = Time::now() - elapsed + 1; // Ensure positivity to avoid a 'divide by zero'
dbg_print(); // Just before to exit
diff --git a/src/endgame.cpp b/src/endgame.cpp
index 2c87b2a1..82a01b12 100644
--- a/src/endgame.cpp
+++ b/src/endgame.cpp
@@ -96,12 +96,9 @@ namespace {
string fen = sides[0] + char(8 - sides[0].length() + '0') + "/8/8/8/8/8/8/"
+ sides[1] + char(8 - sides[1].length() + '0') + " w - - 0 10";
- return Position(fen, false, NULL).material_key();
+ return Position(fen, false, nullptr).material_key();
}
- template
- void delete_endgame(const typename M::value_type& p) { delete p.second; }
-
} // namespace
@@ -128,17 +125,12 @@ Endgames::Endgames() {
add("KRPPKRP");
}
-Endgames::~Endgames() {
- for_each(m1.begin(), m1.end(), delete_endgame);
- for_each(m2.begin(), m2.end(), delete_endgame);
-}
-
-template
+template
void Endgames::add(const string& code) {
- map((Endgame*)0)[key(code, WHITE)] = new Endgame(WHITE);
- map((Endgame*)0)[key(code, BLACK)] = new Endgame(BLACK);
+ map()[key(code, WHITE)] = std::unique_ptr(new Endgame(WHITE));
+ map()[key(code, BLACK)] = std::unique_ptr(new Endgame(BLACK));
}
diff --git a/src/endgame.h b/src/endgame.h
index 8a42eda2..7ff70373 100644
--- a/src/endgame.h
+++ b/src/endgame.h
@@ -21,7 +21,10 @@
#define ENDGAME_H_INCLUDED
#include