Funny fortress position

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

Moderators: hgm, Rebel, chrisw

zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Funny fortress position

Post by zullil »

MikeB wrote: Wed Feb 12, 2020 1:02 pm
zamar wrote: Mon Jan 25, 2010 2:02 pm In Stockfish's self-play there occured a funny fortress position:

[d]4kb2/2p3r1/1pP1P2Q/pP2K3/P7/8/8/8 w - - 0 93

Stockfish shows this as +4 for white. How about your favourite engine?
Black Diamond XI has Joe Ellis' fortress detection code built in.

Code: Select all

dep	score	time	(not shown:  nodes	tbhits	knps	seldep	)
 26	  0.00 	0:17.90	Kd8 e7+ Kxe7 Qh3 Kd8 Qf5 Bc5 Ke5 Bd6+ Kf6 Re7 Kg6 Be5 Qf8+ Re8 Qf7 Re7
 25	  0.00 	0:06.35	Kd8 e7+ Kxe7 Qh3 Kd8 Qf5 Bc5 Ke5 Bd6+ Kf6 Re7 Kg6 Be5 Qf8+ Re8 Qf7 Re7
 24	  0.00 	0:03.64	Kd8 e7+ Kxe7 Qh3 Kd8 Qf5 Bc5 Ke5 Bd6+ Kf6 Re7 Kg6 Bb4 Qf8+ Re8 Qf7 Re7
 23	  0.00 	0:01.37	Kd8 e7+ Kxe7 Qh3 Kd8 Qf5 Bc5 Ke5 Bd6+ Kf6 Re7 Kg6 Bb4 Qf8+ Re8 Qf7 Re7
 22	  0.00 	0:01.00	Kd8 e7+ Kxe7 Qh3 Kd8 Qf5 Bc5 Ke5 Bd6+ Kf6 Re7 Kg6 Be5 Qf8+ Re8 Qf7 Re7
 21	  0.00 	0:00.70	Kd8 e7+ Kxe7 Qh3 Kd8 Qf5 Bc5 Ke5 Bd6+ Kf6 Re7 Kg6 Be5 Qf8+ Re8 Qf7 Re7
 20	  0.00 	0:00.53	Kd8 e7+ Kxe7 Qh3 Kd8 Qf5 Bc5 Ke5 Bd6+ Kf6 Bf8 Qd3+ Ke8 Qd5 Re7 Qa2 K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qf5 Bc5 Qf6+ Re7
  9	 -3.15 	0:00.01	Rg8 Qh5+ Kd8 Qf7 Rg5+ Ke4 Be7 Qh7 Ke8 Qh8+ Bf8 Kf4 Rg7 Kf5 Rg1 Qe5
  8	 -3.20 	0:00.01	Rg1 Qf4 Rg7 Qf6 Re7 Ke4 Bg7 Qg6+ Kd8 Kf4 Bb2 Qb1
  7	 -3.37 	0:00.01	Rg8 Qf6 Rg7 Qe5 Kd8 Qh5 Re7 Ke5 Re8 Kf6 Be7+ Kg7
  6	 -3.75 	0:00.01	Rg1 Qf4 Rg7 Qf6 Re7 Qg6+ Kd8
  5	 -3.79 	0:00.01	Re7 Qg6+ Kd8 Ke5 Bg7+ Kf5 Bd4
  4	 -3.12 	0:00.01	Rg1 Qf4 Rd1+ Kc4 Bc5 Qf7+ Kd8
  3	 -3.45 	0:00.00	Rg1 Qh4 Rd1+ Ke4
  2	 -3.03 	0:00.00	Rg1 Qh5+ Kd8 Qf3
  1	 -3.17 	0:00.00	Rg1 Qh5+ Ke7
  0	#
Available here
https://github.com/MichaelB7/Stockfish/releases/tag/XI
But that's search-based-detection, right? Not much help when the position occurs at the leaf of a middlegame search. :D

Is Black Diamond's static eval the same as Stockfish's? i.e. about +5?
jhellis3
Posts: 546
Joined: Sat Aug 17, 2013 12:36 am

Re: Funny fortress position

Post by jhellis3 »

Well, when someone creates a perfect eval, I'll be happy to implement that and do away with search entirely. I mean hey, it is just 32m TBs... easy right?
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Funny fortress position

Post by zullil »

jhellis3 wrote: Wed Feb 12, 2020 5:08 pm Well, when someone creates a perfect eval, I'll be happy to implement that and do away with search entirely. I mean hey, it is just 32m TBs... easy right?
Just asking for better static evals of near-tablebase positions :D. Yes, this is very hard, and not particularly interesting. This is currently the greatest source of weakness of engines (IMHO), since such positions are now being routinely reached as leaf nodes of searches of early middlegame positions.
Uri Blass
Posts: 10296
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Funny fortress position

Post by Uri Blass »

