## Interior node recognizer and capture / stalemate

Discussion of chess software programming and technical issues.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
xr_a_y
Posts: 733
Joined: Sat Nov 25, 2017 1:28 pm
Location: France

### Interior node recognizer and capture / stalemate

I'm struggling to understand when the result of an interior node recognizer can be used.

There are 3 ways (at least) of using interior node recognizer :
- score a draw (like don't reward KBK with +3, verify if KPK is winning or not, ...)
- use at helper for a endgame win (like in KRK, KBNK)
- scale an endgame score (don't reward KRNKR +3, verify KBPPKB promotion square color, ... )

But ! for all of those things, it feels like some precaution must be taken :
- winning or strong side must not lose a piece/pawn immediately
- loosing or weak side, must not be stalemate

In Minic, I was using the interior node recognizer only at qsearch leaves where no capture exists anymore but (I may be wrong), it seems to me that stockfish is using endgame scale factor, endgame helpers and draw recognition everywhere and without any kind of special verification (just in KXK there is something for stalemate).

How are you dealing with these things ?

hgm
Posts: 23621
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

### Re: Interior node recognizer and capture / stalemate

It depends on how you define 'immediately'. The scaling of end-games is part of the static evaluation, used during stand-pat. If the side to move is not happy that KRKN doesn't get it the 'expected' +2, but he can capture the Knight, he will try that in QS. If he can skewer the Knight and win it that way, QS probably wouldn't see it (let alone static eval). But then you are talking about things beyond the horizon. No matter what you do, there will always be such things. Static eval is just a heuristic to guess what most probably will ly beyond that horizon, perhaps with a small disccount depending on the risk.

xr_a_y
Posts: 733
Joined: Sat Nov 25, 2017 1:28 pm
Location: France

### Re: Interior node recognizer and capture / stalemate

Ok I get the point for static eval, it is just an approximation, and capture shall be evaluated later anyway

How to deal with "real" draw detection? just use 50rule and 3rep or also try to consider KNK, KBK, ...

hgm
Posts: 23621
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

### Re: Interior node recognizer and capture / stalemate

Real draws get a zero score, and are not searched any deeper (like checkmate or stalemate). For 'dead draws', suck as KNNK or KBKN you cannot do that, because there could be mate-in-1. A trick that is possible here is to do it only after a few moves, i.e. e.g. when the 50-move counter hits 2 or 3. Or decrease the multiplier as a function of the 50-move counter, and stop searching when it hits zero. The statistics of most end-games is heavily dominated by tactical positions, which force a conversion within a few moves. Especially if there are super-pieces involved. Delaying the judgement is a good way to give the search an opportunity to opt out of the end-game by tactics, which leaves the genuine positions of that end-game. E.g. KQKRN would normally be a draw, but there are many positions that quickly gain a Knight or Rook. If that cannot be done very quickly it either wasn't possible to start with (because all pieces were already protected), or the opponent will have been able to organize its forces in such a way. (Perhaps it would be an idea to not count King moves out of check, as these do not contribute much to building a fortress.)

Michael Sherwin
Posts: 3041
Joined: Fri May 26, 2006 1:00 am
Location: WY, USA
Full name: Michael Sherwin

### Re: Interior node recognizer and capture / stalemate

In those drawish positions that are really drawish after say the first 12 or so initial iterations show no immediate gain of material the draw detection could be turned on for deeper iterations.
I hate if statements. Pawns demand if statements. Therefore I hate pawns.

xr_a_y
Posts: 733
Joined: Sat Nov 25, 2017 1:28 pm
Location: France

### Re: Interior node recognizer and capture / stalemate

Ok i love the idea to decrease score of drawish or hard to win position with fifty counter. Thanks

PK
Posts: 820
Joined: Mon Jan 15, 2007 10:23 am
Location: Warsza
Contact:

### Re: Interior node recognizer and capture / stalemate

With king + minor versus king + minor you can safely claim a draw as long as neither king stands on the rim. The idea of tweaking 50 move rule is great BTW.