- // Get pieces information
- template <Side AssociatedKing>
- inline void HalfKP<AssociatedKing>::GetPieces(
- const Position& pos, Color perspective,
- PieceSquare** pieces, Square* sq_target_k) {
-
- *pieces = (perspective == BLACK) ?
- pos.eval_list()->piece_list_fb() :
- pos.eval_list()->piece_list_fw();
- const PieceId target = (AssociatedKing == Side::kFriend) ?
- static_cast<PieceId>(PIECE_ID_KING + perspective) :
- static_cast<PieceId>(PIECE_ID_KING + ~perspective);
- *sq_target_k = static_cast<Square>(((*pieces)[target] - PS_W_KING) % SQUARE_NB);
+ // Index of a feature for a given king position and another piece on some square
+ inline IndexType make_index(Color perspective, Square s, Piece pc, Square ksq) {
+ return IndexType(orient(perspective, s) + kpp_board_index[perspective][pc] + PS_END * ksq);