1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 08:43:09 +00:00
BadFish/src
Ronald de Man c0d3010438 Fix KXK endgame
Position is win also if strong side has a bishop
and a knight (plus other material, otherwise
KBNK would be triggered instead of KXK).

This fixes a subtle bug where a search on position

k7/8/8/8/8/P7/PB6/K7 b - - 6 1

Instead of returning a draw score, suddendly returns
a big score. This happens because at one point in
search we reach this position:

8/Pk6/8/8/8/4B3/P7/K7 w - - 3 8

Where white can promote. In case of rook promotion (and also in case of
queen promotion) the resutling position gets a huge static eval that is
above VALUE_KNOWN_WIN (from the point of view of white). So for rook
promotion it is

          &&  futilityBase > -VALUE_KNOWN_WIN

that prevents futility pruning in qsearch. (Removing this condition indeed
lets the problem occur). Raising the static eval for K+B+N+X v K to a value
higher than VALUE_KNOWN_WIN fixes this particular problem without having to
introduce an extra futility pruning condition in qsearch.

I just checked and it seems K+R v K, K+2B v K and even K+B+N v K already get
a huge static eval. Why not K+B+N+P v K?

I think this fix corrects an oversight. There is special code for KBNK, but
KBNXK is handled by KXK, so the test for sufficient material should also test
for B+N.

bench: 8678654
2014-05-03 21:40:09 +02:00
..
benchmark.cpp Print dbg counters after bench 2014-03-11 22:19:14 +01:00
bitbase.cpp Some more work in pretty_pv 2014-04-06 10:15:11 +02:00
bitboard.cpp Switch to hardware PEXT 2014-04-12 08:55:30 +02:00
bitboard.h Revert "Generalize shift_bb() to handle double pushes" 2014-04-21 20:56:12 +02:00
bitcount.h Update copyright year 2014-01-02 01:49:18 +01:00
book.cpp Sync some common names 2014-04-06 11:26:12 +02:00
book.h Update copyright year 2014-01-02 01:49:18 +01:00
endgame.cpp Fix KXK endgame 2014-05-03 21:40:09 +02:00
endgame.h Simplify pawnless endgame evaluation 2014-01-18 17:22:54 +01:00
evaluate.cpp Fully correct stealmate detection 2014-05-03 12:12:22 +02:00
evaluate.h Update copyright year 2014-01-02 01:49:18 +01:00
main.cpp Move args parsing to UCI::loop 2014-04-12 13:51:52 +02:00
Makefile Minor stuff scattered around 2014-04-28 17:07:43 +02:00
material.cpp Move game phase constants to enum Value 2014-04-27 09:23:45 +02:00
material.h Reformatting in material.h 2014-04-27 09:31:22 +02:00
misc.cpp Add ARCH x86-64-bmi2 support 2014-04-12 09:15:14 +02:00
misc.h Additional renaming from DON 2014-02-14 09:42:50 +01:00
movegen.cpp Minor stuff scattered around 2014-04-28 17:07:43 +02:00
movegen.h Update copyright year 2014-01-02 01:49:18 +01:00
movepick.cpp Fix issues detected by Coverity Scan 2014-04-26 09:33:50 +02:00
movepick.h Sync some common names 2014-04-06 11:26:12 +02:00
notation.cpp Remove some useless casts 2014-04-27 11:44:16 +02:00
notation.h Some more work in pretty_pv 2014-04-06 10:15:11 +02:00
pawns.cpp We can add an integer to a Value 2014-04-27 11:25:42 +02:00
pawns.h More readable trapped rook condition 2014-04-13 14:29:42 +02:00
platform.h Update copyright year 2014-01-02 01:49:18 +01:00
position.cpp Remove some useless casts 2014-04-27 11:44:16 +02:00
position.h Sync some common names 2014-04-06 11:26:12 +02:00
psqtab.h Remove RookOn7th and merge values into psqt 2014-04-24 08:53:46 +02:00
rkiss.h Move magic random to RKISS 2014-02-12 14:47:36 +01:00
search.cpp Don't save stale value in TT after split 2014-05-01 16:26:18 +02:00
search.h Fix a crash under MSVC 2014-03-16 10:55:58 +01:00
thread.cpp Increase max threads to 128 2014-03-18 12:07:26 +01:00
thread.h Fix issues detected by Coverity Scan 2014-04-26 09:33:50 +02:00
timeman.cpp Don't need floor() in timeman.cpp 2014-04-27 19:10:00 +02:00
timeman.h Fix Intel compiler warnings 2014-04-27 12:02:36 +02:00
tt.cpp Fix a warning with MSVC 2010 2014-03-30 14:25:57 +02:00
tt.h Fix an incorrect 'friend' declaration 2014-03-23 11:17:38 +01:00
types.h Use only standard conforming eg_value() 2014-05-01 23:08:07 +02:00
uci.cpp Fix issues detected by Coverity Scan 2014-04-26 09:33:50 +02:00
ucioption.cpp Sync some common names 2014-04-06 11:26:12 +02:00
ucioption.h Move args parsing to UCI::loop 2014-04-12 13:51:52 +02:00