io-chess
UCI chess engine
Loading...
Searching...
No Matches
FeatureExtractor.cpp File Reference

Implementation of standard feature extraction. More...

#include "FeatureExtractor.hpp"
#include <algorithm>
#include <cstring>
Include dependency graph for FeatureExtractor.cpp:

Classes

struct  ChebTable

Functions

template<chess::PieceType::underlying PT>
constexpr int get_index ()
template<chess::Color::underlying US>
static void fill_input_impl (const chess::Board &board, ChessInput &out)

Variables

static constexpr uint8_t VAL_MAX = 255
static constexpr uint8_t VAL_ON = 255
static const auto CHEBYSHEV

Detailed Description

Implementation of standard feature extraction.

Function Documentation

◆ fill_input_impl()

template<chess::Color::underlying US>
void fill_input_impl ( const chess::Board & board,
ChessInput & out )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_index()

template<chess::PieceType::underlying PT>
int get_index ( )
constexpr
Here is the caller graph for this function:

Variable Documentation

◆ CHEBYSHEV

const auto CHEBYSHEV
static
Initial value:
= []() {
ChebTable t{};
for (int sq1 = 0; sq1 < 64; ++sq1) {
int r1 = sq1 / 8, c1 = sq1 % 8;
for (int sq2 = 0; sq2 < 64; ++sq2) {
int r2 = sq2 / 8, c2 = sq2 % 8;
int dist = std::max(std::abs(r1 - r2), std::abs(c1 - c2));
uint8_t val = static_cast<uint8_t>(dist * 36);
t.data[0][sq1][sq2] = val;
}
for (int out_sq = 0; out_sq < 64; ++out_sq) {
int out_r = out_sq / 8;
int out_c = out_sq % 8;
int sq2 = (7 - out_r) * 8 + out_c;
int r2 = sq2 / 8, c2 = sq2 % 8;
int dist = std::max(std::abs(r1 - r2), std::abs(c1 - c2));
uint8_t val = static_cast<uint8_t>(dist * 36);
t.data[1][sq1][out_sq] = val;
}
}
return t;
}()
Definition FeatureExtractor.cpp:13
uint8_t data[2][64][64]
Definition FeatureExtractor.cpp:14

◆ VAL_MAX

uint8_t VAL_MAX = 255
staticconstexpr

◆ VAL_ON

uint8_t VAL_ON = 255
staticconstexpr