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>
25
#include <
libbenbot/eval/TaperedScore.hpp
>
26
#include <
libchess/board/Bitboard.hpp
>
27
#include <vector>
28
29
namespace
ben_bot
{
30
37
struct
PawnEntry
final {
39
std::uint64_t
key
{ UINT64_C(0) };
40
42
chess::board::Bitboard
passers
;
43
45
eval::TaperedScore
score
;
46
};
47
54
class
PawnTable
final {
55
public
:
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
75
private
:
76
std::vector<PawnEntry> entries = std::vector<PawnEntry>(
NumEntries
);
77
};
78
79
}
// namespace ben_bot
Bitboard.hpp
TaperedScore.hpp
ben_bot::PawnTable
Definition
PawnTable.hpp:54
ben_bot::PawnTable::NumEntries
static constexpr auto NumEntries
Definition
PawnTable.hpp:57
ben_bot::PawnTable::probe
auto probe(const std::uint64_t key) noexcept -> PawnEntry &
Definition
PawnTable.hpp:64
ben_bot::PawnTable::clear
void clear() noexcept
Definition
PawnTable.hpp:70
ben_bot
ben_bot::PawnEntry
Definition
PawnTable.hpp:37
ben_bot::PawnEntry::key
std::uint64_t key
Definition
PawnTable.hpp:39
ben_bot::PawnEntry::passers
chess::board::Bitboard passers
Definition
PawnTable.hpp:42
ben_bot::PawnEntry::score
eval::TaperedScore score
Definition
PawnTable.hpp:45
ben_bot::eval::TaperedScore
Definition
TaperedScore.hpp:32
chess::board::Bitboard
Definition
Bitboard.hpp:48
libbenbot
include
libbenbot
data-structures
PawnTable.hpp
Generated on
for BenBot by
1.16.1