1
0
Fork 0
Commit Graph

341 Commits (3542033342f15625f808013b69aa8c2d274a2f91)

Author SHA1 Message Date
FauziAkram af935365e3 Tuned pawn values
Passed STC:
https://tests.stockfishchess.org/tests/view/5f2aa49fa5abc164f05e4d1b
LLR: 2.95 (-2.94,2.94) {-0.50,1.50}
Total: 40888 W: 7977 L: 7726 D: 25185
Ptnml(0-2): 665, 4806, 9333, 4893, 747

Passed LTC:
https://tests.stockfishchess.org/tests/view/5f2b1059b3ebe5cbfee85ae7
LLR: 2.98 (-2.94,2.94) {0.25,1.75}
Total: 51264 W: 6445 L: 6134 D: 38685
Ptnml(0-2): 328, 4564, 15580, 4789, 371

closes https://github.com/official-stockfish/Stockfish/pull/2920

bench: 4314943
2020-08-07 08:57:37 +02:00
nodchip 84f3e86790 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
2020-08-06 16:37:45 +02:00
FauziAkram 804a29c738 Connected / blocked pawns simplification
There is no need to score blocked pawns at many places.
The idea originated from: Rocky
Tuning and testing by: Fauzi

Passed STC:
https://tests.stockfishchess.org/tests/view/5f04f8fd59f6f035328945d4
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 6352 W: 1299 L: 1118 D: 3935
Ptnml(0-2): 89, 695, 1469, 792, 131

Passed LTC:
https://tests.stockfishchess.org/tests/view/5f0527bd59f6f035328945e3
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 27648 W: 3517 L: 3433 D: 20698
Ptnml(0-2): 177, 2561, 8301, 2571, 214

closes https://github.com/official-stockfish/Stockfish/pull/2799

Bench: 4734746
2020-07-09 21:57:13 +02:00
Stefan Geschwentner 7225d254f9 Add a rank based bonus for blocked pawns.
Fix for overevaluated blocked pawns on the 5th and 6th rank.
This is a rewrite of the original idea that uses only two parameters.
Thanks to rocky640 for pointing this out.

STC:
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 50800 W: 9707 L: 9446 D: 31647
Ptnml(0-2): 831, 5851, 11822, 6018, 878
https://tests.stockfishchess.org/tests/view/5f00b4f359f6f03532894304

LTC:
LLR: 2.93 (-2.94,2.94) {0.25,1.75}
Total: 52064 W: 6477 L: 6167 D: 39420
Ptnml(0-2): 331, 4628, 15834, 4878, 361
https://tests.stockfishchess.org/tests/view/5f0115fe59f6f03532894345

closes https://github.com/official-stockfish/Stockfish/pull/2794

Bench: 4882833
2020-07-06 17:56:18 +02:00
Alain SAVARD 268c00b648 Use arrays
for safe checks, outposts and king protectors in evaluate.cpp

Tested for non regression on the safe checks
https://tests.stockfishchess.org/tests/view/5ef8b75c020eec13834a9596
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 22256 W: 4283 L: 4143 D: 13830
Ptnml(0-2): 291, 2439, 5588, 2459, 351

Tested for non regression on the safe checks, outposts and king protectors
https://tests.stockfishchess.org/tests/view/5ef8e543020eec13834a95e7
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 28400 W: 5382 L: 5253 D: 17765
Ptnml(0-2): 394, 3078, 7119, 3223, 386

closes https://github.com/official-stockfish/Stockfish/pull/2785

No functional change
2020-07-03 21:06:36 +02:00
Joost VandeVondele ab5cd8340f Small cleanups
closes https://github.com/official-stockfish/Stockfish/pull/2756

No functional change
2020-06-24 22:20:04 +02:00
Joost VandeVondele 6f15e7fab2 small cleanups
closes https://github.com/official-stockfish/Stockfish/pull/2695

No functional change
2020-06-21 15:22:20 +02:00
ElbertoOne 8c3d9d996a Isolated pawns tweak
Give opposed doubled isolated pawns only the Doubled penalty.
The other isolated pawns get the Isolated penalty and the WeakUnopposed penalty.
The popcount condition has been replaced with an opposed check,
which is non-functional, but probably gives a speed-up.

