mirror of
https://github.com/sockspls/badfish
synced 2025-05-01 01:03:09 +00:00

The index order in kpp_board_index[][] is reversed to be more optimal for the access pattern STC https://tests.stockfishchess.org/tests/view/5fbd74f967cbf42301d6b24f LLR: 2.93 (-2.94,2.94) {-1.25,0.25} Total: 27504 W: 2686 L: 2607 D: 22211 Ptnml(0-2): 84, 2001, 9526, 2034, 107 closes https://github.com/official-stockfish/Stockfish/pull/3233 No functional change
59 lines
2.3 KiB
C++
59 lines
2.3 KiB
C++
/*
|
|
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
|
|
Copyright (C) 2004-2020 The Stockfish developers (see AUTHORS file)
|
|
|
|
Stockfish 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.
|
|
|
|
Stockfish 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/>.
|
|
*/
|
|
|
|
//Definition of input features HalfKP of NNUE evaluation function
|
|
|
|
#ifndef NNUE_FEATURES_HALF_KP_H_INCLUDED
|
|
#define NNUE_FEATURES_HALF_KP_H_INCLUDED
|
|
|
|
#include "../../evaluate.h"
|
|
#include "features_common.h"
|
|
|
|
namespace Eval::NNUE::Features {
|
|
|
|
// Feature HalfKP: Combination of the position of own king
|
|
// and the position of pieces other than kings
|
|
template <Side AssociatedKing>
|
|
class HalfKP {
|
|
|
|
public:
|
|
// Feature name
|
|
static constexpr const char* kName = "HalfKP(Friend)";
|
|
// Hash value embedded in the evaluation file
|
|
static constexpr std::uint32_t kHashValue =
|
|
0x5D69D5B9u ^ (AssociatedKing == Side::kFriend);
|
|
// Number of feature dimensions
|
|
static constexpr IndexType kDimensions =
|
|
static_cast<IndexType>(SQUARE_NB) * static_cast<IndexType>(PS_END);
|
|
// Maximum number of simultaneously active features
|
|
static constexpr IndexType kMaxActiveDimensions = 30; // Kings don't count
|
|
// Trigger for full calculation instead of difference calculation
|
|
static constexpr TriggerEvent kRefreshTrigger = TriggerEvent::kFriendKingMoved;
|
|
|
|
// Get a list of indices for active features
|
|
static void AppendActiveIndices(const Position& pos, Color perspective,
|
|
IndexList* active);
|
|
|
|
// Get a list of indices for recently changed features
|
|
static void AppendChangedIndices(const Position& pos, const DirtyPiece& dp, Color perspective,
|
|
IndexList* removed, IndexList* added);
|
|
};
|
|
|
|
} // namespace Eval::NNUE::Features
|
|
|
|
#endif // #ifndef NNUE_FEATURES_HALF_KP_H_INCLUDED
|