1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00
Commit graph

4944 commits

Author SHA1 Message Date
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
2c5f0efa13 Extend irreversible moves
if these are ttMoves and played in positions with a high value of the rule50 counter. The unusual extension of 2 is safe in this context as awarding it will reset the rule50 counter, making sure it is awarded very rarely in a search path.

This patch partially addresses https://github.com/official-stockfish/Stockfish/issues/2620 as it should make it less likely to play a move that resets the counter, but that is worse than alternative moves after a slightly deeper search.

passed STC:
LLR: 2.96 (-2.94,2.94) {-0.50,1.50}
Total: 71658 W: 13840 L: 13560 D: 44258
Ptnml(0-2): 1058, 7921, 17643, 8097, 1110
https://tests.stockfishchess.org/tests/view/5e90d0f6754c3424c4cf9f41

passed LTC:
LLR: 2.94 (-2.94,2.94) {0.25,1.75}
Total: 85082 W: 11069 L: 10680 D: 63333
Ptnml(0-2): 459, 6982, 27259, 7393, 448
https://tests.stockfishchess.org/tests/view/5e917470af0a0143109dc341

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

Bench: 4432822
2020-04-12 20:38:47 +02:00
protonspring
6596f0eac0 Always remember the ttMove
In master, if the received ttMove meets the prescribed conditions in the various MovePicker constructors, it is returned as the first move, otherwise we set it to MOVE_NONE. If set to MOVE_NONE, we no longer track what the ttMove was, and it will might be returned later in a list of generated moves. This may be a waste. With this patch, if the ttMove fails to meet the prescribed conditions, we simply skip the TT stages, but still store the move and make sure it's never returned.

STC
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 66424 W: 12903 L: 12806 D: 40715
Ptnml(0-2): 1195, 7730, 15230, 7897, 1160

LTC
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 45682 W: 5989 L: 5926 D: 33767
Ptnml(0-2): 329, 4361, 13443, 4334, 374

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

Bench 4928928
2020-04-12 20:34:50 +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
Vizvezdenec
195a4fec6d Introduce capture history pruning
This patch introduces a heuristic that is similar to countermove based pruning but for captures - capture history pruning. The idea is that we can (almost) safely prune really late captures with negative history if they don't give check so will most likely not produce some king-attacking tactic.

passed STC
https://tests.stockfishchess.org/tests/view/5e8c60d40ffd2be7f15e5470
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 23748 W: 4758 L: 4529 D: 14461
Ptnml(0-2): 421, 2712, 5400, 2899, 442

passed LTC
https://tests.stockfishchess.org/tests/view/5e8c72bf0ffd2be7f15e547f
LLR: 2.96 (-2.94,2.94) {0.25,1.75}
Total: 17330 W: 2415 L: 2190 D: 12725
Ptnml(0-2): 126, 1561, 5107, 1704, 167

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

bench 4417023
2020-04-07 17:47:01 +02:00
Vizvezdenec
85bcf4741e Further increase reductions with increasing number of threads
This patch doubles the reduction increase with thread count.

passed STC
https://tests.stockfishchess.org/tests/view/5e874f5a4411759d9d098696
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 9162 W: 1558 L: 1385 D: 6219
Ptnml(0-2): 90, 958, 2343, 1069, 121

passed LTC
https://tests.stockfishchess.org/tests/view/5e8762804411759d9d09869f
LLR: 2.94 (-2.94,2.94) {0.25,1.75}
Total: 79364 W: 9541 L: 9159 D: 60664
Ptnml(0-2): 462, 6880, 24661, 7172, 507

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

bench 4831963
2020-04-05 08:44:25 +02:00
31m059
fbc7a328c6 Retire candidate passed pawns
Before this commit, some pawns were considered "candidate" passed pawns and given half bonus. After this commit, all of these pawns are scored as passed pawns, and they do not receive less bonus.

STC:
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 21806 W: 4320 L: 4158 D: 13328
Ptnml(0-2): 367, 2526, 5001, 2596, 413
https://tests.stockfishchess.org/tests/view/5e86b4724411759d9d098639

LTC:
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 12590 W: 1734 L: 1617 D: 9239
Ptnml(0-2): 96, 1187, 3645, 1238, 129
https://tests.stockfishchess.org/tests/view/5e86d2874411759d9d098640

This PR and commit are dedicated to our colleague Stefan Geschwentner (@locutus2), one of the most respected and accomplished members of the Stockfish developer community. Stockfish is a volunteer project and has always thrived because of Stefan's talent, insight, generosity, and dedication. Welcome back, Stefan!

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

Bench: 4831963
2020-04-05 08:39:00 +02:00
protonspring
3cb1c6c3c6 remove KNPK endgame code
In more than 100k local KNPK games, there is no discernible difference between master and master with this endgame removed: master:42971, patch:42973, draws: 3969. Removal does not seem to regress in normal games.