Passed STC (https://tests.stockfishchess.org/tests/view/5ed0f0f0042fa6d77c3552f5):
LLR: 2.96 (-2.94,2.94) {-0.50,1.50}
Total: 121832 W: 23562 L: 23195 D: 75075
Ptnml(0-2): 2092, 14064, 28313, 14279, 2168

LTC: (https://tests.stockfishchess.org/tests/view/5ed22e40042fa6d77c355387)
LLR: 2.96 (-2.94,2.94) {0.25,1.75}
Total: 103368 W: 13232 L: 12768 D: 77368
Ptnml(0-2): 693, 9484, 30919, 9842, 746

closes https://github.com/official-stockfish/Stockfish/pull/2706

Bench: 4085694
2020-06-01 17:27:29 +02:00
protonspring a5e3b4edde Consolidate all attacks bitboards
This is a non-functional simplification that simplifies getting attacks bitboards.

* consolidates all attacks to attacks_bb (remove Position::attacks_from(..)).
* attacks_bb<PieceType>(square) gets pseudo attacks
* attacks_bb<PieceType>(square, bitboard) gets attacks considering occupied squares in the bitboard).
* pawn_attacks_bb(Color, Square) gets pawn attacks like other pawn attack bitboards.
* Wraps all access to PawnAttacks arrays and PseudoAttacks arrays and adds asserts as appropriate.

Passed STC
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 90208 W: 17533 L: 17482 D: 55193
Ptnml(0-2): 1412, 10232, 21798, 10217, 1445
https://tests.stockfishchess.org/tests/view/5ece996275787cc0c05d9790

closes https://github.com/official-stockfish/Stockfish/pull/2703

No functional change
2020-05-30 20:30:31 +02:00
xoto10 fb8095718b In BlockedStorm, theirPawns includes ones attacked by us.
Pawns heading towards our king tend to be dangerous whether or not we are attacking them so remove this test.

STC:
LLR: 2.93 (-2.94,2.94) {-1.50,0.50}
Total: 91184 W: 18196 L: 18137 D: 54851
Ptnml(0-2): 1580, 10656, 21092, 10653, 1611
https://tests.stockfishchess.org/tests/view/5ecc3f7080f2c838b9655841

LTC:
LLR: 2.93 (-2.94,2.94) {-1.50,0.50}
Total: 14152 W: 2045 L: 1937 D: 10170
Ptnml(0-2): 99, 1325, 4130, 1413, 109
https://tests.stockfishchess.org/tests/view/5ecc4f3180f2c838b9655861

closes https://github.com/official-stockfish/Stockfish/pull/2702

Bench 4828973
2020-05-26 07:11:59 +02:00
Moez Jellouli 7f2c8a2b81 Remove attacked pawns from storm evaluation
STC:
LLR: 2.96 (-2.94,2.94) {-0.50,1.50}
Total: 54456 W: 11009 L: 10737 D: 32710
Ptnml(0-2): 929, 6326, 12523, 6444, 1006
https://tests.stockfishchess.org/tests/view/5ec962e4404591b2793008a5

LTC:
LLR: 2.94 (-2.94,2.94) {0.25,1.75}
Total: 62448 W: 9018 L: 8664 D: 44766
Ptnml(0-2): 462, 5928, 18121, 6220, 493
https://tests.stockfishchess.org/tests/view/5ec976a8a586eee45aa2ab40

Non regression STC with "noob_3moves.epd" opening book
LLR: 3.81 (-2.94,2.94) {-1.50,0.50}
Total: 91896 W: 17770 L: 17653 D: 56473
Ptnml(0-2): 1598, 10782, 21124, 10793, 1651
https://tests.stockfishchess.org/tests/view/5ec9b83ea586eee45aa2ab96

closes https://github.com/official-stockfish/Stockfish/pull/2698

Bench 4488597
2020-05-25 22:15:13 +02:00
ElbertoOne 81c58855e4 Remove and replace DoubledIsolated penalty by Doubled
The values for both penalties were very close, so DoubledIsolated can be removed and replaced by Doubled.

Passed STC (simplification): https://tests.stockfishchess.org/tests/view/5ec7c18e2a585b485af54407
LLR: 2.97 (-2.94,2.94) {-1.50,0.50}
Total: 105360 W: 20175 L: 20136 D: 65049
Ptnml(0-2): 1803, 12230, 24572, 12275, 1800

Passed LTC:
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 15440 W: 1978 L: 1877 D: 11585
Ptnml(0-2): 92, 1405, 4667, 1422, 134

closes https://github.com/official-stockfish/Stockfish/pull/2696

Bench: 4668875
2020-05-23 22:10:14 +02:00
Joost VandeVondele 383b12e1a5 small cleanups
closes https://github.com/official-stockfish/Stockfish/pull/2653

No functional change
2020-05-23 13:27:16 +02:00
Stefan Geschwentner cdf5cfdb92 Add doubled isolated pawn penalty.
This patch gives an additional penalty if a doubled isolated pawn is stopped
only by a single opponent pawn on the same file. Thanks to NKONSTANTAKIS,
who shared this idea on the forum!

https://groups.google.com/forum/?fromgroups=#!topic/fishcooking/vC4Qn-PMlS4.

STC:
LLR: 2.96 (-2.94,2.94) {-0.50,1.50}
Total: 84872 W: 16688 L: 16370 D: 51814
Ptnml(0-2): 1507, 9940, 19274, 10158, 1557
https://tests.stockfishchess.org/tests/view/5ec65bd955202b947dc5d4ac

LTC:
LLR: 2.93 (-2.94,2.94) {0.25,1.75}
Total: 58104 W: 7614 L: 7278 D: 43212
Ptnml(0-2): 411, 5369, 17196, 5625, 451
https://tests.stockfishchess.org/tests/view/5ec6e9f2c23f5b0710632b19

Closes https://github.com/official-stockfish/Stockfish/pull/2694

Bench: 5148950
2020-05-22 20:40:24 +02:00
Joost VandeVondele 353e20674b Small cleanups
closes https://github.com/official-stockfish/Stockfish/pull/2628

No functional change
2020-04-29 17:44:24 +02:00
protonspring bde1506ba5 Simplify minPawnDistance
This is a functional simplification which fixes an awkward numerical cliff.

With master king_safety, no pawns is scored higher than pawn(s) that is/are far from the king. This may motivate SF to throw away pawns to increase king safety. With this patch, there is a consistent value for minPawnDistance where losing a pawn never increases king safety.

STC
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 45548 W: 8624 L: 8525 D: 28399
Ptnml(0-2): 592, 4937, 11587, 5096, 562
https://tests.stockfishchess.org/tests/view/5e98ced630be947a14e9ddc5

LTC
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 42084 W: 5292 L: 5242 D: 31550
Ptnml(0-2): 193, 3703, 13252, 3649, 245
https://tests.stockfishchess.org/tests/view/5e98e22e30be947a14e9de07

closes https://github.com/official-stockfish/Stockfish/pull/2639

bench 4600292
2020-04-18 15:29:24 +02:00
Vizvezdenec ca4e399ea6 Space bonus and number of blocked pawns
This patch refines the recently introduced interaction between
the space bonus and the number of blocked pawns in a position.

* pawns count as blocked also if their push square is attacked by 2 enemy pawns;
* overall dependence is stronger as well as offset;
* bonus increase is capped at 9 blocked pawns in position;

passed STC
https://tests.stockfishchess.org/tests/view/5e94560663d105aebbab243d
LLR: 2.96 (-2.94,2.94) {-0.50,1.50}
Total: 29500 W: 5842 L: 5603 D: 18055
Ptnml(0-2): 504, 3443, 6677, 3562, 564

passed LTC
https://tests.stockfishchess.org/tests/view/5e95b383c2aaa99f75d1a14d
LLR: 2.95 (-2.94,2.94) {0.25,1.75}
Total: 63504 W: 8329 L: 7974 D: 47201
Ptnml(0-2): 492, 5848, 18720, 6197, 495

closes https://github.com/official-stockfish/Stockfish/pull/2631

bench 4956028
2020-04-15 08:29:20 +02:00
Stefan Geschwentner 5c58f67126 less bonus for blocked connected pawn
Use less bonus for blocked connected pawns so closed positions are less worth.

STC:
LLR: 2.96 (-2.94,2.94) {-0.50,1.50}
Total: 60004 W: 11904 L: 11619 D: 36481
Ptnml(0-2): 1066, 7083, 13535, 7136, 1182
https://tests.stockfishchess.org/tests/view/5e941a8063d105aebbab23e3

LTC:
LLR: 2.95 (-2.94,2.94) {0.25,1.75}
Total: 36606 W: 4831 L: 4556 D: 27219
Ptnml(0-2): 252, 3353, 10872, 3520, 306
https://tests.stockfishchess.org/tests/view/5e9444b963d105aebbab2427

closes https://github.com/official-stockfish/Stockfish/pull/2629

Bench: 4961260
2020-04-14 08:01:53 +02:00
Vizvezdenec db59696aaf 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
2020-04-13 09:16:54 +02:00
Lolligerhans d7a2d5a445 Remove candidate passers w/o feasible lever
+-------+
| o . . | o  their pawns
| x . . | x  our pawns
| . x . | <- Can sacrifice to create passer?
+-------+
   yes

    1         2         3         4         5
+-------+ +-------+ +-------+ +-------+ +-------+
| o . . | | o r . | | o r . | | o . b | | o . b |  lowercase: theirs
| x b . | | x . . | | x . R | | x . R | | x . . |  uppercase: ours
| . x . | | . x . | | . x . | | . x . | | . x B |
+-------+ +-------+ +-------+ +-------+ +-------+
   no        no        yes       no        yes

The value of our top pawn depends on our ability to advance our bottom
pawn, levering their blocker. Previously, this pawn configuration was
always scored as passer (although a blocked one).

Add requirements for the square s above our (possibly) sacrificed pawn:
- s must not be occupied by them (1).
- If they attack s (2), we must attack s (3).
- If they attack s with a minor (4), we must attack s with a minor (5).
The attack from their blocker is ignored because it is inherent in the
structure; we are ok with sacrificing our bottom pawn.

LTC
LLR: 2.95 (-2.94,2.94) {0.25,1.75}
Total: 37030 W: 4962 L: 4682 D: 27386
Ptnml(0-2): 266, 3445, 10863, 3625, 316
https://tests.stockfishchess.org/tests/view/5e92a2b4be6ede5b954bf239

STC
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 40874 W: 8066 L: 7813 D: 24995
Ptnml(0-2): 706, 4753, 9324, 4890, 764
https://tests.stockfishchess.org/tests/view/5e922199af0a0143109dc90e

closes https://github.com/official-stockfish/Stockfish/pull/2624

Bench: 4828294
2020-04-13 08:50:25 +02:00
Joost VandeVondele f83cb95740 Small cleanups
closes https://github.com/official-stockfish/Stockfish/pull/2606

No functional change
2020-04-12 20:30:08 +02:00
Joost VandeVondele 209e94203f Small cleanups
https://github.com/official-stockfish/Stockfish/pull/2584

No functional change.
2020-03-30 22:46:07 +02:00
Vizvezdenec f2430bf034 Count only the most advanced passed pawn for each file.
This patch adjusts definition of passed pawns - if there is a pawn of our color in the same file in front of a current pawn it's no longer counts as passed.

passed STC
https://tests.stockfishchess.org/tests/view/5e802037e42a5c3b3ca2ed07
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 215296 W: 41843 L: 41341 D: 132112
Ptnml(0-2): 3688, 25313, 49304, 25495, 3848

passed LTC
https://tests.stockfishchess.org/tests/view/5e806441e42a5c3b3ca2ed2b
LLR: 2.95 (-2.94,2.94) {0.25,1.75}
Total: 74050 W: 9761 L: 9379 D: 54910
Ptnml(0-2): 510, 6838, 22025, 7064, 588

closes https://github.com/official-stockfish/Stockfish/pull/2602

bench: 4902237
2020-03-29 19:48:01 +02:00
protonspring 47be966d30 Equations for edges and corners.
This is a functional simplification that removes the large arrays in endgames.cpp.
It also fixes a recently introduced bug (960d59d541) in KNBvK,
now using flip_file() instead of ~.

One fen added to bench to increase endgame coverage.

STC
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 174724 W: 33325 L: 33404 D: 107995
Ptnml(0-2): 2503, 19607, 43181, 19608, 2463
http://tests.stockfishchess.org/tests/view/5e6448ffe42a5c3b3ca2e287

LTC
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 35640 W: 4679 L: 4621 D: 26340
Ptnml(0-2): 189, 2991, 11424, 3005, 211
http://tests.stockfishchess.org/tests/view/5e650b24e42a5c3b3ca2e2d8

closes https://github.com/official-stockfish/Stockfish/pull/2577

Bench: 5527957
2020-03-09 22:16:26 +01:00
Gary Heckman 37e3863927 Fix ambiguity between clamp implementations
There is an ambiguity between global and std clamp implementations when compiling in c++17,
and on certain toolchains that are not strictly conforming to c++11.
This is solved by putting our clamp implementation in a namespace.

closes https://github.com/official-stockfish/Stockfish/pull/2572

No functional change.
2020-03-07 11:14:27 +01:00
Alain SAVARD 09bef14c76 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
2020-01-09 01:43:47 +01:00
FauziAkram 97a0e4e817 UnblockedStorm tuned
STC
http://tests.stockfishchess.org/tests/view/5de155980294ec4750cba9bd
LLR: 2.96 (-2.94,2.94) [0.00,4.00]
Total: 60206 W: 13295 L: 12895 D: 34016

LTC
http://tests.stockfishchess.org/tests/view/5de22f6f0294ec4750cba9e7
LLR: 2.95 (-2.94,2.94) [0.00,3.50]
Total: 182005 W: 29571 L: 28902 D: 123532

VLTC
http://tests.stockfishchess.org/tests/view/5de4adca5e868d334be516c1
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 42101 W: 6068 L: 5978 D: 30055

Bench: 5122362
2019-12-03 00:27:58 +01:00
protonspring 6f3796adaf Consolidate pawn_push and up
This is a non-functional simplification. Pawn_push and Up are redundant.
If we make up pawn_push, we can use it for all of the Up's and Down's.
In this version, I've also left the Up and Down constants so that there
is no worse readability.

STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 23878 W: 5202 L: 5085 D: 13591
http://tests.stockfishchess.org/tests/view/5db5569a0ebc5902d6b14de4

Closes https://github.com/official-stockfish/Stockfish/pull/2378

No functional change
2019-10-31 17:22:09 +01:00
Stéphane Nicolet 90c0385724 Assorted trivial cleanups
- Cleanups by Alain
- Group king attacks and king defenses
- Signature of futility_move_count()
- Use is_discovery_check_on_king()
- Simplify backward definition
- Use static asserts in move generator
- Factor a statement in move generator

No functional change
2019-10-26 00:29:12 +02:00
Alain SAVARD 7264540107 Adjust pawn span
Run as a simplification

a) insures that pawn attacks are always included in the pawn span
  (this "fixes" the case where some outpost or reachable outpost
  bonus were awarded on squares controlled by enemy pawns).

