-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Elo | 3.08 +- 2.85 (95%) SPRT | 8.0+0.08s Threads=1 Hash=32MB LLR | 2.95 (-2.94, 2.94) [0.00, 3.00] Games | N: 28020 W: 7042 L: 6794 D: 14184 Penta | [161, 3196, 7111, 3318, 224] http://chess.grantnet.us/test/34932/ Elo | 3.93 +- 3.47 (95%) SPRT | 40.0+0.40s Threads=1 Hash=64MB LLR | 2.95 (-2.94, 2.94) [0.00, 3.00] Games | N: 18664 W: 4634 L: 4423 D: 9607 Penta | [30, 2079, 4928, 2240, 55] http://chess.grantnet.us/test/34934/ bench: 4473743
- Loading branch information
1 parent
f9b341e
commit f152efd
Showing
11 changed files
with
216 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
Seer is a UCI chess engine by Connor McMonigle | ||
Copyright (C) 2021-2023 Connor McMonigle | ||
Seer is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Seer is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <zobrist/util.h> | ||
|
||
#include <algorithm> | ||
#include <array> | ||
#include <cstddef> | ||
#include <random> | ||
#include <utility> | ||
|
||
namespace zobrist { | ||
|
||
namespace detail { | ||
|
||
template <typename T, std::size_t N> | ||
struct zobrist_hash_source_impl { | ||
std::array<T, N> data{}; | ||
|
||
constexpr zobrist_hash_source_impl(zobrist::xorshift_generator generator) noexcept { | ||
for (auto& elem : data) { elem = generator.next(); } | ||
} | ||
}; | ||
|
||
template <typename T, std::size_t N> | ||
inline constexpr zobrist_hash_source_impl<T, N> zobrist_hash_source = zobrist_hash_source_impl<T, N>{xorshift_generator(zobrist::entropy_0)}; | ||
|
||
} // namespace detail | ||
|
||
template <typename T, std::size_t N> | ||
struct zobrist_hasher_impl { | ||
static constexpr T initial_hash_value = T{}; | ||
static constexpr std::size_t feature_cardinality = N; | ||
|
||
template <typename F> | ||
[[nodiscard]] constexpr T compute_hash(F&& indicator_function) const noexcept { | ||
T hash = initial_hash_value; | ||
|
||
#pragma omp simd | ||
for (std::size_t i = 0; i < N; ++i) { | ||
const T mask = static_cast<T>(indicator_function(i)); | ||
hash ^= mask * detail::zobrist_hash_source<T, N>.data[i]; | ||
} | ||
|
||
return hash; | ||
} | ||
}; | ||
|
||
template <typename T, std::size_t N> | ||
inline constexpr zobrist_hasher_impl<T, N> zobrist_hasher = zobrist_hasher_impl<T, N>{}; | ||
|
||
} // namespace zobrist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.