io-chess
UCI chess engine
Loading...
Searching...
No Matches
SearchHeuristics.h
Go to the documentation of this file.
1#pragma once
2
11
12#include <array>
13#include <cstdint>
14#include "ISearch.h"
15
24 std::array<std::array<Move, 2>, SearchConstants::MAX_PLY> killers_{};
25 std::array<std::array<int, 64>, 64> history_{};
26 std::array<std::array<Move, 64>, 64> countermove_{};
27 std::array<std::array<std::array<std::array<int, 64>, 16>, 64>, 16> contHist_{};
28 std::array<std::array<int, 64>, 16> captureHist_{};
29
30 std::array<std::array<int16_t, 16384>, 2> pawnCorrHist_{};
31 std::array<std::array<std::array<int16_t, 16384>, 2>, 2> nonPawnCorrHist_{};
32 std::array<std::array<std::array<std::array<int16_t, 64>, 16>, 64>, 16> contCorrHist_{};
33
34 std::array<std::array<Move, SearchConstants::MAX_PLY>, SearchConstants::MAX_PLY> pvTable_{};
35 std::array<int, SearchConstants::MAX_PLY> failHighCount_{};
36
37 // Pre-allocated move generation buffers per ply to avoid vector allocations
38 std::array<std::array<Move, 256>, SearchConstants::MAX_PLY> captures_{};
39 std::array<std::array<int, 256>, SearchConstants::MAX_PLY> captureScores_{};
40 std::array<std::array<Move, 256>, SearchConstants::MAX_PLY> quiets_{};
41 std::array<std::array<int, 256>, SearchConstants::MAX_PLY> quietScores_{};
42 std::array<std::array<Move, 256>, SearchConstants::MAX_PLY> badCaptures_{};
43 std::array<std::array<Move, 256>, SearchConstants::MAX_PLY> searchedQuiets_{};
44};
Search interface and shared data structures.
constexpr int MAX_PLY
Maximum supported plies from root.
Definition Types.h:49
Container for stateful search heuristics and move ordering tables.
Definition SearchHeuristics.h:23
std::array< std::array< Move, SearchConstants::MAX_PLY >, SearchConstants::MAX_PLY > pvTable_
Principal Variation table.
Definition SearchHeuristics.h:34
std::array< std::array< std::array< int16_t, 16384 >, 2 >, 2 > nonPawnCorrHist_
Non-pawn correction history [color][type][nonPawnHash].
Definition SearchHeuristics.h:31
std::array< std::array< Move, 256 >, SearchConstants::MAX_PLY > badCaptures_
Buffer for captures that fail SEE.
Definition SearchHeuristics.h:42
std::array< std::array< int, 64 >, 64 > history_
Standard history heuristic [fromSq][toSq].
Definition SearchHeuristics.h:25
std::array< std::array< Move, 256 >, SearchConstants::MAX_PLY > quiets_
Buffer for generated quiet moves.
Definition SearchHeuristics.h:40
std::array< int, SearchConstants::MAX_PLY > failHighCount_
Count of fail-highs per ply.
Definition SearchHeuristics.h:35
std::array< std::array< int16_t, 16384 >, 2 > pawnCorrHist_
Pawn structure correction history [color][pawnHash].
Definition SearchHeuristics.h:30
std::array< std::array< std::array< std::array< int16_t, 64 >, 16 >, 64 >, 16 > contCorrHist_
Continuation correction history.
Definition SearchHeuristics.h:32
std::array< std::array< Move, 256 >, SearchConstants::MAX_PLY > searchedQuiets_
Buffer for tracking which quiets have been searched.
Definition SearchHeuristics.h:43
std::array< std::array< std::array< std::array< int, 64 >, 16 >, 64 >, 16 > contHist_
Continuation history [prevPiece][prevToSq][piece][toSq].
Definition SearchHeuristics.h:27
std::array< std::array< Move, 2 >, SearchConstants::MAX_PLY > killers_
Killer moves for each ply (up to 2 per ply).
Definition SearchHeuristics.h:24
std::array< std::array< int, 64 >, 16 > captureHist_
Capture history [piece][toSq].
Definition SearchHeuristics.h:28
std::array< std::array< int, 256 >, SearchConstants::MAX_PLY > quietScores_
Scores corresponding to quiet moves.
Definition SearchHeuristics.h:41
std::array< std::array< Move, 64 >, 64 > countermove_
Countermove heuristic [fromSq][toSq].
Definition SearchHeuristics.h:26
std::array< std::array< int, 256 >, SearchConstants::MAX_PLY > captureScores_
Scores corresponding to capture moves.
Definition SearchHeuristics.h:39
std::array< std::array< Move, 256 >, SearchConstants::MAX_PLY > captures_
Buffer for generated capture moves.
Definition SearchHeuristics.h:38