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

2650 commits

Author SHA1 Message Date
Michael Chaly
464ebdf127 Small cleanup
In search remove one condition check and reorder conditions. Removes some code.

Passed non-regression test:
https://tests.stockfishchess.org/tests/view/64548fa06206ee34ebf853ad
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 282976 W: 75327 L: 75374 D: 132275
Ptnml(0-2): 604, 29673, 80995, 29598, 618

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

No functional change
2023-05-07 22:32:21 +02:00
peregrineshahin
28442195c7 Clean up after "Simplify away complexity in evaluation"
closes https://github.com/official-stockfish/Stockfish/pull/4555

No functional change.
2023-05-07 22:31:03 +02:00
Michael Chaly
2429e16289 Reduce more if current node has a lot of refuted moves.
This patch refines idea of cutoff count - in master we reduce more if current node has at least 4 moves that are refuted by search, this patch increases this count by 1 if refutation happened without having a tt move.

Passed STC:
https://tests.stockfishchess.org/tests/view/645363c36206ee34ebf8191d
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 67616 W: 18220 L: 17874 D: 31522
Ptnml(0-2): 142, 7346, 18504, 7656, 160

Passed LTC:
https://tests.stockfishchess.org/tests/view/6453a0ea6206ee34ebf82796
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 195228 W: 52741 L: 52140 D: 90347
Ptnml(0-2): 53, 18718, 59482, 19297, 64

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

bench 3448916
2023-05-05 07:12:47 +02:00
candirufish
72d542f000 Adjust reductions
Decrease further on cutNodes with tte->depth() >= depth + 3 condition.

LTC: https://tests.stockfishchess.org/tests/view/644dc84bccf5e93df5e50c13
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 155346 W: 42184 L: 41660 D: 71502
Ptnml(0-2): 59, 14765, 47504, 15283, 62

STC: https://tests.stockfishchess.org/tests/view/644d05de68e01d8194cd9bbb
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 121888 W: 32868 L: 32444 D: 56576
Ptnml(0-2): 332, 13273, 33343, 13631, 365

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

bench: 3739675
2023-05-03 20:41:33 +02:00
Linmiao Xu
21d6b69f7c Update 7 eval and optimism params
Params found using spsa at 30+0.3 with this tuning config:

```
// evaluate.cpp
int nnueOptScaleBase = 1001;
int nnueComplexityMult = 406;
int nnueComplexityOptOffset = 424;
int evalOptComplexityOffset = 272;
int evalOptScaleOffset = 748;
TUNE(SetRange(801, 1201), nnueOptScaleBase);
TUNE(SetRange(306, 506), nnueComplexityMult);
TUNE(SetRange(324, 524), nnueComplexityOptOffset);
TUNE(SetRange(172, 372), evalOptComplexityOffset);
TUNE(SetRange(648, 848), evalOptScaleOffset);

// search.cpp
int searchOptBase = 120;
int searchOptDenom = 161;
TUNE(SetRange(20, 220), searchOptBase);
TUNE(SetRange(111, 211), searchOptDenom);
```

Passed STC:
https://tests.stockfishchess.org/tests/view/644dda8accf5e93df5e50cbe
LLR: 2.93 (-2.94,2.94) <0.00,2.00>
Total: 136800 W: 36682 L: 36237 D: 63881
Ptnml(0-2): 353, 14910, 37492, 15229, 416

Passed LTC:
https://tests.stockfishchess.org/tests/view/644eaedb3f31c3bbe4a3d345
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 64548 W: 17624 L: 17272 D: 29652
Ptnml(0-2): 33, 6112, 19631, 6466, 32

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

bench 3670343
2023-05-03 20:37:57 +02:00
Stefan Geschwentner
ba06c480a7 Less reduction for tt move.
This idea is a result of my second condition combination tuning for reductions:
https://tests.stockfishchess.org/tests/view/643ed5573806eca398f06d61

There were used two parameters per combination: one for the 'sign' of the first and the second condition in a combination. Values >= 50 indicate using a condition directly and values <= -50 means use the negation of a condition.

Each condition pair (X,Y) had two occurances dependent of the order of the two conditions:
- if X < Y the parameters used for more reduction
- if X > Y the parameters used for less reduction
- if X = Y then only one condition is present and A[X][X][0]/A[X][X][1] stands for using more/less reduction for only this condition.

The parameter pair A[7][2][0] (value = -94.70) and A[7][2][1] (value = 93.60) was one of the strongest signals with values near 100/-100.
Here condition nr. 7 was '(ss+1)->cutoffCnt > 3' and condition nr. 2 'move == ttMove'. For condition nr. 7 the negation is used because A[7][2][0] is negative.

This translates finally to less reduction (because 7 > 2) for tt moves if child cutoffs <= 3.

STC:
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 65728 W: 17704 L: 17358 D: 30666
Ptnml(0-2): 184, 7092, 18008, 7354, 226
https://tests.stockfishchess.org/tests/view/643ff767ef2529086a7ed042

