fixed ucinewgame command, makefile bug in linux

This commit is contained in:
rektdie committed 2025-03-11 09:35:03 +01:00
1 parent 4b1ce8f8ea
commit 8e6b8db124
5 files changed
+16 -21

No files matched your search

+3 -3
View File
@@ -42,6 +42,6 @@ $(OBJ_DIR):
# Clean up build artifacts # Clean up build artifacts
.PHONY: clean .PHONY: clean
clean: clean:
$(RM) $(OBJ_DIR) 2>nul || $(DEL) $(OBJ_DIR)\* $(OBJ_DIR) 2>nul $(RM) $(OBJ_DIR) || $(DEL) $(OBJ_DIR)\* $(OBJ_DIR)
$(RM) $(EXE)$(EXE_EXT) 2>nul || $(DEL) $(EXE)$(EXE_EXT) 2>nul $(RM) $(EXE)$(EXE_EXT) || $(DEL) $(EXE)$(EXE_EXT)
$(MAKE) $(MAKE)
+1 -1
View File
@@ -320,4 +320,4 @@ void SearchPosition(Board &board, SearchParams params) {
void StopSearch() { void StopSearch() {
searchStopped = true; searchStopped = true;
} }
+3 -3
View File
@@ -55,8 +55,8 @@ public:
} }
void Clear() { void Clear() {
length[maxDepth] = {}; length[maxDepth - 1] = {};
table[maxDepth][maxDepth] = {}; table[maxDepth - 1][maxDepth - 1] = {};
} }
}; };
@@ -73,4 +73,4 @@ constexpr int moveScoreTable[6][6] = {
100, 200, 300, 400, 500, 600 100, 200, 300, 400, 500, 600
}; };
void ListScores(Board &board); void ListScores(Board &board);
+9 -13
View File
@@ -1,7 +1,6 @@
#pragma once #pragma once
#include "board.h" #include "board.h"
#include "search.h" #include "search.h"
#include <vector>
// 2[colors] * 6[pieces] * 64[squares] // 2[colors] * 6[pieces] * 64[squares]
extern U64 zKeys[2][6][64]; extern U64 zKeys[2][6][64];
@@ -30,24 +29,21 @@ public:
} }
}; };
// 256 MB
constexpr U64 maxHash = (256 * 1000000) / sizeof(TTEntry);
constexpr U64 defaultHash = (5 * 1000000) / sizeof(TTEntry);
// 5 MB // 5 MB
inline int hashSize = (5 * 1000000) / sizeof(TTEntry); inline U64 hashSize = defaultHash;
constexpr int invalidEntry = 111111; constexpr int invalidEntry = 111111;
class TTable { class TTable {
private: private:
std::vector<TTEntry> table; std::array<TTEntry, maxHash> table;
public: public:
TTable() {
table.reserve(hashSize);
}
void Resize(int size) {
table.resize(size);
}
void Clear() { void Clear() {
table.clear(); table.fill(TTEntry{});
} }
TTEntry* GetRawEntry(U64 &hashKey) { TTEntry* GetRawEntry(U64 &hashKey) {
@@ -71,4 +67,4 @@ public:
void WriteEntry(U64 &hashKey, int depth, int score, int nodeType, Move besteMove); void WriteEntry(U64 &hashKey, int depth, int score, int nodeType, Move besteMove);
}; };
inline TTable TT; inline TTable TT;
-1
View File
@@ -165,7 +165,6 @@ void ParseGo(Board &board, std::string &command) {
static void SetOption(std::string &command) { static void SetOption(std::string &command) {
if (command.find("Hash") != std::string::npos) { if (command.find("Hash") != std::string::npos) {
hashSize = (ReadParam("value", command) * 1000000) / sizeof(TTEntry); hashSize = (ReadParam("value", command) * 1000000) / sizeof(TTEntry);
TT.Resize(hashSize);
} }
} }