Files
cpl_cpp-project/Search.hpp
2022-12-23 23:57:29 +01:00

40 lines
859 B
C++

#ifndef CHESS_ENGINE_SEARCH_HPP
#define CHESS_ENGINE_SEARCH_HPP
#include "PrincipalVariation.hpp"
#include "Board.hpp"
#include <vector>
#include <limits>
namespace Search {
const int kPosInfinity = std::numeric_limits<int>::max();
const int kNegInfinity = std::numeric_limits<int>::min();
struct Node {
explicit Node(const Move &move) : move(move) {
}
Node(Node &node) : move(node.move) {
next = std::move(node.next);
value = node.value;
}
std::unique_ptr<Node> next;
Move move;
int value = kNegInfinity;
};
struct RootNode {
std::unique_ptr<Node> child;
Board board;
int value = kNegInfinity;
};
int search(Node *node, const Board &board, unsigned depth, int alpha, int beta);
PrincipalVariation start(const Board &board);
int evaluate(const Board &board);
}
#endif //CHESS_ENGINE_SEARCH_HPP