LTC:
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 139200 W: 37776 L: 37282 D: 64142
Ptnml(0-2): 58, 13241, 42509, 13733, 59
https://tests.stockfishchess.org/tests/view/6440bfa9ef2529086a7edbc7

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

Bench: 3548023
2023-04-22 11:04:09 +02:00
Muzhen Gaming
d64d4ac426 Simplify away depth condition for aspiration window adjust
Simplification STC:
https://tests.stockfishchess.org/tests/view/64351654596a20f264276ded
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 374664 W: 98942 L: 99089 D: 176633
Ptnml(0-2): 1049, 41767, 101878, 41558, 1080

Simplification LTC:
https://tests.stockfishchess.org/tests/view/6439499f605991a801b4f684
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 457880 W: 123021 L: 123233 D: 211626
Ptnml(0-2): 166, 44739, 139335, 44541, 159

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

Bench: 3879281
2023-04-22 10:59:33 +02:00
Guenther Demetz
7b9b793fd5 Simplification of SEE verification logic
Use same logic for all handled pieces.
Don't prune the move if opponent King, Queen, Rook gets a discovered
attack while or after the exchanges.

remove an obsolete comment in position.cpp

Passed STC non regression:
https://tests.stockfishchess.org/tests/view/6437907594daa91835c290d0
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 107432 W: 28359 L: 28221 D: 50852
Ptnml(0-2): 298, 11724, 29524, 11882, 288

Passed LTC non-regression:
https://tests.stockfishchess.org/tests/view/6438ed2ebd1a5470263c51e8
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 236288 W: 63656 L: 63656 D: 108976
Ptnml(0-2): 99, 22960, 72011, 22990, 84

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

bench: 3741125
2023-04-22 10:47:51 +02:00
Muzhen Gaming
c90dd38903 Simplify away complexity in evaluation
Simplification STC: https://tests.stockfishchess.org/tests/view/64394bc0605991a801b4f6f0
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 72360 W: 19313 L: 19138 D: 33909
Ptnml(0-2): 206, 7883, 19800, 8112, 179

Simplification LTC: https://tests.stockfishchess.org/tests/view/6439e788c233ce943b6bdac1
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 224992 W: 60665 L: 60654 D: 103673
Ptnml(0-2): 96, 21875, 68526, 21920, 79

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

Bench: 3709369
2023-04-22 10:43:29 +02:00
MinetaS
96b6c0b36f Remove some conditions at PV improvement reduction
Non-regression STC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 63664 W: 17007 L: 16823 D: 29834
Ptnml(0-2): 163, 6998, 17336, 7162, 173
https://tests.stockfishchess.org/tests/view/6430b124028b029b01ac99f2

Non-regression LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 90016 W: 24399 L: 24258 D: 41359
Ptnml(0-2): 52, 8672, 27405, 8841, 38
https://tests.stockfishchess.org/tests/view/64310e74028b029b01ad3131

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

Bench: 3661938
2023-04-22 10:37:14 +02:00
Michael Chaly
acb0d204d5 Simplify stats assignment for Pv nodes
This patch is a simplification of my recent elo gainer.
Logically the Elo gainer didn't make much sense and this patch simplifies it into smth more logical.
Instead of assigning negative bonuses to all non-first moves that enter PV nodes
we assign positive bonuses in full depth search after LMR only for moves that
will result in a fail high - thus not assigning positive bonuses
for moves that will go to pv search - so doing "almost" the same as we do in master now for them.
Logic differs for some other moves, though, but this removes some lines of code.

Passed STC:
https://tests.stockfishchess.org/tests/view/642cf5cf77ff3301150dc5ec
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 409320 W: 109124 L: 109308 D: 190888
Ptnml(0-2): 1149, 45385, 111751, 45251, 1124

Passed LTC:
https://tests.stockfishchess.org/tests/view/642fe75d20eb941419bde200
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 260336 W: 70280 L: 70303 D: 119753
Ptnml(0-2): 99, 25236, 79528, 25199, 106

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

Bench:  4286815
2023-04-12 20:45:34 +02:00
Stefan Geschwentner
9829bceda9 Remove good killer reduction rule.
STC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 246544 W: 65646 L: 65657 D: 115241
Ptnml(0-2): 706, 27350, 67138, 27405, 673
https://tests.stockfishchess.org/tests/view/642e253277ff3301150e9aa2

LTC:
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 165136 W: 44878 L: 44809 D: 75449
Ptnml(0-2): 64, 15991, 50378, 16082, 53
https://tests.stockfishchess.org/tests/view/6430db07028b029b01acd87f

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

Bench: 3746080
2023-04-12 20:43:08 +02:00
Dubslow
f66c36277f Remove nmpColor
no benefit seen, neither in game play nor for zugzwang test positions

STC: https://tests.stockfishchess.org/tests/view/642e293977ff3301150e9b55
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 161848 W: 43332 L: 43254 D: 75262
Ptnml(0-2): 418, 16987, 46058, 17021, 440

