Skip to content

Commit 946a13a

Browse files
committed
Fix potion feature symmetry and update hash
1 parent 1b1629f commit 946a13a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/nnue/features/half_ka_v2_variants.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ namespace Stockfish::Eval::NNUE::Features {
4949
inline IndexType HalfKAv2Variants::make_potion_zone_index(Color perspective, Color potionColor,
5050
Variant::PotionType potion, Square s,
5151
Square ksq, const Position& pos) {
52+
const int relativeColor = static_cast<int>(potionColor != perspective);
5253
const int potionIndex = static_cast<int>(potion)
53-
+ Variant::POTION_TYPE_NB * static_cast<int>(potionColor);
54+
+ Variant::POTION_TYPE_NB * relativeColor;
5455
return IndexType(orient(perspective, s, pos)
5556
+ pos.nnue_potion_zone_index_base()
5657
+ potionIndex * (pos.max_file() + 1) * (pos.max_rank() + 1)
@@ -60,9 +61,9 @@ namespace Stockfish::Eval::NNUE::Features {
6061
inline IndexType HalfKAv2Variants::make_potion_cooldown_index(Color perspective, Color potionColor,
6162
Variant::PotionType potion, int bit,
6263
Square ksq, const Position& pos) {
63-
(void)perspective;
64+
const int relativeColor = static_cast<int>(potionColor != perspective);
6465
const int potionIndex = static_cast<int>(potion)
65-
+ Variant::POTION_TYPE_NB * static_cast<int>(potionColor);
66+
+ Variant::POTION_TYPE_NB * relativeColor;
6667
return IndexType(bit
6768
+ pos.nnue_potion_cooldown_index_base()
6869
+ potionIndex * POTION_COOLDOWN_BITS

src/nnue/features/half_ka_v2_variants.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ namespace Stockfish::Eval::NNUE::Features {
6363

6464
// Hash value embedded in the evaluation file
6565
static constexpr std::uint32_t HashValueNoPotions = 0x5f234cb8u;
66-
static constexpr std::uint32_t HashValueWithPotions = 0x7c2d4f9eu;
66+
static constexpr std::uint32_t HashValueWithPotions = 0x6a8f3c12u;
6767

6868
static std::uint32_t get_hash_value() {
6969
return currentNnueVariant && currentNnueVariant->nnuePotionZoneIndexBase >= 0

0 commit comments

Comments
 (0)