b) compute the full span only if not "backward" or not "blocked".

By looking at "blocked" instead of "opposed", we get a nice simpli-
fication and the "new" outpost detection is almost identical, except
a few borderline cases on rank 4.

passed STC
http://tests.stockfishchess.org/tests/view/5d9950730ebc5902b6cefb90
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 79113 W: 17168 L: 17159 D: 44786

passed LTC
http://tests.stockfishchess.org/tests/view/5d99d14e0ebc5902b6cf0692
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 41286 W: 6819 L: 6731 D: 27736

See https://github.com/official-stockfish/Stockfish/pull/2348

bench: 3812891
2019-10-07 00:50:54 +02:00
Stéphane Nicolet 328bdd0947 Fix compare function in previous patch
Bench: 4012371
2019-10-05 11:15:24 +02:00
mstembera 5d1568632c Remove temporary shelter array
Remove temporary array of shelters and avoid iterating over it each time to find
if the shelter values after castling are better than the current value.
Work done on top of https://github.com/official-stockfish/Stockfish/pull/2277

Speed benchmark did not measure any difference.

No functional change
2019-10-05 10:45:37 +02:00
Moez Jellouli e6f4b5f463 More accurate pawn attack span definition
Tweak the pawn attack span for backward pawns and the zone behind
opponent opposing pawns. This is important in positional play and
one of weaknesses of the engine in recent high level games.

