BenBot 1.7.5
A chess engine
Loading...
Searching...
No Matches
PawnTable.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 <cstddef> // IWYU pragma: keep - for size_t
24#include <cstdint>
27#include <vector>
28
29namespace ben_bot {
30
37struct PawnEntry final {
39 std::uint64_t key { UINT64_C(0) };
40
43
46};
47
54class PawnTable final {
55public:
57 static constexpr auto NumEntries { std::size_t { 1 } << 14uz };
58
59 static_assert((NumEntries & (NumEntries - 1uz)) == 0uz);
60
64 [[nodiscard]] auto probe(const std::uint64_t key) noexcept -> PawnEntry&
65 {
66 return entries[static_cast<std::size_t>(key & (NumEntries - 1uz))];
67 }
68
70 void clear() noexcept
71 {
72 std::ranges::fill(entries, PawnEntry { });
73 }
74
75private:
76 std::vector<PawnEntry> entries = std::vector<PawnEntry>(NumEntries);
77};
78
79} // namespace ben_bot
static constexpr auto NumEntries
Definition PawnTable.hpp:57
auto probe(const std::uint64_t key) noexcept -> PawnEntry &
Definition PawnTable.hpp:64
void clear() noexcept
Definition PawnTable.hpp:70
std::uint64_t key
Definition PawnTable.hpp:39
chess::board::Bitboard passers
Definition PawnTable.hpp:42
eval::TaperedScore score
Definition PawnTable.hpp:45