LTC: https://tests.stockfishchess.org/tests/view/642fea9420eb941419bde296
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 120208 W: 32529 L: 32418 D: 55261
Ptnml(0-2): 35, 11424, 37080, 11525, 40

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

bench 3979409
2023-04-12 20:40:53 +02:00
mstembera
7a9f67747f Reduce Position::pieces() overloads
Reduce the number of overloads for pieces() by using a more general template implementation.
Secondly simplify some code in search.cpp using the new general functionality.

TC https://tests.stockfishchess.org/tests/view/642ce27877ff3301150dc193
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 269640 W: 71775 L: 71809 D: 126056
Ptnml(0-2): 687, 27294, 78885, 27274, 680

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

No functional change.
2023-04-10 10:51:45 +02:00
MinetaS
a5643b89fd Remove extraReduction
Since bestValue becomes value and beta - alpha is always non-negative,
extraReduction is always false, hence it has no effect.

This patch includes small changes to improve readability.

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

No functional change
2023-04-10 09:28:37 +02:00
Joost VandeVondele
b36d39de3d Fix rootComplexity calculation
The calculation of rootComplexity can't call eval when in check.
Doing so triggers an assert if compiled in debug mode when
the rootpos is evaluated using classical eval.

Fixes https://github.com/official-stockfish/Stockfish/issues/4512

Passed STC:
https://tests.stockfishchess.org/tests/view/6432697431feee5c6d306876
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 41096 W: 11017 L: 10815 D: 19264
Ptnml(0-2): 113, 4172, 11780, 4366, 117

Running LTC:
https://tests.stockfishchess.org/tests/view/6432974d31feee5c6d306fc0
LLR: 1.76 (-2.94,2.94) <-1.75,0.25>
Total: 73200 W: 19792 L: 19728 D: 33680
Ptnml(0-2): 24, 6659, 23182, 6699, 36

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

No functional change
2023-04-09 15:19:49 +02:00
FauziAkram
59f2085469 Depth Tweak and tuning
tunes reduction related parameters, and introduces more reduction on found good moves.

credit for this patch goes also to candirufish Yoshie2000 dubslow peregrineshahin Vizvezdenec

Passed STC:
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 38424 W: 10346 L: 10040 D: 18038
Ptnml(0-2): 103, 4111, 10473, 4427, 98
https://tests.stockfishchess.org/tests/view/642ca74277ff3301150db511

Passed LTC:
LLR: 2.97 (-2.94,2.94) <0.50,2.50>
Total: 136968 W: 37151 L: 36660 D: 63157
Ptnml(0-2): 43, 13052, 41808, 13533, 48
https://tests.stockfishchess.org/tests/view/642d632377ff3301150dddbe

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

bench: 3672914
2023-04-07 09:56:35 +02:00
Michael Chaly
510aca1ef6 Assign negative stat bonuses for quiet moves at Pv nodes
This patch assigns negative stat bonuses for quiet moves
at pv nodes which are searched at depth greater than
this node assumes, so are extended.

Passed STC:
https://tests.stockfishchess.org/tests/view/6426198bdb43ab2ba6f9cfa2
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 548944 W: 147287 L: 146254 D: 255403
Ptnml(0-2): 1662, 59772, 150671, 60605, 1762

Passed LTC:
https://tests.stockfishchess.org/tests/view/642be4f177ff3301150d892d
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 93352 W: 25400 L: 24994 D: 42958
Ptnml(0-2): 44, 8817, 28547, 9225, 43

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

bench 5044536
2023-04-05 08:23:54 +02:00
FauziAkram
9a42bbdf31 Parameters Tweak
Passed STC
LLR: 3.22 (-2.94,2.94) <0.00,2.00>
Total: 664048 W: 177526 L: 176301 D: 310221
Ptnml(0-2): 2002, 72968, 180891, 74129, 2034
https://tests.stockfishchess.org/tests/view/64219901db43ab2ba6f901fa

Passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 77576 W: 21125 L: 20750 D: 35701
Ptnml(0-2): 24, 7350, 23669, 7717, 28
https://tests.stockfishchess.org/tests/view/642abe3377ff3301150d3a16

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

bench: 4522076
2023-04-05 08:15:34 +02:00
Dubslow
77e2b915e1 Simplifiy TM's root complexity
Also requires moving optimism initialization, this is a very early `evaluate()` call.

STC: https://tests.stockfishchess.org/tests/view/6428c39677ff3301150ca0d7
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 51256 W: 13805 L: 13612 D: 23839
Ptnml(0-2): 145, 5283, 14592, 5450, 158

LTC: https://tests.stockfishchess.org/tests/view/64296ff377ff3301150cc519
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 106968 W: 28951 L: 28830 D: 49187
Ptnml(0-2): 47, 9746, 33789, 9843, 59

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

no functional change
2023-04-05 08:13:34 +02:00
FauziAkram
6a6e32dfc8 Decrease Depth more for positions not in TT.
If the position is not in TT, decrease depth by 2
or by 4 if the TT entry for the current position was hit
and the stored depth is greater than or equal to the current depth.

