feat(official-bots): implement king-relative (HalfKP) encoding in NNUE (NCS-109) #80
Reference in New Issue
Block a user
Delete Branch "feat/NCS-116-perspective-flip"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Training: for Black-to-move positions, mirror the board (ranks flipped, colours swapped) before feature extraction so the model always sees the position from the side-to-move's perspective. Eval label is negated to match. Implemented in fen_to_features (board.mirror()) and __getitem__ (' b ' check in FEN string). Inference (legacy evaluate()): applies the same flip for Black so the model receives features in the format it was trained on. The scoreFromOutput negation converts back to White's absolute perspective. Incremental accumulator path is unchanged — it uses the raw HalfKP features with the existing sign-negation at output; the quality gain comes from the richer training distribution. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>