Remove classical evaluation since the introduction of NNUE (first released with Stockfish 12), we have maintained the classical evaluation as part of SF in frozen form. The idea that this code could lead to further inputs to the NN or search did not materialize. Now, after five releases, this PR removes the classical evaluation from SF. Even though this evaluation is probably the best of its class, it has become unimportant for the engine's strength, and there is little need to maintain this code (roughly 25% of SF) going forward, or to expend resources on trying to improve its integration in the NNUE eval. Indeed, it had still a very limited use in the current SF, namely for the evaluation of positions that are nearly decided based on material difference, where the speed of the classical evaluation outweights its inaccuracies. This impact on strength is small, roughly 2Elo, and probably decreasing in importance as the TC grows. Potentially, removal of this code could lead to the development of techniques to have faster, but less accurate NN evaluation, for certain positions. STC https://tests.stockfishchess.org/tests/view/64a320173ee09aa549c52157 Elo: -2.35 ± 1.1 (95%) LOS: 0.0% Total: 100000 W: 24916 L: 25592 D: 49492 Ptnml(0-2): 287, 12123, 25841, 11477, 272 nElo: -4.62 ± 2.2 (95%) PairsRatio: 0.95 LTC https://tests.stockfishchess.org/tests/view/64a320293ee09aa549c5215b Elo: -1.74 ± 1.0 (95%) LOS: 0.0% Total: 100000 W: 25010 L: 25512 D: 49478 Ptnml(0-2): 44, 11069, 28270, 10579, 38 nElo: -3.72 ± 2.2 (95%) PairsRatio: 0.96 VLTC SMP https://tests.stockfishchess.org/tests/view/64a3207c3ee09aa549c52168 Elo: -1.70 ± 0.9 (95%) LOS: 0.0% Total: 100000 W: 25673 L: 26162 D: 48165 Ptnml(0-2): 8, 9455, 31569, 8954, 14 nElo: -3.95 ± 2.2 (95%) PairsRatio: 0.95 closes https://github.com/official-stockfish/Stockfish/pull/4674 Bench: 1444646
Unify type alias declarations The commit unifies the declaration of type aliases by replacing all typedefs with corresponding using statements. closing https://github.com/official-stockfish/Stockfish/pull/4412 No functional change
Update copyright years Happy New Year! closes https://github.com/official-stockfish/Stockfish/pull/4315 No functional change
Update copyright years Happy New Year! closes https://github.com/official-stockfish/Stockfish/pull/3881 No functional change
Add Stockfish namespace. fixes #3350 and is a small cleanup that might make it easier to use SF in separate projects, like a NNUE trainer or similar. closes https://github.com/official-stockfish/Stockfish/pull/3370 No functional change.
Update copyright years No functional change
Add NNUE evaluation This patch ports the efficiently updatable neural network (NNUE) evaluation to Stockfish. Both the NNUE and the classical evaluations are available, and can be used to assign a value to a position that is later used in alpha-beta (PVS) search to find the best move. The classical evaluation computes this value as a function of various chess concepts, handcrafted by experts, tested and tuned using fishtest. The NNUE evaluation computes this value with a neural network based on basic inputs. The network is optimized and trained on the evalutions of millions of positions at moderate search depth. The NNUE evaluation was first introduced in shogi, and ported to Stockfish afterward. It can be evaluated efficiently on CPUs, and exploits the fact that only parts of the neural network need to be updated after a typical chess move. [The nodchip repository](https://github.com/nodchip/Stockfish) provides additional tools to train and develop the NNUE networks. This patch is the result of contributions of various authors, from various communities, including: nodchip, ynasu87, yaneurao (initial port and NNUE authors), domschl, FireFather, rqs, xXH4CKST3RXx, tttak, zz4032, joergoster, mstembera, nguyenpham, erbsenzaehler, dorzechowski, and vondele. This new evaluation needed various changes to fishtest and the corresponding infrastructure, for which tomtor, ppigazzini, noobpwnftw, daylen, and vondele are gratefully acknowledged. The first networks have been provided by gekkehenker and sergiovieri, with the latter net (nn-97f742aaefcd.nnue) being the current default. The evaluation function can be selected at run time with the `Use NNUE` (true/false) UCI option, provided the `EvalFile` option points the the network file (depending on the GUI, with full path). The performance of the NNUE evaluation relative to the classical evaluation depends somewhat on the hardware, and is expected to improve quickly, but is currently on > 80 Elo on fishtest: 60000 @ 10+0.1 th 1 https://tests.stockfishchess.org/tests/view/5f28fe6ea5abc164f05e4c4c ELO: 92.77 +-2.1 (95%) LOS: 100.0% Total: 60000 W: 24193 L: 8543 D: 27264 Ptnml(0-2): 609, 3850, 9708, 10948, 4885 40000 @ 20+0.2 th 8 https://tests.stockfishchess.org/tests/view/5f290229a5abc164f05e4c58 ELO: 89.47 +-2.0 (95%) LOS: 100.0% Total: 40000 W: 12756 L: 2677 D: 24567 Ptnml(0-2): 74, 1583, 8550, 7776, 2017 At the same time, the impact on the classical evaluation remains minimal, causing no significant regression: sprt @ 10+0.1 th 1 https://tests.stockfishchess.org/tests/view/5f2906a2a5abc164f05e4c5b LLR: 2.94 (-2.94,2.94) {-6.00,-4.00} Total: 34936 W: 6502 L: 6825 D: 21609 Ptnml(0-2): 571, 4082, 8434, 3861, 520 sprt @ 60+0.6 th 1 https://tests.stockfishchess.org/tests/view/5f2906cfa5abc164f05e4c5d LLR: 2.93 (-2.94,2.94) {-6.00,-4.00} Total: 10088 W: 1232 L: 1265 D: 7591 Ptnml(0-2): 49, 914, 3170, 843, 68 The needed networks can be found at https://tests.stockfishchess.org/nns It is recommended to use the default one as indicated by the `EvalFile` UCI option. Guidelines for testing new nets can be found at https://github.com/glinscott/fishtest/wiki/Creating-my-first-test#nnue-net-tests Integration has been discussed in various issues: https://github.com/official-stockfish/Stockfish/issues/2823 https://github.com/official-stockfish/Stockfish/issues/2728 The integration branch will be closed after the merge: https://github.com/official-stockfish/Stockfish/pull/2825 https://github.com/official-stockfish/Stockfish/tree/nnue-player-wip closes https://github.com/official-stockfish/Stockfish/pull/2912 This will be an exciting time for computer chess, looking forward to seeing the evolution of this approach. Bench: 4746616
small cleanups closes https://github.com/official-stockfish/Stockfish/pull/2695 No functional change
Small cleanups closes https://github.com/official-stockfish/Stockfish/pull/2628 No functional change
Scale up space weight with number of blocked pawns This idea is loosely based on stockfish losses in closed positions in different tournaments. Space weight symmetrically increases for both sides the more blocked position is. passed STC https://tests.stockfishchess.org/tests/view/5e919eefaf0a0143109dc8ce LLR: 2.94 (-2.94,2.94) {-0.50,1.50} Total: 16994 W: 3389 L: 3172 D: 10433 Ptnml(0-2): 277, 1931, 3918, 2040, 331 passed LTC https://tests.stockfishchess.org/tests/view/5e91d04faf0a0143109dc8ea LLR: 2.94 (-2.94,2.94) {0.25,1.75} Total: 133386 W: 17316 L: 16763 D: 99307 Ptnml(0-2): 945, 12407, 39524, 12784, 1033 closes https://github.com/official-stockfish/Stockfish/pull/2626 Bench: 4966867
Update lists of authors and contributors Preparing for version 11 of Stockfish: update lists of authors, contributors giving CPU time to the fishtest framework, etc. No functional change
Improve signature of evaluate_shelter() Remove one parameter in function evaluate_shelter(), making all comparisons for castled/uncastled shelter locally in do_king_safety(). Also introduce BlockedStorm penalty. Passed non-regression test at STC: LLR: 2.95 (-2.94,2.94) [-3.00,1.00] Total: 65864 W: 14630 L: 14596 D: 36638 http://tests.stockfishchess.org/tests/view/5d5fc80c0ebc5939d09f0acc No functional change
Increase pawns cache (#2187) Increase size of the pawns table by the factor 8. This decreases the number of recalculations of pawn structure information significantly (at least at LTC). I have done measurements for different depths and pawn cache sizes. First are given the number of pawn entry calculations are done (in parentheses is the frequency that a call to probe triggers a pawn entry calculation). The delta% are the percentage of less done pawn entry calculations in comparison to master VSTC: bench 1 1 12 STC: bench 8 1 16 LTC: bench 64 1 20 VLTC: bench 512 1 24 VSTC STC LTC VLTC master 82218(6%) 548935(6%) 2415422(7%) 9548071(7%) pawncache*2 79859(6%) 492943(5%) 2084794(6%) 8275206(6%) pawncache*4 78551(6%) 458758(5%) 1827770(5%) 7112531(5%) pawncache*8 77963(6%) 439421(4%) 1649169(5%) 6128652(4%) delta%(p2-m) -2.9% -10.2% -13.7% -13.3% delta%(p4-m) -4.5% -16.4% -24.3% -25.5% delta%(p8-m) -5.2% -20.0% -31.7% -35.8% STC: (non-regression test because at STC the effect is smaller than at LTC) LLR: 2.96 (-2.94,2.94) [-3.00,1.00] Total: 22767 W: 5160 L: 5040 D: 12567 http://tests.stockfishchess.org/tests/view/5d00f6040ebc5925cf09c3e2 LTC: LLR: 2.94 (-2.94,2.94) [0.00,4.00] Total: 26340 W: 4524 L: 4286 D: 17530 http://tests.stockfishchess.org/tests/view/5d00a3810ebc5925cf09ba16 No functional change.
Assorted trivial cleanups 5/2019 No functional change. bench: 4178282
Simplify WeakUnopposedPawn #2181 This is a functional simplification. Moves WeakUnopposedPawn to pawns.cpp and remove piece dependency. STC LLR: 2.95 (-2.94,2.94) [-3.00,1.00] Total: 8699 W: 2000 L: 1853 D: 4846 http://tests.stockfishchess.org/tests/view/5cf7721b0ebc5925cf08ee79 LTC LLR: 2.96 (-2.94,2.94) [-3.00,1.00] Total: 46605 W: 7969 L: 7890 D: 30746 http://tests.stockfishchess.org/tests/view/5cf7d5f70ebc5925cf08fa96
Add eg component to evaluate_shelter() #2137 Add an endgame component to the blockedstorm penalty so that the penalty applies more uniformly through the game. STC 10+0.1 th 1 : LLR: -2.95 (-2.94,2.94) [0.50,4.50] Total: 94063 W: 21426 L: 21118 D: 51519 http://tests.stockfishchess.org/tests/view/5cd4605c0ebc5925cf04bf43 LTC 60+0.6 th 1 : LLR: 2.95 (-2.94,2.94) [0.00,3.50] Total: 188232 W: 32808 L: 32090 D: 123334 http://tests.stockfishchess.org/tests/view/5cd47d0a0ebc5925cf04c4fd Refactored code with higher constant values gave a more convincing LTC result: LLR: 2.96 (-2.94,2.94) [0.00,3.50] Total: 30050 W: 5330 L: 5066 D: 19654 http://tests.stockfishchess.org/tests/view/5cd6a0000ebc5925cf050653 Bench: 3687700
Assorted trivial cleanups 4/2019 No functional change.
Move pawnsOnSquares to Position (#2100) We can remove the values in Pawns if we just use the piece arrays in Position. This reduces the size of a pawn entry. This simplification passed individually, and in concert with ps_passedcount100 (removes passedCount storage in pawns.). STC LLR: 2.95 (-2.94,2.94) [-3.00,1.00] Total: 19957 W: 4529 L: 4404 D: 11024 http://tests.stockfishchess.org/tests/view/5cb3c2d00ebc5925cf016f0d Combo STC LLR: 2.95 (-2.94,2.94) [-3.00,1.00] Total: 17368 W: 3925 L: 3795 D: 9648 http://tests.stockfishchess.org/tests/view/5cb3d3510ebc5925cf01709a This is a non-functional simplification.
Calculate passedCount real-time #2099 This is a non-functional simplification which removes the passedCount variable in pawns. STC LLR: 2.95 (-2.94,2.94) [-3.00,1.00] Total: 27982 W: 6227 L: 6118 D: 15637 http://tests.stockfishchess.org/tests/view/5cb3cdd30ebc5925cf017025 Combo STC LLR: 2.95 (-2.94,2.94) [-3.00,1.00] Total: 17368 W: 3925 L: 3795 D: 9648 http://tests.stockfishchess.org/tests/view/5cb3d3510ebc5925cf01709a Non functional test.
Remove semiopenFiles in pawns and simplify space #2102 This is a functional simplification. 1. semiopenFiles is removed in pawns and uses the piece arrays in position instead. 2. popcount is removed in space calculations and uses pawn piece count instead. STC LLR: 2.96 (-2.94,2.94) [-3.00,1.00] Total: 33327 W: 7423 L: 7324 D: 18580 http://tests.stockfishchess.org/tests/view/5cb4be090ebc5925cf018511 LTC LLR: 2.96 (-2.94,2.94) [-3.00,1.00] Total: 10173 W: 1774 L: 1636 D: 6763 http://tests.stockfishchess.org/tests/view/5cb4c5920ebc5925cf018696 bench 3402947