STC
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 46390 W: 8998 L: 8884 D: 28508
Ptnml(0-2): 707, 5274, 11163, 5300, 751
https://tests.stockfishchess.org/tests/view/5e83b18ee42a5c3b3ca2ef02

LTC
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 44768 W: 5863 L: 5814 D: 33091
Ptnml(0-2): 251, 3918, 14028, 3905, 282
https://tests.stockfishchess.org/tests/view/5e84a82a4411759d9d0984f4

In tests with a book of endgames that can convert into KNPK, no significant difference can be seen either

```
TC 1.0+0.01
Score of patch vs master: 6131 - 6188 - 27681  [0.499] 40000
Elo difference: -0.5 +/- 1.9, LOS: 30.4 %, DrawRatio: 69.2 %

TC 2.0+0.02
Score of patch vs master: 5740 - 5741 - 28519 [0.500] 40000
Elo difference: -0.0 +/- 1.8, LOS: 49.6 %, DrawRatio: 71.3 %
``

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

Bench 4512059
2020-04-05 08:35:31 +02:00
Vizvezdenec
c14f4877cf Increase reduction for captures.
The idea behind this patch is that if static eval is really bad so capturing of current piece on spot will still produce a position with an eval much lower than alpha then our best chance is to create some kind of king attack. So captures without check are mostly worse than captures with check and can be reduced more.

passed STC
https://tests.stockfishchess.org/tests/view/5e8514b44411759d9d098543
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 46196 W: 9039 L: 8781 D: 28376
Ptnml(0-2): 750, 5412, 10628, 5446, 862

passed LTC
https://tests.stockfishchess.org/tests/view/5e8530134411759d9d09854c
LLR: 2.94 (-2.94,2.94) {0.25,1.75}
Total: 23462 W: 3228 L: 2988 D: 17246
Ptnml(0-2): 186, 2125, 6849, 2405, 166

close https://github.com/official-stockfish/Stockfish/pull/2612

bench 4742598
2020-04-02 15:11:16 +02:00
31m059
375e4eeaf5 Simplify a candidate passer condition.
STC:
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 31528 W: 6208 L: 6061 D: 19259
Ptnml(0-2): 541, 3673, 7205, 3788, 557
https://tests.stockfishchess.org/tests/view/5e825db0e42a5c3b3ca2ee21

LTC:
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 38546 W: 5083 L: 5009 D: 28454
Ptnml(0-2): 299, 3628, 11362, 3668, 316
https://tests.stockfishchess.org/tests/view/5e826ec7e42a5c3b3ca2ee2a

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

Bench: 5139561
2020-04-02 14:56:30 +02:00
mstembera
84f3bf594d No voting for TB loss / mate.
Just as we pick the shortest mate also make sure we stave off mate as long as possible.

https://github.com/official-stockfish/Stockfish/pull/2603

bench: 5138771
2020-04-02 14:54:47 +02:00
protonspring
0b8ce4b303 Limit array access in Position
This is a non-functional code style change that routes all position array accesses to single methods, and adds an assert to check correctness.

Passed STC
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 37312 W: 7378 L: 7246 D: 22688
Ptnml(0-2): 606, 4280, 8762, 4392, 616
https://tests.stockfishchess.org/tests/view/5e7c0c69e42a5c3b3ca2eb3d

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

No functional change.
2020-04-02 14:40:03 +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
Praveen tummala
b7ecdaada7 Movecount pruning reduction logic
This patch refines search reduction logic in case the position is not a former PV node and is pruned based on move count.

passed STC
https://tests.stockfishchess.org/tests/view/5e8092bde42a5c3b3ca2ed35
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 78848 W: 15480 L: 15170 D: 48198
Ptnml(0-2): 1406, 9310, 17773, 9438, 1497

passed LTC
https://tests.stockfishchess.org/tests/view/5e80bb13e42a5c3b3ca2ed4b
LLR: 2.94 (-2.94,2.94) {0.25,1.75}
Total: 86596 W: 11451 L: 11033 D: 64112
Ptnml(0-2): 624, 7993, 25687, 8329, 665

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

Bench: 5138771
2020-03-30 22:41:22 +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
xoto10
8c73339a36 Remove previousScore adjustment of delta.
STC:
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 14580 W: 2904 L: 2731 D: 8945
Ptnml(0-2): 243, 1665, 3339, 1762, 281
https://tests.stockfishchess.org/tests/view/5e7d080ae42a5c3b3ca2ebc6

LTC:
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 60338 W: 7870 L: 7831 D: 44637
Ptnml(0-2): 451, 5596, 18018, 5671, 433
https://tests.stockfishchess.org/tests/view/5e7d11b3e42a5c3b3ca2ebd3

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

Bench 5247262
2020-03-29 19:44:07 +02:00
Lyudmil Antonov
58746d9fb8 Tuned history reduction
Value after a long Bayesian tuning, using a home-made classification approach.

STC
https://tests.stockfishchess.org/tests/view/5e7c7b16e42a5c3b3ca2eb66
LLR: 2.96 (-2.94,2.94) {-0.50,1.50}
Total: 45472 W: 8992 L: 8732 D: 27748
Ptnml(0-2): 795, 5276, 10352, 5500, 813

LTC
https://tests.stockfishchess.org/tests/view/5e7c8be7e42a5c3b3ca2eb75
LLR: 2.94 (-2.94,2.94) {0.25,1.75}
Total: 22744 W: 3085 L: 2849 D: 16810
Ptnml(0-2): 156, 2090, 6658, 2298, 170

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

Bench 5030855
2020-03-26 17:49:28 +01:00
xoto10
c8e8e48b14 Remove passed_count from almostUnwinnable.
This simplification allows the almostUnwinnable flag to match endgames where the pawns are all on the same flank but are not symmetrical.

STC:
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 23356 W: 4543 L: 4395 D: 14418
Ptnml(0-2): 346, 2651, 5582, 2707, 392
https://tests.stockfishchess.org/tests/view/5e7b8f57e42a5c3b3ca2eb09

LTC:
LLR: 2.96 (-2.94,2.94) {-1.50,0.50}
Total: 31778 W: 4097 L: 4023 D: 23658
Ptnml(0-2): 199, 2853, 9729, 2891, 217
https://tests.stockfishchess.org/tests/view/5e7ba5ade42a5c3b3ca2eb16

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

Bench 4777139
2020-03-26 17:46:51 +01:00
protonspring
8b229381da Remove KNPKB endgame.
This is a functional simplification that removes the KNPKB endgame.

Testing on only KNPKB positions suggests that this removal actually gains Elo:

Score of patch vs master: 3380 - 3035 - 33585  [0.504] 40000
Elo difference: 3.0 +/- 1.4, LOS: 100.0 %, DrawRatio: 84.0 %

Score of patch vs master: 290 - 36 - 39674  [0.503] 40000
Elo difference: 2.2 +/- 0.3, LOS: 100.0 %, DrawRatio: 99.2 %

removal also doesn't cause a regression with the standard book:

STC
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 71376 W: 13794 L: 13719 D: 43863
Ptnml(0-2): 1066, 8092, 17290, 8181, 1059
https://tests.stockfishchess.org/tests/view/5e76c3d5e42a5c3b3ca2e8be

LTC
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 28394 W: 3731 L: 3662 D: 21001
Ptnml(0-2): 167, 2339, 9116, 2408, 167
https://tests.stockfishchess.org/tests/view/5e76e5eae42a5c3b3ca2e8d3

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

Bench 5480811
2020-03-25 21:42:33 +01:00
Vizvezdenec
6ecab03dee Adjust singular extension search depth
This patch applies a different singular extension search logic in case the position is ttPv && !PvNode.
It changes the depth of this search, higher for this types of nodes, and lower for other nodes.

passed STC
http://tests.stockfishchess.org/tests/view/5e72bbaae42a5c3b3ca2e75e
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 12692 W: 2608 L: 2389 D: 7695
Ptnml(0-2): 238, 1414, 2839, 1601, 254

passed LTC
http://tests.stockfishchess.org/tests/view/5e731c07e42a5c3b3ca2e770
LLR: 2.96 (-2.94,2.94) {0.25,1.75}
Total: 145716 W: 19218 L: 18626 D: 107872
Ptnml(0-2): 1100, 13605, 42899, 14111, 1143

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

Bench: 5398277
2020-03-20 21:07:37 +01:00
Vizvezdenec
ff27109313 Adjust singular LMR for positions seen in PV
This patch continues work on altering search for ttPv nodes, using recent idea to alter it more in not PvNodes. Previous tweak based on this idea adjusted singularBeta - this one adjusts value of singularLMR, so they are both related to singular extension search.

passed STC
http://tests.stockfishchess.org/tests/view/5e700737e42a5c3b3ca2e659
LLR: 2.95 (-2.94,2.94) {-0.50,1.50}
Total: 140608 W: 27053 L: 26659 D: 86896
Ptnml(0-2): 2425, 16337, 32439, 16625, 2478

passed LTC
http://tests.stockfishchess.org/tests/view/5e7068eae42a5c3b3ca2e687
LLR: 2.94 (-2.94,2.94) {0.25,1.75}
Total: 79318 W: 10463 L: 10064 D: 58791
Ptnml(0-2): 567, 7416, 23359, 7685, 632

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

Bench: 4952322
2020-03-17 19:34:47 +01:00
Stéphane Nicolet
07caca2587 Anchored bishops
Reduce the "bad bishop" penalty when the bishop is protected by
one of our pawns, as it may indicate that the bishop has found
a safe spot outside the pawn chain.

STC:
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 176942 W: 34142 L: 33696 D: 109104
Ptnml(0-2): 3129, 20422, 40919, 20876, 3125
http://tests.stockfishchess.org/tests/view/5e6f61aae42a5c3b3ca2e62d

LTC:
LLR: 2.95 (-2.94,2.94) {0.25,1.75}
Total: 42252 W: 5615 L: 5322 D: 31315
Ptnml(0-2): 308, 3881, 12500, 4084, 353
http://tests.stockfishchess.org/tests/view/5e701382e42a5c3b3ca2e661

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

Bench: 4963440
2020-03-17 19:20:37 +01:00
Joost VandeVondele
ddcbacd04d Small cleanups
closes https://github.com/official-stockfish/Stockfish/pull/2567

No functional change.
2020-03-14 17:04:50 +01:00
pb00067
ec2002c594 Simplify futility pruning parent node
only continuation histories seem needed for this purpose.

STC:
http://tests.stockfishchess.org/tests/view/5e6b88dfe42a5c3b3ca2e4ab
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 113356 W: 21725 L: 21696 D: 69935
Ptnml(0-2): 1999, 13255, 26163, 13240, 2021

LTC:
http://tests.stockfishchess.org/tests/view/5e6babbfe42a5c3b3ca2e4c2
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 22164 W: 2917 L: 2821 D: 16426
Ptnml(0-2): 173, 2040, 6548, 2160, 161

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

bench: 4839496
2020-03-14 16:30:17 +01:00
protonspring
442e1e0f93 simplify castling part of generate_all.
somewhat more compact, generates same code.

close https://github.com/official-stockfish/Stockfish/pull/2580

No functional change.
2020-03-14 16:27:54 +01:00
silversolver1
c077bfb413 Remove set statScore to zero
Simplification. Removes setting statScore to zero if negative.

STC:
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 84820 W: 16100 L: 16033 D: 52687
Ptnml(0-2): 1442, 9865, 19723, 9944, 1436
https://tests.stockfishchess.org/tests/view/5e654fdae42a5c3b3ca2e2f8

LTC:
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 57658 W: 7435 L: 7391 D: 42832
Ptnml(0-2): 441, 5397, 17104, 5451, 436
https://tests.stockfishchess.org/tests/view/5e657ce9e42a5c3b3ca2e307

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

Bench: 5168890
2020-03-09 22:46:13 +01: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
protonspring
9690cd6295 Remove KRPPKRPScaleFactors array
Fucntional simplification that removes the KRPPKRPScaleFactors array.

STC
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 47374 W: 9159 L: 9049 D: 29166
Ptnml(0-2): 707, 5325, 11560, 5341, 754
http://tests.stockfishchess.org/tests/view/5e5ff464e42a5c3b3ca2e156

LTC
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 31268 W: 4064 L: 3995 D: 23209
Ptnml(0-2): 173, 2734, 9764, 2777, 186
http://tests.stockfishchess.org/tests/view/5e61be6ce42a5c3b3ca2e1c1

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

Bench 5123316
2020-03-07 11:09:38 +01:00
protonspring
e7c1c8c1ab Cleanup KBPsK endgame
* Clarify distinction between strong side pawns and all pawns.
* Simplify and speed-up determination of pawns on the same file.
* Clarify comments.
* more_than_one() is probably faster than pos.count.

Passed STC:
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 40696 W: 7856 L: 7740 D: 25100
Ptnml(0-2): 584, 4519, 10054, 4579, 612
http://tests.stockfishchess.org/tests/view/5e6153b1e42a5c3b3ca2e1a9

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

No functional change.
2020-03-07 10:55:15 +01:00
protonspring
0424273d0b Small speed-up in BetweenBB
A speed-up removing some comparisons.

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

No functional change.
2020-03-07 10:48:16 +01:00
protonspring
5a7b45eac9 Use equations for PushAway and PushClose
A functional simplification replacing the corresponding arrays. Tested in two variants,
also the simpler one performs well, even though differences to master should be minimal.

STC
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 57864 W: 11092 L: 11001 D: 35771
Ptnml(0-2): 826, 6458, 14320, 6455, 873
http://tests.stockfishchess.org/tests/view/5e5da5b6e42a5c3b3ca2e05c

LTC
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 7198 W: 982 L: 883 D: 5333
Ptnml(0-2): 33, 575, 2296, 650, 45
http://tests.stockfishchess.org/tests/view/5e5df13ae42a5c3b3ca2e077

LTC (This exact version. . . more simplified)
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 5392 W: 729 L: 631 D: 4032
Ptnml(0-2): 23, 405, 1751, 485, 32
http://tests.stockfishchess.org/tests/view/5e5ead99e42a5c3b3ca2e0e4

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

Bench 5123316
2020-03-04 07:17:04 +01:00
protonspring
960d59d541 Consolidate Square Flipping
Add a flip_rank() and flip_file() so that all of the square flipping can be consolidated.

STC
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 57234 W: 11064 L: 10969 D: 35201
Ptnml(0-2): 822, 6562, 13801, 6563, 869
http://tests.stockfishchess.org/tests/view/5e5d2f2aafe6254521f2ffaa

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

No functional change.
2020-03-04 07:11:48 +01:00
Joost VandeVondele
c6839a2615 Small cleanups
closes https://github.com/official-stockfish/Stockfish/pull/2546

No functional change.
2020-03-01 09:31:58 +01:00
Guenther Demetz
f27339d35b Simplify lowply-history logic
Don't restrict usage to ttPv nodes exclusively

STC:
http://tests.stockfishchess.org/tests/view/5e5634f284a82b4acd41499a
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 152796 W: 29146 L: 29178 D: 94472
Ptnml(0-2): 2590, 17792, 35628, 17836, 2552

LTC:
http://tests.stockfishchess.org/tests/view/5e575d4984a82b4acd4149e8
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 20078 W: 2688 L: 2587 D: 14803
Ptnml(0-2): 139, 1914, 5853, 1973, 160

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

bench: 4923286
2020-03-01 09:20:31 +01:00
Moez Jellouli
09f53dbfa5 Weak queen protection
Extra penalty if weak piece is only protected by a queen.

STC:
http://tests.stockfishchess.org/tests/view/5e53c6ab84a82b4acd4148fa
LLR: 2.96 (-2.94,2.94) {-0.50,1.50}
Total: 44630 W: 8615 L: 8359 D: 27656
Ptnml(0-2): 746, 5156, 10323, 5276, 814

LTC:
http://tests.stockfishchess.org/tests/view/5e54e05d84a82b4acd414947
LLR: 2.94 (-2.94,2.94) {0.25,1.75}
Total: 175480 W: 23085 L: 22409 D: 129986
Ptnml(0-2): 1264, 16494, 51678, 16910, 1394

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

Bench: 4923286
2020-02-27 13:14:51 +01:00
AndyGrant
2e1369d030 Fix TT write in MultiPV case.
fixes an error reported earlier as https://github.com/official-stockfish/Stockfish/issues/2404 by @AndyGrant.

MultiPV at root shouldn't write to the TT for later lines, as that is neither the eval nor the bestmove for that position.
Fixing this error doesn't matter for playing games (http://tests.stockfishchess.org/tests/view/5dcdbd810ebc590256324a11).

However, it can lead to wrong mate announcements as reported by @uriblass. In particular the following testcase gives
wrong results for the second search, prior to this patch:

```
setoption name MultiPV value 2
position fen 5R2/2kB2p1/p2bR3/8/3p1B2/8/PPP5/2K5 b - - 0 49
go depth 40
position fen 2B2R2/3r2p1/p1kbR3/8/3p1B2/8/PPP5/2K5 b - - 8 48
go depth 40
```

fixes https://github.com/official-stockfish/Stockfish/issues/2561
closes https://github.com/official-stockfish/Stockfish/pull/2562

Only affects MultiPV search.

Bench: 4697493
2020-02-25 21:10:10 +01:00
31m059
8352977b91 Use single param for Outpost and ReachableOutpost.
In November 2019, as a result of the simplification of rank-based outposts by 37698b0,
separate bonuses were introduced for outposts that are currently occupied and outposts
that are reachable on the next move. However, the values of these two bonuses are
quite similar, and they have remained that way for three months of development.

It appears that we can safely retire the separate ReachableOutpost parameter and
use the same Outpost bonus in both cases, restoring the basic principles of Stockfish
outpost evaluation to their pre-November state, while also reducing
the size of the parameter space.

STC:
LLR: 2.96 (-2.94,2.94) {-1.50,0.50}
Total: 47680 W: 9213 L: 9092 D: 29375
Ptnml(0-2): 776, 5573, 11071, 5594, 826
https://tests.stockfishchess.org/tests/view/5e51e33190a0a02810d09802

LTC:
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 14690 W: 1960 L: 1854 D: 10876
Ptnml(0-2): 93, 1381, 4317, 1435, 119
https://tests.stockfishchess.org/tests/view/5e52197990a0a02810d0980f

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

Bench: 4697493
2020-02-25 21:03:42 +01:00
Günther Demetz
b8c00efa27 Improve move order near the root
Current move histories are known to work well near the leaves, whilst at
higher depths they aren't very helpful. To address this problem this
patch introduces a table dedicated for what's happening at plies 0-3.
It's structured like mainHistory with ply index instead of color.
It get cleared with each new search and is filled during iterative
deepening at higher depths when recording successful quiet moves near
the root or traversing nodes which were in the principal variation
(ttPv).

Medium TC (20+0.2):
https://tests.stockfishchess.org/tests/view/5e4d358790a0a02810d096dc
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 100910 W: 16682 L: 16376 D: 67852
Ptnml(0-2): 1177, 10983, 25883, 11181, 1231

LTC:
https://tests.stockfishchess.org/tests/view/5e4e2cb790a0a02810d09714
LLR: 2.95 (-2.94,2.94) {0.25,1.75}
Total: 80444 W: 10495 L: 10095 D: 59854
Ptnml(0-2): 551, 7479, 23803, 7797, 592

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

Bench: 4705960
2020-02-22 21:32:32 +01:00
protonspring
ab930f8d3f Updated KNNKP endgame.
This is a patch that significantly improves playing KNNKP endgames:

```
Score of 2553 vs master: 132 - 38 - 830 [0.547] 1000
Elo difference: 32.8 +/- 8.7, LOS: 100.0 %, DrawRatio: 83.0 %
```

At the same time it reduces the evaluation of this mostly draw engame
from ~7.5 to ~1.5

This patch does not regress against master in normal games:

STC
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 96616 W: 18459 L: 18424 D: 59733
Ptnml(0-2): 1409, 10812, 23802, 10905, 1380
http://tests.stockfishchess.org/tests/view/5e49dfe6f8d1d52b40cd31bc

LTC
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 49726 W: 6340 L: 6304 D: 37082
Ptnml(0-2): 239, 4227, 15906, 4241, 250
http://tests.stockfishchess.org/tests/view/5e4ab9ee16fb3df8c4cc01d0

Theory: KNNK is a dead draw, however the presence of the additional weakSide pawn opens up some mate opportunities. The idea is to block the pawn (preferably behind the Troitsky line) with one of the knights and press the weakSide king into a corner. If we can stalemate the king, we release the pawn with the knight (to avoid actual stalemate), and use the knight to complete the mate before the pawn promotes. This is also why there is an additional penalty for advancement of the pawn.

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

Bench: 4981770
2020-02-20 08:32:17 +01:00
protonspring
10ead8a724 Simplify Futility Move Count
remove two constants

STC
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 62050 W: 11903 L: 11802 D: 38345
Ptnml(0-2): 1002, 7346, 14283, 7320, 1065
http://tests.stockfishchess.org/tests/view/5e41d73be70d848499f63c6d

LTC
LLR: 2.93 (-2.94,2.94) {-1.50,0.50}
Total: 12850 W: 1679 L: 1572 D: 9599
Ptnml(0-2): 82, 1171, 3818, 1249, 96
http://tests.stockfishchess.org/tests/view/5e42bf07e70d848499f63cc0

Bench: 4762351
2020-02-15 15:13:14 +01:00
Joost VandeVondele
be5a2f015e Fix for incorrect VALUE_MATE_IN_MAX_PLY usage.
Fixes #2533, fixes #2543, fixes #2423.

the code that prevents false mate announcements depending on the TT
state (GHI), incorrectly used VALUE_MATE_IN_MAX_PLY. The latter
constant, however, also includes, counterintuitively, the TB win range.

This patch fixes that, by restoring the behavior for TB win scores,
while retaining the false mate correctness, and improving the mate
finding ability. In particular

no alse mates are announced with the poisened hash testcase
```
position fen 8/8/8/3k4/8/8/6K1/7R w - - 0 1
go depth 40
position fen 8/8/8/3k4/8/8/6K1/7R w - - 76 1
go depth 20
ucinewgame
```

mates are found with the testcases reported in #2543
```
position fen 4k3/3pp3/8/8/8/8/2PPP3/4K3 w - - 0 1
setoption name Hash value 1024
go depth 55
ucinewgame
```
and
```
position fen 4k3/4p3/8/8/8/8/3PP3/4K3 w - - 0 1
setoption name Hash value 1024
go depth 45
ucinewgame
```

furthermore, on the mate finding benchmark (ChestUCI_23102018.epd),
performance improves over master, roughly reaching performance with the
false mate protection reverted
```
Analyzing 6566 mate positions for best and found mates:

                 ----------------best ---------------found
           nodes master revert  fixed master revert  fixed
        16000000   4233   4236   4235   5200   5201   5199
        32000000   4583   4585   4585   5417   5424   5418
        64000000   4852   4853   4855   5575   5584   5579
       128000000   5071   5068   5066   5710   5720   5716
       256000000   5280   5282   5279   5819   5827   5826
       512000000   5471   5468   5468   5919   5935   5932
