1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-07-11 19:49:14 +00:00
BadFish/src
peregrineshahin fa143922ae Fix pruning to (in TB loss) in Null move pruning.
Current logic can apply Null move pruning
on a dead-lost position returning an unproven loss
(i.e. in TB loss score or mated in losing score) on nonPv nodes.

on a default bench, this can be observed by adding this debugging line:
```
if (nullValue >= beta)
{
    // Do not return unproven mate or TB scores
    nullValue = std::min(nullValue, VALUE_TB_WIN_IN_MAX_PLY-1);
    dbg_hit_on(nullValue <= VALUE_TB_LOSS_IN_MAX_PLY); // Hit #0: Total 73983 Hits 1 Hit Rate (%) 0.00135166
    if (thisThread->nmpMinPly || depth < 14)
        return nullValue;
```

This fixes this very rare issue (happens at ~0.00135166% of the time) by
eliminating the need to try Null Move Pruning with dead-lost positions
and leaving it to be determined by a normal searching flow.

The previous try to fix was not as safe enough because it was capping
the returned value to (out of TB range) thus reviving the dead-lost position
based on an artificial clamp (i.e. the in TB score/mate score can be lost on that nonPv node):
https://tests.stockfishchess.org/tests/view/649756d5dc7002ce609cd794

Final fix:
Passed STC:
https://tests.stockfishchess.org/tests/view/649a5446dc7002ce609d1049
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 577280 W: 153613 L: 153965 D: 269702
Ptnml(0-2): 1320, 60594, 165190, 60190, 1346

Passed LTC:
https://tests.stockfishchess.org/tests/view/649cd048dc7002ce609d4801
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 246432 W: 66769 L: 66778 D: 112885
Ptnml(0-2): 83, 22105, 78847, 22100, 81

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

Bench: 2425978
2023-07-03 18:24:41 +02:00
..
incbin Change mode of incbin.h 2023-03-14 08:23:50 +01:00
nnue Simplify lookup_count and clean up pieces(). 2023-07-03 18:20:10 +02:00
syzygy Improve compatibility 2023-04-01 15:36:08 +02:00
benchmark.cpp Warn if a global function has no previous declaration 2023-01-09 20:18:39 +01:00
benchmark.h Warn if a global function has no previous declaration 2023-01-09 20:18:39 +01:00
bitbase.cpp Update copyright years 2023-01-02 19:07:38 +01:00
bitboard.cpp Remove precomputed SquareBB 2023-01-22 10:55:32 +01:00
bitboard.h Remove precomputed SquareBB 2023-01-22 10:55:32 +01:00
endgame.cpp Update copyright years 2023-01-02 19:07:38 +01:00
endgame.h Update copyright years 2023-01-02 19:07:38 +01:00
evaluate.cpp Remove optimism multiplier in nnue eval calculation 2023-06-06 21:21:56 +02:00
evaluate.h Update NNUE architecture to SFNNv7 with larger L1 size of 2048 2023-07-01 13:34:30 +02:00
main.cpp Update copyright years 2023-01-02 19:07:38 +01:00
Makefile Set the length of GIT_SHA to 8 characters 2023-04-22 10:38:25 +02:00
material.cpp Update copyright years 2023-01-02 19:07:38 +01:00
material.h Unify type alias declarations 2023-02-27 08:29:47 +01:00
misc.cpp Restore development 2023-07-01 12:52:31 +02:00
misc.h Simplify away complexityAverage 2023-04-01 16:14:30 +02:00
movegen.cpp Fix capturing underpromotions issue 2023-04-12 20:38:43 +02:00
movegen.h Update copyright years 2023-01-02 19:07:38 +01:00
movepick.cpp Remove unneeded bitboard from MP 2023-04-05 08:10:34 +02:00
movepick.h Remove unneeded bitboard from MP 2023-04-05 08:10:34 +02:00
pawns.cpp Update copyright years 2023-01-02 19:07:38 +01:00
pawns.h Unify type alias declarations 2023-02-27 08:29:47 +01:00
position.cpp Reintroduce SEE verification against discovered attacks 2023-06-11 15:13:57 +02:00
position.h Simplify lookup_count and clean up pieces(). 2023-07-03 18:20:10 +02:00
psqt.cpp Update copyright years 2023-01-02 19:07:38 +01:00
psqt.h Update copyright years 2023-01-02 19:07:38 +01:00
search.cpp Fix pruning to (in TB loss) in Null move pruning. 2023-07-03 18:24:41 +02:00
search.h Unify type alias declarations 2023-02-27 08:29:47 +01:00
thread.cpp Simplify away complexity in evaluation 2023-04-22 10:43:29 +02:00
thread.h Simplify away complexity in evaluation 2023-04-22 10:43:29 +02:00
thread_win32_osx.h Modernize code base a little bit 2023-01-09 20:25:13 +01:00
timeman.cpp Do no initialize TM in all cases 2023-04-10 10:56:42 +02:00
timeman.h Update copyright years 2023-01-02 19:07:38 +01:00
tt.cpp Use int conversion for Option class 2023-04-10 09:27:35 +02:00
tt.h Update copyright years 2023-01-02 19:07:38 +01:00
tune.cpp Update copyright years 2023-01-02 19:07:38 +01:00
tune.h Unify type alias declarations 2023-02-27 08:29:47 +01:00
types.h Fix null move issue 2023-03-19 11:25:48 +01:00
uci.cpp Update winrate model with June data 2023-06-22 10:17:44 +02:00
uci.h Update winrate model with June data 2023-06-22 10:17:44 +02:00
ucioption.cpp Use int conversion for Option class 2023-04-10 09:27:35 +02:00