@@ -139,51 +139,6 @@ void nn::init() {
139139 memoryIndex += OUTPUT_SIZE * sizeof (int32_t );
140140}
141141
142- int nn::index (bb::PieceType pieceType, bb::Color pieceColor, bb::Square square, bb::Color view,
143- bb::Square kingSquare) {
144- constexpr int pieceTypeFactor = 64 ;
145- constexpr int pieceColorFactor = 64 * 6 ;
146- constexpr int kingSquareFactor = 64 * 6 * 2 ;
147-
148- const bool kingSide = bb::fileIndex (kingSquare) > 3 ;
149- const int ksIndex = kingSquareIndex (kingSquare, view);
150- bb::Square relativeSquare = view == bb::WHITE ? square : bb::mirrorVertically (square);
151-
152- if (kingSide) {
153- relativeSquare = bb::mirrorHorizontally (relativeSquare);
154- }
155-
156- // clang-format off
157- return relativeSquare
158- + pieceType * pieceTypeFactor
159- + (pieceColor == view) * pieceColorFactor
160- + ksIndex * kingSquareFactor;
161- // clang-format on
162- }
163-
164- int nn::kingSquareIndex (bb::Square relativeKingSquare, bb::Color kingColor) {
165- // return zero if there is no king on the board yet ->
166- // requires manual reset
167- if (relativeKingSquare > 63 )
168- return 0 ;
169- // clang-format off
170- constexpr int indices[bb::N_SQUARES] {
171- 0 , 1 , 2 , 3 , 3 , 2 , 1 , 0 ,
172- 4 , 5 , 6 , 7 , 7 , 6 , 5 , 4 ,
173- 8 , 9 , 10 , 11 , 11 , 10 , 9 , 8 ,
174- 8 , 9 , 10 , 11 , 11 , 10 , 9 , 8 ,
175- 12 , 12 , 13 , 13 , 13 , 13 , 12 , 12 ,
176- 12 , 12 , 13 , 13 , 13 , 13 , 12 , 12 ,
177- 14 , 14 , 15 , 15 , 15 , 15 , 14 , 14 ,
178- 14 , 14 , 15 , 15 , 15 , 15 , 14 , 14 ,
179- };
180- // clang-format on
181- if (kingColor == bb::BLACK) {
182- relativeKingSquare = bb::mirrorVertically (relativeKingSquare);
183- }
184- return indices[relativeKingSquare];
185- }
186-
187142
188143void nn::AccumulatorTable::use (bb::Color view, Board* board, nn::Evaluator& evaluator) {
189144 const bb::Square king_sq = bb::bitscanForward (board->getPieceBB (view, bb::KING));
@@ -230,7 +185,6 @@ void nn::AccumulatorTable::use(bb::Color view, Board* board, nn::Evaluator& eval
230185 }
231186
232187 std::memcpy (evaluator.history .back ().summation [view], entry.accumulator .summation [view],sizeof (int16_t ) * HIDDEN_SIZE);
233-
234188}
235189
236190void nn::AccumulatorTable::reset () {
0 commit comments