Natural TB

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Natural TB

Post by mcostalba »

I have modified current SF+sygyzy in a way that I have called "Natural TB".

The idea is to use TB but avoiding the unnatural TB scores and in particular the DTZ ones (hiding mates, unnatural sacrifices, etc) but retain the 'good play' of syzygy where 'good play' is defined as follow:

If in a given position SF with old syzygy leads to a win, then it should do also now with 'Natural TB'

For people interested in the technical details, let's add that I have implemented two changes to the current behavior:

1) At root, moves that do not preserve the win or the draw are skipped, but the DTZ score of the remaining moves is ignored.

2) At WDL probing time, deep in the tree, instead of returning an adjusted WDL score, only alpha, draw and beta is returned according if the position is loss, draw or win (cursed win and losses at the moment are ignored).

This is still experimental code, so maybe there is some issue moreover for the moment I have not run matches between the 2 versions, I am more interested to see if this version is more "natural" to play than the original but I expect the ELO should be equivalent between the 2 versions.

Sources are here:

https://github.com/mcostalba/Stockfish/ ... natural_tb
Dirt
Posts: 2851
Joined: Wed Mar 08, 2006 10:01 pm
Location: Irvine, CA, USA

Re: Natural TB

Post by Dirt »

mcostalba wrote:2) At WDL probing time, deep in the tree, instead of returning an adjusted WDL score, only alpha, draw and beta is returned according if the position is loss, draw or win (cursed win and losses at the moment are ignored).
Cursed wins are very rare, so I don't expect any ELO loss over this, but I would be more comfortable with knowing that the engine won't be led down the garden path to a cursed win (draw). Of course, if you are playing someone without DTZ tablebases you might actually improve your results.
Deasil is the right way to go.
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Natural TB

Post by mcostalba »

Dirt wrote: Cursed wins are very rare, so I don't expect any ELO loss over this, but I would be more comfortable with knowing that the engine won't be led down the garden path to a cursed win (draw).
It won't.

Please ignore my previous comment, it was intended for a technical audience, from user point of view nothing changes.
jpqy
Posts: 550
Joined: Thu Apr 24, 2008 9:31 am
Location: Belgium

Re: Natural TB

Post by jpqy »

Thanks Marco.. i will compile it and test it out :!:

JP.
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Natural TB

Post by hgm »

mcostalba wrote:2) At WDL probing time, deep in the tree, instead of returning an adjusted WDL score, only alpha, draw and beta is returned according if the position is loss, draw or win (cursed win and losses at the moment are ignored).
Wouldn't this make the engine always prefer to force a winning conversion over a mate in the current table?
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Natural TB

Post by mcostalba »

hgm wrote: Wouldn't this make the engine always prefer to force a winning conversion over a mate in the current table?
I don't think so, indeed returning alpha or beta drops the concept of order, for the same reason that when 2 moves fail high (or low) you can't really say which is best (or worst) of the 2.

Actually the whole idea is to let TB to say if a move is good or bad but without any other information, in particular without comparing to other moves of the same kind: this is up to the engine to find.
syzygy
Posts: 5562
Joined: Tue Feb 28, 2012 11:56 pm

Re: Natural TB

Post by syzygy »

mcostalba wrote:For people interested in the technical details, let's add that I have implemented two changes to the current behavior:

1) At root, moves that do not preserve the win or the draw are skipped, but the DTZ score of the remaining moves is ignored.
Sheesh, that is exactly what the old code already did EXCEPT that the dtz score was used to check against the 50-move rule. So I suppose you have now removed that. Well, good job once again.

To be clear: if the dtz score is still used to check against the 50-move rule, then this was not a change.
I am more interested to see if this version is more "natural" to play than the original but I expect the ELO should be equivalent between the 2 versions.
Did you EVER look at how the original played? I don't think you did.

The only problem the original had was that it did not switch to using less thinking time once TBs had been entered.
syzygy
Posts: 5562
Joined: Tue Feb 28, 2012 11:56 pm

Re: Natural TB

Post by syzygy »

hgm wrote:
mcostalba wrote:2) At WDL probing time, deep in the tree, instead of returning an adjusted WDL score, only alpha, draw and beta is returned according if the position is loss, draw or win (cursed win and losses at the moment are ignored).
Wouldn't this make the engine always prefer to force a winning conversion over a mate in the current table?
It will make the engine score a TB win as a mate, once beta gets there...

To add to my previous post: there is of course one more problem, namely that hitting a 6-piece TB prevents the engine from continuing to search that 6-piece position and possibly find and report an easy mate. This should not be impossible to fix without hurting engine strength, but seems to require complicated surgery on the search code.
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Natural TB

Post by hgm »

syzygy wrote:It will make the engine score a TB win as a mate, once beta gets there...
That was what I meant. I suppose that by "once beta gets there" you mean in the process of enlarging the root aspiration window. As you keep failing high for any smaller beta.

If you score conversion to a TB win as mate, it would score better than any real mate, as the real mate takes time, and will get a mate-in-N score. So in KQBNK it will shy away from a mate without conversion, and sac a piece to convert to a won successor.
jhellis3
Posts: 546
Joined: Sat Aug 17, 2013 12:36 am

Re: Natural TB

Post by jhellis3 »

I was able to achieve desired results in SF Matefinder with this approach:

https://github.com/jhellis3/Stockfish/c ... 16f7ade6d7


A good test position:

8/2P1P3/3k4/8/8/4K3/P2p1p2/8 b - -