BenBot
1.7.5
A chess engine
Loading...
Searching...
No Matches
KillerMoves.hpp
Go to the documentation of this file.
1
/*
2
* ======================================================================================
3
*
4
* ░▒▓███████▓▒░░▒▓████████▓▒░▒▓███████▓▒░ ░▒▓███████▓▒░ ░▒▓██████▓▒░▒▓████████▓▒░
5
* ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░
6
* ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░
7
* ░▒▓███████▓▒░░▒▓██████▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓███████▓▒░░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░
8
* ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░
9
* ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░
10
* ░▒▓███████▓▒░░▒▓████████▓▒░▒▓█▓▒░░▒▓█▓▒░ ░▒▓███████▓▒░ ░▒▓██████▓▒░ ░▒▓█▓▒░
11
*
12
* ======================================================================================
13
*/
14
19
20
#pragma once
21
22
#include <algorithm>
23
#include <array>
24
#include <cassert>
25
#include <cstddef>
// IWYU pragma: keep - for size_t
26
#include <
libbenbot/search/Constants.hpp
>
27
#include <
libchess/moves/Move.hpp
>
28
#include <
libchess/moves/MoveGen.hpp
>
29
#include <span>
30
#include <vector>
31
32
namespace
ben_bot
{
33
34
using
chess::moves::Move;
35
using
std::size_t;
36
43
struct
KillerMoves
final {
45
void
clear
()
46
{
47
for
(
auto
& list : lists)
48
list.clear();
49
}
50
52
void
store
(
const
size_t
plyFromRoot,
const
Move
move)
53
{
54
assert(plyFromRoot <
search::MAX_PLY
);
55
56
auto
& list = lists.at(plyFromRoot);
57
58
if
(not std::ranges::contains(list, move))
59
list.emplace_back(move);
60
}
61
63
[[nodiscard]]
auto
get
(
const
size_t
plyFromRoot)
const
noexcept
-> std::span<const Move>
64
{
65
return
lists.at(plyFromRoot);
66
}
67
68
private
:
69
using
Killers = std::vector<Move>;
70
71
std::array<Killers, search::MAX_PLY + 1uz> lists { };
72
};
73
74
}
// namespace ben_bot
Constants.hpp
MoveGen.hpp
Move.hpp
ben_bot::search::MAX_PLY
constexpr auto MAX_PLY
Definition
Constants.hpp:27
ben_bot
ben_bot::KillerMoves
Definition
KillerMoves.hpp:43
ben_bot::KillerMoves::clear
void clear()
Definition
KillerMoves.hpp:45
ben_bot::KillerMoves::store
void store(const size_t plyFromRoot, const Move move)
Definition
KillerMoves.hpp:52
ben_bot::KillerMoves::get
auto get(const size_t plyFromRoot) const noexcept -> std::span< const Move >
Definition
KillerMoves.hpp:63
chess::moves::Move
Definition
Move.hpp:75
libbenbot
include
libbenbot
data-structures
KillerMoves.hpp
Generated on
for BenBot by
1.16.1