STC
LLR: -2.95 (-2.94,2.94) [0.50,4.50]
Total: 66843 W: 14884 L: 14717 D: 37242
http://tests.stockfishchess.org/tests/view/5d8dcb1b0ebc590f3beb2956

LTC
LLR: 2.96 (-2.94,2.94) [0.00,3.50]
Total: 77699 W: 12993 L: 12602 D: 52104
http://tests.stockfishchess.org/tests/view/5d8de9bc0ebc590f3beb3d00

See discussion in https://github.com/official-stockfish/Stockfish/pull/2332

Bench: 4012371
2019-10-02 13:37:00 +02:00
Stéphane Nicolet 667d24f227 Increase weight for supported pawns
This patch changes the weight for counting supports of pawns
from 17 to 21. Hopefully Stockfish will accept to play a bit
more of closed or semi-closed positions.

STC:
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 13822 W: 3158 L: 2939 D: 7725
http://tests.stockfishchess.org/tests/view/5d89c3a10ebc595091802379

LTC:
LLR: 2.96 (-2.94,2.94) [0.00,4.00]
Total: 63066 W: 10590 L: 10236 D: 42240
http://tests.stockfishchess.org/tests/view/5d89ca7f0ebc595091802680

Future work: try to tweak the evaluation to better understand
the French structures.

