From a23918ab8dd0ee1769ab328c4b0cbb760891dc2a Mon Sep 17 00:00:00 2001 From: rektdie Date: Wed, 15 May 2024 00:32:57 +0200 Subject: [PATCH] enabled compiler optimizations + sped up search a little bit --- Makefile | 4 ++-- source/main.cpp | 7 ++----- source/search.cpp | 9 +++++---- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 0412a89..7a0eca2 100644 --- a/Makefile +++ b/Makefile @@ -17,11 +17,11 @@ OBJS := $(addprefix $(OBJ_DIR)/, $(notdir $(SRCS:.cpp=.o))) # Target executable Eleanor$(EXE_EXT): $(OBJS) - g++ -o $@ $^ + g++ -o $@ $^ -O3 # Rule to compile source files to object files $(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp $(SRC_DIR)/types.h | $(OBJ_DIR) - g++ -c -o $@ $< + g++ -c -o $@ $< -O3 # Create the object directory if it doesn't exist $(OBJ_DIR): diff --git a/source/main.cpp b/source/main.cpp index 996e312..4505175 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -1,8 +1,5 @@ -#include -#include "types.h" #include "board.h" #include "movegen.h" -#include "perft.h" #include "uci.h" int main() { @@ -11,7 +8,7 @@ int main() { Board board; - UCILoop(board); + UCILoop(board); return 0; -} \ No newline at end of file +} diff --git a/source/search.cpp b/source/search.cpp index d4569fc..d45339f 100644 --- a/source/search.cpp +++ b/source/search.cpp @@ -40,6 +40,11 @@ int Quiescence(Board board, int alpha, int beta) { } int NegaMax(Board board, int depth, int alpha, int beta, bool isRoot) { + if (depth == 0) { + return Quiescence(board, -50000, 50000); + //return Evaluate(board); + } + GenerateMoves(board, board.sideToMove); if (board.moveList.size() == 0) { @@ -50,10 +55,6 @@ int NegaMax(Board board, int depth, int alpha, int beta, bool isRoot) { } } - if (depth == 0) { - return Quiescence(board, -50000, 50000); - //return Evaluate(board); - } int max = -50000;