went back to vector for TT #14
No files matched your search
+10
-4
@@ -1,6 +1,7 @@
|
|||||||
#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];
|
||||||
@@ -29,8 +30,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 256 MB
|
|
||||||
constexpr U64 maxHash = (64* 1000000) / sizeof(TTEntry);
|
|
||||||
// 5 MB
|
// 5 MB
|
||||||
constexpr U64 defaultHash = (5 * 1000000) / sizeof(TTEntry);
|
constexpr U64 defaultHash = (5 * 1000000) / sizeof(TTEntry);
|
||||||
|
|
||||||
@@ -40,10 +39,17 @@ constexpr int invalidEntry = 111111;
|
|||||||
|
|
||||||
class TTable {
|
class TTable {
|
||||||
private:
|
private:
|
||||||
std::array<TTEntry, maxHash> table;
|
std::vector<TTEntry> table;
|
||||||
public:
|
public:
|
||||||
|
TTable() : table(hashSize) {};
|
||||||
|
|
||||||
|
void Resize(U64 size) {
|
||||||
|
table.resize(size);
|
||||||
|
}
|
||||||
|
|
||||||
void Clear() {
|
void Clear() {
|
||||||
table.fill(TTEntry{});
|
table.clear();
|
||||||
|
table.resize(hashSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
TTEntry* GetRawEntry(U64 &hashKey) {
|
TTEntry* GetRawEntry(U64 &hashKey) {
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user