Closes https://github.com/official-stockfish/Stockfish/pull/2326

Bench: 3618154
2019-09-24 12:54:02 +02:00
nickpelling d232a4ae68 Clarify the mapping of files to queenside
This patch replaces the obscure expressions mapping files ABCDEFGH to ABCDDCBA
by explicite calls to an auxiliary function:

  old:   f = min(f, ~f)
  new:   f = map_to_queenside(f)

We used the Golbolt web site (https://godbolt.org) to check that the current
code for the auxiliary function is optimal.

STC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 30292 W: 6756 L: 6651 D: 16885
http://tests.stockfishchess.org/tests/view/5d8676720ebc5971531d6aa1

Achieved with a bit of help from Sopel97, snicolet and vondele, thanks everyone!
Closes https://github.com/official-stockfish/Stockfish/pull/2325

No functional change
2019-09-24 10:05:54 +02:00
Stéphane Nicolet 302e0f70c6 Revert "Clarify the mapping of files to queenside"
This reverts commit 7756344d5d.
2019-09-23 09:10:28 +02:00
Stéphane Nicolet 7756344d5d Clarify the mapping of files to queenside
Author: @nickpelling

We replace in the code the obscure expressions mapping files ABCDEFGH to ABCDDCBA
by an explicite call to an auxiliary function :

  old:   f = min(f, ~f)
  new:   f = map_to_queenside(f)

We used the Golbolt web site (https://godbolt.org) to find the optimal code
for the auxiliary function.

STC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 30292 W: 6756 L: 6651 D: 16885
http://tests.stockfishchess.org/tests/view/5d8676720ebc5971531d6aa1

No functional change
2019-09-23 08:54:20 +02:00
protonspring 7e4c3256aa Simplify connected pawn scoring
When scoring the connected pawns, replace the intricate ternary expressions
choosing the coefficient by a simpler addition of boolean conditions:

` value = Connected * (2 + phalanx - opposed) `

This is the map showing the old coefficients and the new ones:

```
phalanx and unopposed:     3x   -> 3x
phalanx and opposed:       1.5x -> 2x
not phalanx and unopposed: 2x   -> 2x
not phalanx and opposed:   1x   -> 1x
```

STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 11354 W: 2579 L: 2437 D: 6338
http://tests.stockfishchess.org/tests/view/5d8151f00ebc5971531d244f

LTC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 41221 W: 7001 L: 6913 D: 27307
http://tests.stockfishchess.org/tests/view/5d818f930ebc5971531d26d6

Bench: 3959889

blah
2019-09-23 07:12:32 +02:00
protonspring 270b241ec1 Simplify Weak Lever
This is a simplification that integrated WeakLever into doubled pawns.
Since we already check for !support for Doubled pawns, it is trivial
to check for weak lever by just checking more_than_one(lever).

We also introduce the Score * bool operation overload to remove some
casts in the code.

STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 26757 W: 5842 L: 5731 D: 15184
http://tests.stockfishchess.org/tests/view/5d77ee220ebc5902d384e5a4

Closes https://github.com/official-stockfish/Stockfish/pull/2295

No functional change
2019-09-12 09:44:40 +02:00
protonspring d799529b48 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
2019-08-24 08:21:30 +02:00
protonspring 3984b8f8f0 Consolidate CastlingSide and CastlingRights
This is a non-functional simplification that removes CastlingSide and
implements the functionality in CastlingRights (thanks to Jörg Oster
for a comment on the first version of this patch).

STC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 53854 W: 12077 L: 12019 D: 29758
http://tests.stockfishchess.org/tests/view/5d517b940ebc5925cf107474

Closes https://github.com/official-stockfish/Stockfish/pull/2265

No functional change
2019-08-23 16:29:29 +02:00
Alain SAVARD 7efc39d683 Assorted trivial cleanups (July 2019)
No functional change
2019-08-14 22:15:48 +02:00
protonspring d980d7c0d4 Simplify weak lever
STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 14844 W: 3347 L: 3212 D: 8285
http://tests.stockfishchess.org/tests/view/5d3a2d7b0ebc5925cf0f1632

LTC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 55261 W: 9374 L: 9309 D: 36578
http://tests.stockfishchess.org/tests/view/5d3a3d9e0ebc5925cf0f1786

Closes https://github.com/official-stockfish/Stockfish/pull/2257

bench: 3484124
2019-07-28 19:48:57 +02:00
Alain SAVARD 33c3a04653 Pawn clean up
Non functional simplification when we find the passed pawns in pawn.cpp
and some code clean up. It also better follows the pattern "flag the pawn"
and "score the pawn".

-------------------------

The idea behind the third condition for candidate passed pawn is a little
bit difficult to visualize. Just for the record, the idea is the following:

Consider White e5 d4 against black e6. d4 can (in some endgames) push
to d5 and lever e6. Thanks to this sacrifice, or after d5xe6, we consider
e5 as "passed".

However:
- if White e5/d4 against black e6/c6: d4 cannot safely push to d5 since d5 is double attacked;
- if White e5/d4 against black e6/d5: d4 cannot safely push to d5 since it is occupied.

This is exactly what the following expression does:

```
   && (shift<Up>(support) & ~(theirPawns | dblAttackThem)))
```

--------------------------

http://tests.stockfishchess.org/tests/view/5d3325bb0ebc5925cf0e6e91
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 124666 W: 27586 L: 27669 D: 69411

Closes https://github.com/official-stockfish/Stockfish/pull/2255

No functional change
2019-07-25 09:05:08 +02:00
31m059 82d66f6b72 Exclude passed pawns from Attacked2Unsupported
We recently added a bonus for double pawn attacks on unsupported enemy pawns,
on June 27. However, it is possible that the unsupported pawn may become a passer
by simply pushing forward out of the double attack. By rewarding double attacks,
we may inadvertently reward the creation of enemy passers, by encouraging both of
our would-be stoppers to attack the enemy pawn even if there is no opposing
friendly pawn on the same file.

Here, we revise this term to exclude passed pawns. In order to simplify the code
with this change included, we non-functionally rewrite Attacked2Unsupported to
be a penalty for enemy attacks on friendly pawns, rather than a bonus for our
attacks on enemy pawns. This allows us to exclude passed pawns with a simple
& ~e->passedPawns[Us], while passedPawns[Them] is not yet defined in this part
of the code.

This dramatically reduces the proportion of positions in which Attacked2Unsupported
is applied, to about a third of the original. To compensate, maintaining the same
average effect across our bench positions, we nearly triple Attacked2Unsupported
from S(0, 20) to S(0, 56). Although this pawn formation is rare, it is worth more
than half a pawn in the endgame!

STC: (stopped automatically by fishtest after 250,000 games)
LLR: -0.87 (-2.94,2.94) [0.50,4.50]
Total: 250000 W: 56585 L: 55383 D: 138032
http://tests.stockfishchess.org/tests/view/5d25795e0ebc5925cf0cfb51

LTC:
LLR: 2.96 (-2.94,2.94) [0.00,3.50]
Total: 81038 W: 13965 L: 13558 D: 53515
http://tests.stockfishchess.org/tests/view/5d25f3920ebc5925cf0d10dd

Closes https://github.com/official-stockfish/Stockfish/pull/2233

Bench: 3765158
2019-07-11 23:05:28 +02:00
Marco Costalba 4ae5a7b45a Assorted trivial cleanups June 2019
No functional change.
2019-07-11 12:22:20 +02:00
protonspring 93349d0dbd Use score instead of array to evaluate shelter
This is a non-functional simplification. Instead of an array of values, just use a Score.

STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 16309 W: 3673 L: 3541 D: 9095
http://tests.stockfishchess.org/tests/view/5d24f3b80ebc5925cf0ceb5b

No functional change
2019-07-11 11:42:08 +02:00
protonspring 79d06d8840 Move storm special condition to UnblockedStorm array (#2210)
This is a functional simplification.

Looks like we can accommodate the special initialization of Value in evaluate_shelter in the UnblockedStorm array.

STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 32483 W: 7422 L: 7322 D: 17739
http://tests.stockfishchess.org/tests/view/5d14c5f80ebc5925cf0b48da

LTC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 35361 W: 6139 L: 6042 D: 23180
http://tests.stockfishchess.org/tests/view/5d14d69c0ebc5925cf0b4bd0

Bench 3596270
2019-06-30 15:22:37 +02:00
protonspring d889bb4718 Bonus for double attacks on unsupported pawns
This is a functional change that rewards double attacks on an unsupported pawns.

STC (non-functional difference)
LLR: 2.96 (-2.94,2.94) [0.50,4.50]
Total: 83276 W: 18981 L: 18398 D: 45897
http://tests.stockfishchess.org/tests/view/5d0970500ebc5925cf0a77d4

LTC (incomplete looping version)
LLR: 0.50 (-2.94,2.94) [0.00,3.50]
Total: 82999 W: 14244 L: 13978 D: 54777
http://tests.stockfishchess.org/tests/view/5d0a8d480ebc5925cf0a8d58

LTC (completed non-looping version).
LLR: 2.96 (-2.94,2.94) [0.00,3.50]
Total: 223381 W: 38323 L: 37512 D: 147546
http://tests.stockfishchess.org/tests/view/5d0e80510ebc5925cf0ad320

Closes https://github.com/official-stockfish/Stockfish/pull/2205

Bench 3633546

----------------------------------

Comments by Alain SAVARD:

interesting result ! I would have expected that search would resolve such positions
correctly on the very next move. This is not a very common pattern, and when it happens,
it will quickly disappear. So I'm quite surprised that it passed LTC.
I would be even more surprised if this would resist a simplification.

Anyway, let's try to imagine a few cases.

a) If you have White d5 f5 against Black e6, and White to move
last move by Black was probably a capture on e6 and White is about to recapture on e6

b) If you have White d5 f5 against e6, and Black to move
last move by White was possibly a capture on d5 or f5
or the pawn on e6 was pinned or could not move for some reason.
and white wants to blast open the position and just pushed d4-d5 or f4-f5

Some possible follow-ups
a) Motif is so rare that the popcount() can be safely replaced with a bool()
But this would not pass a SPRT[0,4],
So try a simplification with bool() and also without the & ~theirAttacks

b) If it works, we probably can simply have this in the loop
if (lever) score += S(0, 20);

c) remove all this and tweak something in search for pawn captures (priority, SEE, extension,..)
2019-06-27 09:46:36 +02:00
protonspring 8cfe27b765 Remove backmost_sq (#2190)
This is a non-functional simplification.

backmost_sq and frontmost_sq are redundant. It seems quite clear to always use frontmost_sq and use the correct color.

Non functional change.
2019-06-14 08:22:02 +02:00