Many thanks to Vizvezdenec as the main idea was his.

Passed STC:
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 70664 W: 18995 L: 18639 D: 33030
Ptnml(0-2): 228, 7712, 19090, 8080, 222
https://tests.stockfishchess.org/tests/view/64258a8bdb43ab2ba6f9b682

Passed LTC:
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 85040 W: 23227 L: 22836 D: 38977
Ptnml(0-2): 26, 8115, 25867, 8466, 46
https://tests.stockfishchess.org/tests/view/64262057db43ab2ba6f9d0e7

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

bench: 4380438
2023-04-01 16:28:52 +02:00
MinetaS
38a80c0b47 Simplify away complexityAverage
Instead of tracking the average of complexity values, calculate
complexity of root position at the beginning of the search and use it as
a scaling factor in time management.

Passed non-regression STC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 58752 W: 15738 L: 15551 D: 27463
Ptnml(0-2): 164, 6194, 16478, 6371, 169
https://tests.stockfishchess.org/tests/view/6423010edb43ab2ba6f9424a

Passed non-regression LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 92872 W: 24865 L: 24729 D: 43278
Ptnml(0-2): 38, 8652, 28929, 8770, 47
https://tests.stockfishchess.org/tests/view/6423c1f0db43ab2ba6f9644f

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

No functional change
2023-04-01 16:14:30 +02:00
Muzhen Gaming
c3c46feebb Remove reduction for moving threatened piece
Simplify away "Decrease reduction if we move a threatened piece".

Running a dbg_hit_on() shows that this line is only called ~0.12% of the time.

Simplification STC: https://tests.stockfishchess.org/tests/view/641ec2dcdb43ab2ba6f88103
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 146128 W: 39168 L: 39070 D: 67890
Ptnml(0-2): 466, 16117, 39830, 16155, 496

Simplification LTC: https://tests.stockfishchess.org/tests/view/64200689db43ab2ba6f8bca8
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 248016 W: 66703 L: 66714 D: 114599
Ptnml(0-2): 105, 24202, 75406, 24189, 106

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

Bench: 4961236
2023-04-01 15:53:46 +02:00
peregrineshahin
3f01e3f41f Allow PvNode in futility pruning for captures.
Passed non-regression STC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 148128 W: 39428 L: 39333 D: 69367
Ptnml(0-2): 492, 16326, 40315, 16457, 474
https://tests.stockfishchess.org/tests/view/641c2dbfdb43ab2ba6f804e8

Passed non-regression LTC:
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 376256 W: 100906 L: 101039 D: 174311
Ptnml(0-2): 186, 36697, 114494, 36566, 185
https://tests.stockfishchess.org/tests/view/641d33b2db43ab2ba6f83338

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

bench: 4935616
2023-03-29 21:46:23 +02:00
Miguel Lahoz
a9c26357de Clean up repetitive declarations for see_ge
The occupied bitboard is only used in one place and is otherwise thrown away.
To simplify use, see_ge function can instead be overloaded.
Repetitive declarations for occupied bitboard can be removed.

Passed non-regression test
https://tests.stockfishchess.org/tests/view/6421c286db43ab2ba6f908eb
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 48912 W: 13196 L: 13001 D: 22715
Ptnml(0-2): 146, 5003, 13967, 5190, 150

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

No functional change.
2023-03-29 21:43:07 +02:00
Michael Chaly
1b5738e0c9 Simplify statScore initialization
This patch simplifies initialization of statScore to "always set it up to 0" instead of setting it up to 0 two plies deeper.
Reason for why it was done in previous way partially was because of LMR usage of previous statScore which was simplified long time ago so it makes sense to make in more simple there.

Passed STC:
https://tests.stockfishchess.org/tests/view/641a86d1db43ab2ba6f7b31d
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 115648 W: 30895 L: 30764 D: 53989
Ptnml(0-2): 368, 12741, 31473, 12876, 366

Passed LTC:
https://tests.stockfishchess.org/tests/view/641b1c31db43ab2ba6f7d17a
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 175576 W: 47122 L: 47062 D: 81392
Ptnml(0-2): 91, 17077, 53390, 17141, 89

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