zullil wrote: Wed Feb 12, 2020 6:18 pm
jhellis3 wrote: Wed Feb 12, 2020 5:08 pm Well, when someone creates a perfect eval, I'll be happy to implement that and do away with search entirely. I mean hey, it is just 32m TBs... easy right?
Just asking for better static evals of near-tablebase positions :D. Yes, this is very hard, and not particularly interesting. This is currently the greatest source of weakness of engines (IMHO), since such positions are now being routinely reached as leaf nodes of searches of early middlegame positions.
If you allow expensive evaluation then it is easy to produce a better static evaluation.

What about the following evaluation to detect fortess positions?
Let stockfish to play against itself at depth d for some fixed d.
The position should get close to a draw evaluation if the result of the game is a draw.
User avatar
Ovyron
Posts: 4556
Joined: Tue Jul 03, 2007 4:30 am

Re: Funny fortress position

Post by Ovyron »

Uri Blass wrote: Wed Feb 12, 2020 6:30 pm What about the following evaluation to detect fortess positions?
Let stockfish to play against itself at depth d for some fixed d.
The position should get close to a draw evaluation if the result of the game is a draw.
Doesn't work in practice, you can get 100% draws just because the engine fails to find the only move that wins in some deep position which mates it possible to break the fortress every time, and make it lose.
Uri Blass
Posts: 10296
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Funny fortress position

Post by Uri Blass »

Ovyron wrote: Wed Feb 12, 2020 6:33 pm
Uri Blass wrote: Wed Feb 12, 2020 6:30 pm What about the following evaluation to detect fortess positions?
Let stockfish to play against itself at depth d for some fixed d.
The position should get close to a draw evaluation if the result of the game is a draw.
Doesn't work in practice, you can get 100% draws just because the engine fails to find the only move that wins in some deep position which mates it possible to break the fortress every time, and make it lose.
This is only evaluation.

If you search deep enough in that type of positions you search also the move that break the fortress and in that case the result of the game is not going to be a draw.

Of course searching deep enough with an expensive evaluation can take a lot of time that you practically do not have but
I still think that the expensive evaluation can be productive as a second opinion about the position.

If engines give evaluation of +4 pawns I would like to verify that the expensive evaluation does not detect some fortress to have more confidence that the +4 pawns really means winning the game.
User avatar
Ovyron
Posts: 4556
Joined: Tue Jul 03, 2007 4:30 am

Re: Funny fortress position

Post by Ovyron »

Uri Blass wrote: Wed Feb 12, 2020 6:38 pm I still think that the expensive evaluation can be productive as a second opinion about the position.
Probably extra cores could be used for this. Say on a 4CPU, you have 3 cores searching normally as to not slowdown the search, and the last core is checking for fortresses to see if the eval of the other three is real with expensive eval.
jhellis3
Posts: 546
Joined: Sat Aug 17, 2013 12:36 am

Re: Funny fortress position

Post by jhellis3 »

Just asking for better static evals of near-tablebase positions :D.
Bruh, that is 12m.... we don't even have 8m. Meanwhile, the method I implemented handles arbitrary piece count.... Bonus: If you happen to read the code, you will see it accomplishes the results it does by altering the static eval ;).
What about the following evaluation to detect fortess positions?
Let stockfish to play against itself at depth d for some fixed d.
The position should get close to a draw evaluation if the result of the game is a draw.
That is essentially what the pathological search extension does already, in trivial game cycles it extends until it hits a cutoff.
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Funny fortress position

Post by zullil »

jhellis3 wrote: Wed Feb 12, 2020 6:56 pm
Just asking for better static evals of near-tablebase positions :D.
Bruh, that is 12m.... we don't even have 8m. Meanwhile, the method I implemented handles arbitrary piece count.... Bonus: If you happen to read the code, you will see it accomplishes the results it does by altering the static eval ;).
I have no doubt that your method is effective and robust. But at leaves there's no option left for searching. And if the static eval gives +5 rather than something like 0, the engine is not gonna find it's way to that fortress draw.
jhellis3
Posts: 546
Joined: Sat Aug 17, 2013 12:36 am

Re: Funny fortress position

Post by jhellis3 »

But at leaves there's no option left for searching.
Bruh... again. Sure there is... you extend the search. Crystal doesn't have trivial game cycle leaves which are not hard cutoffs ;).

Of course you can't do this for every trivial cycle node due to practical time considerations (so it is limited in non-pv instances to shallow depths), but I guarantee that, if you did such a search, it would complete infinitely quicker than generating, storing, and referencing proper evals for every position.

At any rate, in Crystal, any such nodes on the PV are recursively extended until resolution. It may not be perfect, but I am unaware of any other solution which performs better. If one is known and available, I am happy to implement that.
And if the static eval gives +5 rather than something like 0, the engine is not gonna find it's way to that fortress draw.
Which (again) is why the code alters the static eval ;).