added SEE test suite
This commit is contained in:
1 parent
e9759245b0
commit
71c3e64e3b
6 files changed
+120
-2
No files matched your search
@@ -6,6 +6,7 @@
|
||||
#include "search.h"
|
||||
#include "datagen.h"
|
||||
#include "nnue.h"
|
||||
#include "tests.h"
|
||||
|
||||
#ifndef EVALFILE
|
||||
#define EVALFILE "./nnue.bin"
|
||||
@@ -50,6 +51,8 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
Board board;
|
||||
|
||||
//TEST::SEE();
|
||||
|
||||
if (argc > 1) {
|
||||
if (std::string(argv[1]) == "bench") {
|
||||
RunBenchmark();
|
||||
|
||||
+1
-1
@@ -132,7 +132,7 @@ static int GetReductions(Board &board, Move &move, int depth, int moveSeen, int
|
||||
return std::clamp(reduction, -1, depth - 1);
|
||||
}
|
||||
|
||||
static bool SEE(Board& board, Move& move, int threshold) {
|
||||
bool SEE(Board& board, Move& move, int threshold) {
|
||||
int from = move.MoveFrom();
|
||||
int to = move.MoveTo();
|
||||
int flags = move.GetFlags();
|
||||
|
||||
+3
-1
@@ -27,7 +27,7 @@ constexpr int inf = 100000;
|
||||
inline int lmrTable[MAX_DEPTH+1][MAX_MOVES];
|
||||
|
||||
constexpr std::array<int, 6> SEEPieceValues = {
|
||||
100, 300, 350, 500, 900, 0
|
||||
100, 300, 300, 500, 900, 0
|
||||
};
|
||||
|
||||
void InitLMRTable();
|
||||
@@ -128,6 +128,8 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
bool SEE(Board& board, Move& move, int threshold);
|
||||
|
||||
template <bool isPV, searchMode mode>
|
||||
SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchContext& ctx, bool cutnode);
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cassert>
|
||||
#include "tests.h"
|
||||
#include "utils.h"
|
||||
#include "search.h"
|
||||
|
||||
namespace TEST {
|
||||
|
||||
void SEE() {
|
||||
std::ifstream file("tests/SEE.txt");
|
||||
std::string line;
|
||||
|
||||
while (std::getline(file, line)) {
|
||||
std::stringstream iss(line);
|
||||
std::cout << line << ' ';
|
||||
Board board;
|
||||
|
||||
std::vector tokens = UTILS::split(line, '|');
|
||||
|
||||
std::string fen = tokens[0];
|
||||
board.SetByFen(fen);
|
||||
|
||||
Move move = UTILS::parseMove(board, tokens[1]);
|
||||
|
||||
int gain = std::stoi(tokens[2]);
|
||||
|
||||
assert(SEARCH::SEE(board, move, gain - 1));
|
||||
assert(SEARCH::SEE(board, move, gain));
|
||||
assert(!SEARCH::SEE(board, move, gain + 1));
|
||||
|
||||
std::cout << "| PASSED" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
namespace TEST {
|
||||
|
||||
void SEE();
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user