bench 5081969
2023-03-25 09:22:25 +01:00
FauziAkram
b973e40e45 Update Elo estimates for terms in search
Setting the Elo value of some functions which were not set before.
All tests run at 10+0.1 (STC), 25000 games (Same as #4294).
Book used: UHO_XXL_+0.90_+1.19.epd

Values are rounded to the nearest non-negative integer.

Test links:
https://tests.stockfishchess.org/tests/view/6419ab5b65775d3b539f46c6
https://tests.stockfishchess.org/tests/view/6419adb465775d3b539f4730
https://tests.stockfishchess.org/tests/view/6419ae9c65775d3b539f4756
https://tests.stockfishchess.org/tests/view/6419b03f65775d3b539f47a8
https://tests.stockfishchess.org/tests/view/6419b35d65775d3b539f4860
https://tests.stockfishchess.org/tests/view/6419b6b965775d3b539f48e6
https://tests.stockfishchess.org/tests/view/6419cade65775d3b539f4cd5
https://tests.stockfishchess.org/tests/view/6419cbb565775d3b539f4d01
https://tests.stockfishchess.org/tests/view/6419cc6965775d3b539f4d1e

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

No functional change
2023-03-25 09:20:58 +01:00
pb00067
24b37e4586 Verified SEE pruning for capturing and checking moves.
Patch analyzes field after SEE exchanges concluded with a recapture by
the opponent:
if opponent Queen/Rook/King results under attack after the exchanges, we
consider the move sharp and don't prune it.

Important note:
By accident I forgot to adjust 'occupied' when the king takes part in
the exchanges.
As result of this a move is considered sharp too, when opponent king
apparently can evade check by recapturing.
Surprisingly this seems contribute to patch's strength.

STC:
https://tests.stockfishchess.org/tests/view/640b16132644b62c33947397
LLR: 2.96 (-2.94,2.94) <0.00,2.00>
Total: 116400 W: 31239 L: 30817 D: 54344
Ptnml(0-2): 350, 12742, 31618, 13116, 374

LTC:
https://tests.stockfishchess.org/tests/view/640c88092644b62c3394c1c5
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 177600 W: 47988 L: 47421 D: 82191
Ptnml(0-2): 62, 16905, 54317, 17436, 80

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

bench: 5012145
2023-03-25 09:17:44 +01:00
disservin
af4b62a593 NNUE namespace cleanup
This patch moves the nnue namespace in the appropiate header that correspondes with the definition.
It also makes navigation a bit easier.

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

No functional change
2023-03-19 11:27:15 +01:00
peregrineshahin
515b66f188 Fix null move issue
Fix altering for stats landing on B1 Square after a null move and fix considering counter-moves on A1 for root node.

fixes https://github.com/official-stockfish/Stockfish/issues/4333 by preventing calls to from_sq and to_sq functions over null-moves and none-moves.

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

bench: 4980082
2023-03-19 11:25:48 +01:00
pb00067
f0556dcbe3 Small cleanups
remove some unneeded assignments, typos, incorrect comments, add authors entry.

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

no functional change
2023-03-14 08:38:02 +01:00
Michael Chaly
78532af9dc Do more singular extensions
This patch continues trend of last VLTC tuning - as measured by dubslow
most of it gains was in lowering marging in calculation of singularBeta.
This patch is a manual adjustment on top of it - it lowers multiplier
of depth in calculation of singularBeta even further, from 2/3 to 1,5/2,5.

Was negative at STC:
https://tests.stockfishchess.org/tests/view/64089c632644b62c3393fc12
Elo: -2.49 +-1.7 (95%) LOS: 0.2%
Total: 40000 W: 10601 L: 10888 D: 18511
Ptnml(0-2): 123, 4580, 10875, 4305, 117
nElo: -5.03 +-3.4 (95%) PairsRatio: 0.94

Passed 180+1.8 SPRT:
https://tests.stockfishchess.org/tests/view/640096dae74a12625bcf3b33
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 160952 W: 43753 L: 43342 D: 73857
Ptnml(0-2): 25, 13984, 52039, 14411, 17

Passed 60+0.6 8 threads SPRT:
https://tests.stockfishchess.org/tests/view/640dca8e65775d3b539cb7f6
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 38824 W: 10825 L: 10554 D: 17445
Ptnml(0-2): 0, 2939, 13268, 3200, 5

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

bench 4776866
2023-03-14 08:22:40 +01:00
Dubslow
a48573e15f More negative extensions on nonsingular nonpv nodes.
Following up the previous gainer also in this nonsingular node
section of code. Credit shared with @FauziAkram for realizing
this nonsingular node stuff had some potential, and @XInTheDark
for reminding us that !PvNodes better handle extensions/reductions
than Pv.

Passed STC: https://tests.stockfishchess.org/tests/view/640a7bb32644b62c339457c3
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 136776 W: 36598 L: 36149 D: 64029
Ptnml(0-2): 439, 14834, 37384, 15301, 430

Passed LTC: https://tests.stockfishchess.org/tests/view/640c43a02644b62c3394b23c
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 79536 W: 21363 L: 20984 D: 37189
Ptnml(0-2): 28, 7525, 24285, 7900, 30

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

Bench: 4444953
2023-03-14 00:41:42 +01:00
Michael Chaly
39da50ed23 Do more negative extensions
This patch does negatively extend transposition table move if singular search failed and tt value is not bigger than alpha.
Logic is close to what we had before recent simplification of negative extensions but uses or condition instead of and condition.

Passed STC:
https://tests.stockfishchess.org/tests/view/6404c8102644b62c33934607
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 119040 W: 31841 L: 31416 D: 55783
Ptnml(0-2): 356, 13070, 32292, 13397, 405

Passed LTC:
https://tests.stockfishchess.org/tests/view/6405abda2644b62c33937119
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 47216 W: 12816 L: 12496 D: 21904
Ptnml(0-2): 12, 4500, 14286, 4776, 34

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

bench 4747020
2023-03-08 07:16:09 +01:00
Michael Chaly
5c75c1c2fb Fix duplicated moves generation in movepicker
in a some of cases movepicker returned some moves more than once which lead
to them being searched more than once. This bug was possible because of how
we use queen promotions - they are generated as a captures but are not
included in position function which checks if move is a capture. Thus if
any refutation (killer or countermove) was a queen promotion it was
searched twice - once as a capture and one as a refutation.

This patch affects various things, namely stats assignments for queen promotions
and other moves if best move is queen promotion,
also some heuristics in search and qsearch.

With this patch every queen promotion is now considered a capture.

After this patch number of found duplicated moves is 0 during normal 13 depth bench run.

Passed STC:
https://tests.stockfishchess.org/tests/view/63f77e01e74a12625bcd87d7
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 80920 W: 21455 L: 21289 D: 38176
Ptnml(0-2): 198, 8839, 22241, 8963, 219

Passed LTC:
https://tests.stockfishchess.org/tests/view/63f7e020e74a12625bcd9a76
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 89712 W: 23674 L: 23533 D: 42505
Ptnml(0-2): 24, 8737, 27202, 8860, 33

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

bench 4681731
2023-03-05 16:06:03 +01:00
Dubslow
6adbc6fa05 Late counter bonus: boost underestimated moves
The idea here is very intuitive: since we've just proven that the move is good, then if it previously had poor stats, boost those stats more than otherwise.

Passed STC: https://tests.stockfishchess.org/tests/view/63fb504ce74a12625bce4154
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 21128 W: 5763 L: 5481 D: 9884
Ptnml(0-2): 52, 2212, 5759, 2484, 57

Passed LTC: https://tests.stockfishchess.org/tests/view/63fb7825e74a12625bce491b
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 91904 W: 24764 L: 24359 D: 42781
Ptnml(0-2): 45, 8735, 27984, 9146, 42

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

bench 4318808
2023-02-27 22:03:50 +01:00
Stefan Geschwentner
ff5a6f8df1 NNUE accumulator update in probcut.
Call the recently added hint function for NNUE accumulator update after a failed probcut search.
In this case we already searched at least some captures and tt move which, however, is not sufficient for a cutoff.
So it seems we have a greater chance that the full search will also have no cutoff and hence all moves have to be searched.

STC: https://tests.stockfishchess.org/tests/view/63fa74a4e74a12625bce1823
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 70096 W: 18770 L: 18423 D: 32903
Ptnml(0-2): 191, 7342, 19654, 7651, 210

To be sure that we have no heavy interaction retest on top of #4410.

Rebased STC: https://tests.stockfishchess.org/tests/view/63fb2f62e74a12625bce3b03
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 137688 W: 36790 L: 36349 D: 64549
Ptnml(0-2): 397, 14373, 38919, 14702, 453

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

No functional change
2023-02-27 08:28:45 +01:00
pb00067
728b963614 Use common_parent_position hint also at PVNodes TT hits.
Credits to Stefan Geschwentner (locutus2) showing that the hint
is useful on PvNodes. In contrast to his test,
this version avoids to use the hint when in check.
I believe checking positions aren't good candidates for the hint
because:
- evasion moves are rather few, so a checking pos. has much less childs
than a normal position
- if the king has to move the NNUE eval can't use incremental updates,
  so the child nodes have to do a full refresh anyway.

Passed STC:
https://tests.stockfishchess.org/tests/view/63f9c5b1e74a12625bcdf585
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 124472 W: 33268 L: 32846 D: 58358
Ptnml(0-2): 350, 12986, 35170, 13352, 378

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

no functional change
2023-02-27 08:27:26 +01:00
Alfredo Menezes
98dafda6c8 Simplify condition in step 15
Remove 'ttValue <= alpha' check for negative extension in singular search.
Also apply some small code style changes.

STC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 127888 W: 33766 L: 33651 D: 60471
Ptnml(0-2): 303, 14082, 35089, 14137, 333
https://tests.stockfishchess.org/tests/view/63f79528e74a12625bcd8c05

LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 89048 W: 23924 L: 23782 D: 41342
Ptnml(0-2): 27, 8635, 27065, 8763, 34
https://tests.stockfishchess.org/tests/view/63f82177e74a12625bcda6f4

LTC (retest):
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 196360 W: 52514 L: 52475 D: 91371
Ptnml(0-2): 103, 19066, 59780, 19151, 80
https://tests.stockfishchess.org/tests/view/63f934bfe74a12625bcdd929

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

Bench: 5310866
2023-02-27 08:26:29 +01:00
Michael Chaly
472e726bff Search tuning at very long time control
This patch is a result of tuning session of approximately 100k games at 120+1.2.
Biggest changes are in extensions, stat bonus and depth reduction for nodes without a tt move.

Failed STC:
https://tests.stockfishchess.org/tests/view/63f72c72e74a12625bcd7938
LLR: -2.94 (-2.94,2.94) <0.00,2.00>
Total: 13872 W: 3535 L: 3769 D: 6568
Ptnml(0-2): 56, 1621, 3800, 1419, 40

Close to neutral at LTC:
https://tests.stockfishchess.org/tests/view/63f738f5e74a12625bcd7b8a
Elo: 0.80 +-1.2 (95%) LOS: 90.0%
Total: 60000 W: 16213 L: 16074 D: 27713
Ptnml(0-2): 24, 5718, 18379, 5853, 26
nElo: 1.82 +-2.8 (95%) PairsRatio: 1.02

Passed 180+1.8 VLTC:
https://tests.stockfishchess.org/tests/view/63f868f3e74a12625bcdb33e
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 15864 W: 4449 L: 4202 D: 7213
Ptnml(0-2): 1, 1301, 5083, 1544, 3

Passed 60+0.6 8 threads SMP VLTC:
https://tests.stockfishchess.org/tests/view/63f8a5d6e74a12625bcdbdb3
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 6288 W: 1821 L: 1604 D: 2863
Ptnml(0-2): 0, 402, 2123, 619, 0

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

bench 4705194
2023-02-24 20:14:44 +01:00
Joost VandeVondele
08385527dd Introduce a function to compute NNUE accumulator
This patch introduces `hint_common_parent_position()` to signal that potentially several child nodes will require an NNUE eval. By populating explicitly the accumulator, these subsequent evaluations can be performed more efficiently.

This was based on the observation that calculating the evaluation in an excluded move position yielded a significant Elo gain, even though the evaluation itself was already available (work by pb00067).

Sopel wrote the code to perform just the accumulator update. This PR is based on cleaned up code that

passed STC:
https://tests.stockfishchess.org/tests/view/63f62f9be74a12625bcd4aa0
 LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 110368 W: 29607 L: 29167 D: 51594
Ptnml(0-2): 41, 10551, 33572, 10967, 53

and in an the earlier (equivalent) version

passed STC:
https://tests.stockfishchess.org/tests/view/63f3c3fee74a12625bcce2a6
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 47552 W: 12786 L: 12467 D: 22299
Ptnml(0-2): 120, 5107, 12997, 5438, 114

passed LTC:
https://tests.stockfishchess.org/tests/view/63f45cc2e74a12625bccfa63
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 110368 W: 29607 L: 29167 D: 51594
Ptnml(0-2): 41, 10551, 33572, 10967, 53

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

Bench: 3726250
2023-02-23 13:25:35 +01:00
Dubslow
037ef3e18d Remove one reduction call
even though bench is unchanged to depth 28,
due to adjusting depth in singular extensions this might be functional.

STC: https://tests.stockfishchess.org/tests/view/63ec21affe833123fef34153
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 195712 W: 51625 L: 51581 D: 92506
Ptnml(0-2): 504, 20527, 55779, 20513, 533

LTC: https://tests.stockfishchess.org/tests/view/63ed3487fe833123fef375ed
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 32176 W: 8631 L: 8442 D: 15103
Ptnml(0-2): 5, 2794, 10309, 2967, 13

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

Bench 4283297
2023-02-18 14:01:08 +01:00
Dubslow
085cace457 Simplify late countermove bonus condition
STC: https://tests.stockfishchess.org/tests/view/63d53ac6a67dd929a555e1e2
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 216096 W: 56862 L: 56839 D: 102395
Ptnml(0-2): 648, 24033, 58650, 24082, 635

LTC: https://tests.stockfishchess.org/tests/view/63d7f9a6a67dd929a5565991
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 808512 W: 214060 L: 214610 D: 379842
Ptnml(0-2): 301, 79448, 245293, 78928, 286

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

Bench: 4283297
2023-02-18 13:34:40 +01:00
Dubslow
e25bcaed3c Update complexityAverage in all branches of static eval
STC: https://tests.stockfishchess.org/tests/view/63dda49573223e7f52ad0f8c
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 117416 W: 31173 L: 31049 D: 55194
Ptnml(0-2): 290, 12246, 33533, 12328, 311

LTC: https://tests.stockfishchess.org/tests/view/63dfa90873223e7f52ad69b8
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 44416 W: 11924 L: 11744 D: 20748
Ptnml(0-2): 5, 4036, 13968, 4172, 27

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

bench 4758694
2023-02-09 07:46:41 +01:00
Michael Chaly
8f843633db Cleanup and reorder in qsearch
This patch is a simplification / code normalisation in qsearch.

Adds steps in comments the same way we have in search;

Makes a separate "pruning" stage instead of heuristics randomly being spread over qsearch code;
Reorders pruning heuristics from least taxing ones to more taxing ones;
Removes repeated check for best value not being mated, instead uses 1 check - thus removes some lines of code.
Moves prefetch and move setup after pruning - makes no sense to do them if move will actually get pruned.

Passed non-regression test:
https://tests.stockfishchess.org/tests/view/63dd2c5ff9a50a69252c1413
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 113504 W: 29898 L: 29770 D: 53836
Ptnml(0-2): 287, 11861, 32327, 11991, 286

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

Non-functional change.
2023-02-09 07:45:05 +01:00
pb00067
8d3457a996 Improve excluded move logic
PR consists of 2 improvements on nodes with excludeMove:

1. Remove xoring the posKey with make_key(excludedMove)

   Since we never call tte->save anymore with excludedMove,
   the unique left purpose of the xoring was to avoid a TT hit.
   Nevertheless on a normal bench run this produced ~25 false positives
   (key collisions)
   To avoid that we now forbid early TT cutoff's with excludeMove
   Maybe these accesses to TT with xored key caused useless misses
   in the CPU caches (L1, L2 ...)
   Now doing the probe with the same key as the enclosing search does,
   should hit the CPU cache.

2. Don't probe Tablebases with excludedMove.

   This can't be tested on fishtest, but it's obvious that
   tablebases don't deliver any information about suboptimal moves.

Side note:
   Very surprisingly it looks like we cannot use static eval's from
   TT since they slightly differ over time due to changing optimism.
   Attempts to use static eval's from TT did loose about 13 ELO.
   This is something about to investigate.

LTC: https://tests.stockfishchess.org/tests/view/63dc0f8de9d4cdfbe672d0c6
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 44736 W: 12046 L: 11733 D: 20957
Ptnml(0-2): 12, 4212, 13617, 4505, 22

An analogue of this passed STC & LTC
see PR #4374 (thanks Dubslow for reviewing!)

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

Bench: 4758694
2023-02-03 20:18:50 +01:00
Muzhen Gaming
d2f79ff0e0 Remove reduced LMR capture bonus
In LMR, simplify away the reduced capture bonus (i.e. if (capture) bonus /= 6).

Non-regression STC: https://tests.stockfishchess.org/tests/view/63da1da9bbadd17b3787dced
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 28152 W: 7521 L: 7296 D: 13335
Ptnml(0-2): 76, 3069, 7568, 3280, 83

Non-regression LTC: https://tests.stockfishchess.org/tests/view/63da6ad4bbadd17b3787e98c
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 52472 W: 14120 L: 13941 D: 24411
Ptnml(0-2): 16, 5071, 15887, 5242, 20

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

Bench: 4034016
2023-02-03 20:15:09 +01:00
Michael Chaly
da8513f0ea Do less SEE pruning in qsearch
Current master prunes all moves with negative SEE values in qsearch.
This patch sets constant negative threshold thus allowing some moves with negative SEE values to be searched.
Value of threshold is completely arbitrary and can be tweaked - also it as function of depth can be tried.
Original idea by author of Alexandria engine.

Passed STC
https://tests.stockfishchess.org/tests/view/63d79a59a67dd929a5564976
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 34864 W: 9392 L: 9086 D: 16386
Ptnml(0-2): 113, 3742, 9429, 4022, 126

Passed LTC
https://tests.stockfishchess.org/tests/view/63d8074aa67dd929a5565bc2
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 91616 W: 24532 L: 24126 D: 42958
Ptnml(0-2): 32, 8840, 27662, 9238, 36

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

Bench: 4010877
2023-02-02 18:00:14 +01:00
Muzhen Gaming
0827e00f10 Decrease reduction for killer moves with good history
If move is a main killer and we have a good history, decrease reduction.

STC: https://tests.stockfishchess.org/tests/view/63d38b37721fe2bff693069a
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 46688 W: 12542 L: 12222 D: 21924
Ptnml(0-2): 126, 5013, 12769, 5287, 149

LTC: https://tests.stockfishchess.org/tests/view/63d471e2bde6e5f3cb4be5d3
LLR: 2.93 (-2.94,2.94) <0.50,2.50>
Total: 130976 W: 35033 L: 34555 D: 61388
Ptnml(0-2): 38, 12551, 39833, 13027, 39

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

Bench: 4069938
2023-02-02 17:45:57 +01:00
MinetaS
e4e61cd9cc Remove maxNextDepth
This patch allows full PV search to have double extensions as well when
extension == 1 && doDeeperSearch && doEvenDeeperSearch && !doShallowerSearch
is true, which is extremely rare to occur.

Passed non-regression STC (master 3d2381d):
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 370824 W: 97835 L: 97974 D: 175015
Ptnml(0-2): 1073, 38814, 105731, 38767, 1027
https://tests.stockfishchess.org/tests/view/63c89416a83c702aac08314c

Passed non-regression LTC (master 3d2381d):
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 306048 W: 81173 L: 81237 D: 143638
Ptnml(0-2): 117, 27977, 96901, 27911, 118
https://tests.stockfishchess.org/tests/view/63cc4e84344bb01c191b2658

Bench: 4208265
2023-01-28 16:54:30 +01:00