```

On a testcase with TB enabled, progress is made consistently, contrary
to master
```
setoption name SyzygyPath value ../../../syzygy/3-4-5/
setoption name Hash value 2048
position fen 1R6/3k4/8/K2p4/4n3/2P5/8/8 w - - 0 1
go depth 58
ucinewgame
```

The PR (prior to a rewrite for clarity)

passed STC:
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 65405 W: 12454 L: 12384 D: 40567
Ptnml(0-2): 920, 7256, 16285, 7286, 944
http://tests.stockfishchess.org/tests/view/5e441a3be70d848499f63d15

passed LTC:
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 27096 W: 3477 L: 3413 D: 20206
Ptnml(0-2): 128, 2215, 8776, 2292, 122
http://tests.stockfishchess.org/tests/view/5e44e277e70d848499f63d63

The incorrectly named VALUE_MATE_IN_MAX_PLY and VALUE_MATED_IN_MAX_PLY
were renamed into VALUE_TB_WIN_IN_MAX_PLY and VALUE_TB_LOSS_IN_MAX_PLY,
and correclty defined VALUE_MATE_IN_MAX_PLY and VALUE_MATED_IN_MAX_PLY
were introduced.

One further (corner case) mistake using these constants was fixed (go
mate X), which could lead to a premature return if X > MAX_PLY / 2,
but TB were present.

Thanks to @svivanov72 for one of the reports and help fixing the issue.

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

Bench: 4932981
2020-02-15 15:10:07 +01:00
Vizvezdenec
4e8986483a Modify singular beta for ttPv positions.
This patch lowers singular beta for positions that have been in pv and are not pv nodes.
The idea of using ttpv && !PvNode improved scaling with TC and could be
useful for other search heuristics.

passed STC
http://tests.stockfishchess.org/tests/view/5e3f6d7ce70d848499f63bbc
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 154953 W: 29688 L: 29272 D: 95993
Ptnml(0-2): 2616, 17912, 36037, 18210, 2673

passed LTC
http://tests.stockfishchess.org/tests/view/5e405561e70d848499f63bfa
LLR: 2.95 (-2.94,2.94) {0.25,1.75}
Total: 70974 W: 9305 L: 8932 D: 52737
Ptnml(0-2): 466, 6658, 20920, 6826, 569

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

Bench: 4932981
2020-02-10 09:19:02 +01:00
Joost VandeVondele
0aee1ec4ab Fix wrong assert.
can trigger an abort when compiling with debug=yes, and using 7men TB.
The assert should check that less than 8 pieces are in the key for each
side, matching the assumption that underlies the FEN string construction.
Also take explicitly care of a 'v' character in material strings.

Fixes an issue reported in the forum:
https://groups.google.com/d/msg/fishcooking/yoVC7etIpz0/7mS7ntZMBAAJ

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

No functional change.
2020-02-10 09:12:07 +01:00
Joost VandeVondele
0c878adb36 Small cleanups.
closes https://github.com/official-stockfish/Stockfish/pull/2532

Bench: 4869669
2020-02-05 15:32:29 +01:00
Vizvezdenec
ddd4224640 Reintroduce king infiltration
This patch reintroduces the recently simplified king infiltration bonus
in initiative calculation, doubling its effect, and compensating more.

passed STC
http://tests.stockfishchess.org/tests/view/5e3476f630ae32da08941d5c
LLR: 2.94 (-2.94,2.94) {-0.50,1.50}
Total: 75323 W: 14434 L: 14140 D: 46749
Ptnml(0-2): 1231, 8729, 17528, 8826, 1331

passed LTC
http://tests.stockfishchess.org/tests/view/5e377353e70d848499f638c1
LLR: 2.94 (-2.94,2.94) {0.25,1.75}
Total: 171466 W: 22223 L: 21561 D: 127682
Ptnml(0-2): 1204, 15951, 50831, 16397, 1312

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

Brench: 4869669
2020-02-05 13:42:24 +01:00
xoto10
0f37da0e34 Simplify away king infiltration.
STC :
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 91438 W: 17496 L: 17438 D: 56504
Ptnml(0-2): 1573, 10711, 21067, 10790, 1563
https://tests.stockfishchess.org/tests/view/5e34812630ae32da08941d65

LTC :
LLR: 2.96 (-2.94,2.94) {-1.50,0.50}
Total: 40485 W: 5246 L: 5177 D: 30062
Ptnml(0-2): 289, 3818, 11976, 3812, 327
https://tests.stockfishchess.org/tests/view/5e354daee70d848499f6380c

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

Bench: 5047825
2020-02-02 07:11:49 +01:00
xoto10
c390b734c4 Simplify Tweak late move reductions at root.
Revert change from Jan 15.

STC 10+0.1 :
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 65135 W: 12543 L: 12436 D: 40156
Ptnml(0-2): 1090, 7618, 14947, 7623, 1136
https://tests.stockfishchess.org/tests/view/5e334016708b13464ceea32e

LTC 60+0.6 :
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 17768 W: 2286 L: 2191 D: 13291
Ptnml(0-2): 128, 1602, 5273, 1679, 140
https://tests.stockfishchess.org/tests/view/5e34011e57e1ecae66ec2aab

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

Bench: 4914050
2020-02-01 09:05:13 +01:00
Joost VandeVondele
6ccb1cac5a Revert 5 recent patches
Revert 5 patches which were merged, but lead to a regression test that showed negative Elo gain:

http://tests.stockfishchess.org/tests/view/5e307251ab2d69d58394fdb9

This was discussed in depth in:

https://github.com/official-stockfish/Stockfish/issues/2531

Each patch was removed and tested as a simplification, full list below, and the whole combo as well.

After the revert the regression test showed a neutral result:

http://tests.stockfishchess.org/tests/view/5e334851708b13464ceea33c

As a result of this experience, the SPRT testing bounds will be made more strict.

Reverted patches:

1 Dynamic Complexity 6d0eabd5fe :

STC 10+0.1 https://tests.stockfishchess.org/tests/view/5e31fcacec661e2e6a340d08 :
LLR: 2.97 (-2.94,2.94) {-1.50,0.50}
Total: 38130 W: 7326 L: 7189 D: 23615
Ptnml(0-2): 677, 4346, 8843, 4545, 646

LTC 60+0.6 https://tests.stockfishchess.org/tests/view/5e32c18fec661e2e6a340d73 :
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 38675 W: 4941 L: 4866 D: 28868
Ptnml(0-2): 270, 3556, 11429, 3584, 291

3 More bonus for bestMoves on past PV nodes 71e0b5385e :

STC 10+0.1 https://tests.stockfishchess.org/tests/view/5e31fe93ec661e2e6a340d10 :
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 46100 W: 8853 L: 8727 D: 28520
Ptnml(0-2): 796, 5297, 10749, 5387, 813

LTC 60+0.6 https://tests.stockfishchess.org/tests/view/5e32c187ec661e2e6a340d71 :
LLR: 2.96 (-2.94,2.94) {-1.50,0.50}
Total: 16920 W: 2161 L: 2055 D: 12704
Ptnml(0-2): 115, 1498, 5006, 1569, 130

4 Tweak Restricted Piece Bonus 0ae00454ba :

STC 10+0.1 https://tests.stockfishchess.org/tests/view/5e31fefaec661e2e6a340d15 :
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 88328 W: 17060 L: 16997 D: 54271
Ptnml(0-2): 1536, 10446, 20169, 10422, 1581

LTC 60+0.6 https://tests.stockfishchess.org/tests/view/5e32c17aec661e2e6a340d6f :
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 34784 W: 4551 L: 4466 D: 25767
Ptnml(0-2): 255, 3279, 10061, 3345, 262

5 History update for pruned captures 01b6088af3 :

STC 10+0.1 https://tests.stockfishchess.org/tests/view/5e31ff5eec661e2e6a340d1a :
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 29541 W: 5735 L: 5588 D: 18218
Ptnml(0-2): 483, 3445, 6820, 3469, 545

LTC 60+0.6 https://tests.stockfishchess.org/tests/view/5e32c196ec661e2e6a340d75 :
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 22177 W: 2854 L: 2757 D: 16566
Ptnml(0-2): 143, 2005, 6555, 2055, 164

6 Tweak trapped rook penalty 18fc21eba0 :

STC 10+0.1 https://tests.stockfishchess.org/tests/view/5e31ffb1ec661e2e6a340d1c :
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 24476 W: 4727 L: 4569 D: 15180
Ptnml(0-2): 390, 2834, 5659, 2933, 417

LTC 60+0.6 https://tests.stockfishchess.org/tests/view/5e32c19eec661e2e6a340d77 :
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 97332 W: 12492 L: 12466 D: 72374
Ptnml(0-2): 690, 9107, 28738, 9034, 720

All 5 as one simplification :
LTC 60+0.6 https://tests.stockfishchess.org/tests/view/5e334098708b13464ceea330 :
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 7829 W: 1079 L: 964 D: 5786
Ptnml(0-2): 52, 690, 2281, 781, 65

Bench: 5153165
2020-01-31 19:48:44 +01:00
Joost VandeVondele
3b70932b0d Fix compilation on android
Fall back to the default implementation of aligned_ttmem_alloc, which
was introduced as part of 39437f4e55

Fixes  #2524

No functional change.
2020-01-29 07:25:18 +01:00