added UCI setoption command for Hash | bench 4118297
This commit is contained in:
1 parent
5635e7deaa
commit
4312b2be0e
3 files changed
+17
-7
No files matched your search
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
static U64 initialSeed = 0x60919C48E57863B9;
|
static U64 initialSeed = 0x60919C48E57863B9;
|
||||||
|
|
||||||
TTEntry TTable[hashSize];
|
|
||||||
|
|
||||||
// 2[colors] * 6[pieces] * 64[squares]
|
// 2[colors] * 6[pieces] * 64[squares]
|
||||||
U64 zKeys[2][6][64];
|
U64 zKeys[2][6][64];
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -1,9 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "search.h"
|
#include "search.h"
|
||||||
|
#include <vector>
|
||||||
// 5 MB
|
|
||||||
constexpr int hashSize = 0x500000;
|
|
||||||
|
|
||||||
// 2[colors] * 6[pieces] * 64[squares]
|
// 2[colors] * 6[pieces] * 64[squares]
|
||||||
extern U64 zKeys[2][6][64];
|
extern U64 zKeys[2][6][64];
|
||||||
@@ -28,7 +26,9 @@ public:
|
|||||||
Move bestMove;
|
Move bestMove;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern TTEntry TTable[hashSize];
|
// 5 MB
|
||||||
|
inline int hashSize = 5000000 / sizeof(TTEntry);
|
||||||
|
inline std::vector<TTEntry> TTable(hashSize);
|
||||||
|
|
||||||
SearchResults ReadEntry(U64 &hashKey, int depth, int alpha, int beta);
|
SearchResults ReadEntry(U64 &hashKey, int depth, int alpha, int beta);
|
||||||
void WriteEntry(U64 &hashKey, int depth, int score, int nodeType, Move besteMove);
|
void WriteEntry(U64 &hashKey, int depth, int score, int nodeType, Move besteMove);
|
||||||
+13
-1
@@ -8,6 +8,7 @@
|
|||||||
#include "search.h"
|
#include "search.h"
|
||||||
#include "benchmark.h"
|
#include "benchmark.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include "tt.h"
|
||||||
|
|
||||||
Move ParseMove(Board &board, const char* moveString) {
|
Move ParseMove(Board &board, const char* moveString) {
|
||||||
GenerateMoves(board, board.sideToMove);
|
GenerateMoves(board, board.sideToMove);
|
||||||
@@ -155,6 +156,13 @@ void ParseGo(Board &board, std::string &command) {
|
|||||||
worker.detach();
|
worker.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void SetOption(std::string &command) {
|
||||||
|
if (command.find("Hash") != std::string::npos) {
|
||||||
|
hashSize = (ReadParam("Hash", command) * 1000000) / sizeof(TTEntry);
|
||||||
|
TTable.resize(hashSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void UCILoop(Board &board) {
|
void UCILoop(Board &board) {
|
||||||
// reset STDIN & STDOUT buffers
|
// reset STDIN & STDOUT buffers
|
||||||
setbuf(stdin, NULL);
|
setbuf(stdin, NULL);
|
||||||
@@ -223,12 +231,16 @@ void UCILoop(Board &board) {
|
|||||||
// print engine info
|
// print engine info
|
||||||
std::cout << "id name Eleanor\n";
|
std::cout << "id name Eleanor\n";
|
||||||
std::cout << "id name rektdie\n";
|
std::cout << "id name rektdie\n";
|
||||||
std::cout << "option name Hash type spin default 1 min 1 max 1\n";
|
std::cout << "option name Hash type spin default 5 min 1 max 256\n";
|
||||||
std::cout << "option name Threads type spin default 1 min 1 max 1\n";
|
std::cout << "option name Threads type spin default 1 min 1 max 1\n";
|
||||||
std::cout << "uciok\n";
|
std::cout << "uciok\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (input.find("setoption") != std::string::npos) {
|
||||||
|
SetOption(input);
|
||||||
|
}
|
||||||
|
|
||||||
// Handling non-UCI "bench" command
|
// Handling non-UCI "bench" command
|
||||||
if (input.find("bench") != std::string::npos) {
|
if (input.find("bench") != std::string::npos) {
|
||||||
RunBenchmark();
|
RunBenchmark();
|
||||||
|
|||||||
Reference in new issue
Block a user