Position Causes Stockfish and Komodo To Crash

Discussion of chess software programming and technical issues.

Moderators: hgm, Dann Corbit, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Sesse
Posts: 274
Joined: Mon Apr 30, 2018 9:51 pm
Contact:

Re: Position Causes Stockfish and Komodo To Crash

Post by Sesse » Sun Dec 20, 2020 1:13 pm

syzygy wrote:
Sun Dec 20, 2020 1:08 pm
In my browser the diagram in your post has extra squares i1, j1, k1, l1 with a black bishop on j1 and a black rook on k1. But in this reply those extra squares seem to disappear...
Yeah, I noticed so myself. They didn't appear in preview when I wrote the post, however…

Michel
Posts: 2159
Joined: Sun Sep 28, 2008 11:50 pm

Re: Position Causes Stockfish and Komodo To Crash

Post by Michel » Tue Dec 22, 2020 9:36 am

An interesting issue here https://github.com/official-stockfish/S ... ssues/3270

SF move generation assumes (correctly it seems) that in a game an escape move can never be an ep move. But of course one can create positions (without parent) in which there is an escape move which is indeed an ep move.

Ideas=science. Simplification=engineering.
Without ideas there is nothing to simplify.

Sesse
Posts: 274
Joined: Mon Apr 30, 2018 9:51 pm
Contact:

Re: Position Causes Stockfish and Komodo To Crash

Post by Sesse » Tue Dec 22, 2020 1:17 pm

This just makes me even more convinced you'll need to just brute-force the possible unmoves to see if there are any. :-)

User avatar
Ajedrecista
Posts: 1534
Joined: Wed Jul 13, 2011 7:04 pm
Location: Madrid, Spain.
Contact:

Re: Position causes StockFish and Komodo to crash.

Post by Ajedrecista » Tue Dec 22, 2020 5:35 pm

Hello Michel:
Michel wrote:
Tue Dec 22, 2020 9:36 am
An interesting issue here https://github.com/official-stockfish/S ... ssues/3270

SF move generation assumes (correctly it seems) that in a game an escape move can never be an ep move. But of course one can create positions (without parent) in which there is an escape move which is indeed an ep move.

What about?

[d]8/8/8/4k3/2p5/8/3P4/4K3 w - - 0 1

Then 1.- d4+, cxd3 e.p. is possible and perfectly legal. It is true that the own moving pawn gives check, which might not fall in the same category as the example of Ke1, Qf1, Pd4; kb5, pe4 without legal previous move of d2-d4 because the black king was already in check by the white queen and the white pawn itself does not give check. A definition of 'escape move' would be useful. Avoiding check given by any opposite piece regardless if it has just moved or not?

Regards from Spain.

Ajedrecista.

Michel
Posts: 2159
Joined: Sun Sep 28, 2008 11:50 pm

Re: Position causes StockFish and Komodo to crash.

Post by Michel » Tue Dec 22, 2020 6:37 pm

Ajedrecista wrote:
Tue Dec 22, 2020 5:35 pm
Hello Michel:
Michel wrote:
Tue Dec 22, 2020 9:36 am
An interesting issue here https://github.com/official-stockfish/S ... ssues/3270

SF move generation assumes (correctly it seems) that in a game an escape move can never be an ep move. But of course one can create positions (without parent) in which there is an escape move which is indeed an ep move.

What about?

[d]8/8/8/4k3/2p5/8/3P4/4K3 w - - 0 1

Then 1.- d4+, cxd3 e.p. is possible and perfectly legal. It is true that the own moving pawn gives check, which might not fall in the same category as the example of Ke1, Qf1, Pd4; kb5, pe4 without legal previous move of d2-d4 because the black king was already in check by the white queen and the white pawn itself does not give check. A definition of 'escape move' would be useful. Avoiding check given by any opposite piece regardless if it has just moved or not?

Regards from Spain.

Ajedrecista.
Thanks. It seems I was wrong. In your position SF does find the ep move. Then I wonder why it does not consider the ep move in the parentless position...
Ideas=science. Simplification=engineering.
Without ideas there is nothing to simplify.

Ras
Posts: 1745
Joined: Tue Aug 30, 2016 6:19 pm
Full name: Rasmus Althoff
Contact:

Re: Position Causes Stockfish and Komodo To Crash

Post by Ras » Tue Dec 22, 2020 6:51 pm

Michel wrote:
Tue Dec 22, 2020 9:36 am
SF move generation assumes (correctly it seems) that in a game an escape move can never be an ep move.
Consider the following position:

[D]8/6Q1/8/7k/7p/8/6P1/7K w - - 0 1

If White now plays g2-g4+, then the only legal move for Black will be hxg3 e.p., and Stockfish 11 and 12 find that move if given as:

Code: Select all

position fen 8/6Q1/8/7k/7p/8/6P1/7K w - - 0 1 moves g2g4
Both Stockfish versions also find that if the subsequent position with Black to move is given directly as fen with e.p. square, i.e. like:

Code: Select all

position fen 8/6Q1/8/7k/6Pp/8/8/7K b - g3 1 1
Rasmus Althoff
https://www.ct800.net

Joerg Oster
Posts: 815
Joined: Fri Mar 10, 2006 3:29 pm
Location: Germany

Re: Position causes StockFish and Komodo to crash.

Post by Joerg Oster » Tue Dec 22, 2020 6:55 pm

Michel wrote:
Tue Dec 22, 2020 6:37 pm
Ajedrecista wrote:
Tue Dec 22, 2020 5:35 pm
Hello Michel:
Michel wrote:
Tue Dec 22, 2020 9:36 am
An interesting issue here https://github.com/official-stockfish/S ... ssues/3270

SF move generation assumes (correctly it seems) that in a game an escape move can never be an ep move. But of course one can create positions (without parent) in which there is an escape move which is indeed an ep move.

What about?

[d]8/8/8/4k3/2p5/8/3P4/4K3 w - - 0 1

Then 1.- d4+, cxd3 e.p. is possible and perfectly legal. It is true that the own moving pawn gives check, which might not fall in the same category as the example of Ke1, Qf1, Pd4; kb5, pe4 without legal previous move of d2-d4 because the black king was already in check by the white queen and the white pawn itself does not give check. A definition of 'escape move' would be useful. Avoiding check given by any opposite piece regardless if it has just moved or not?

Regards from Spain.

Ajedrecista.
Thanks. It seems I was wrong. In your position SF does find the ep move. Then I wonder why it does not consider the ep move in the parentless position...
Why generating an illegal move?
Jörg Oster

User avatar
Ajedrecista
Posts: 1534
Joined: Wed Jul 13, 2011 7:04 pm
Location: Madrid, Spain.
Contact:

Re: Position causes StockFish and Komodo to crash.

Post by Ajedrecista » Tue Dec 22, 2020 7:07 pm

Hello again:
Michel wrote:
Tue Dec 22, 2020 6:37 pm
Thanks. It seems I was wrong. In your position SF does find the ep move. Then I wonder why it does not consider the ep move in the parentless position...
The key could be in movegen.cpp. There is a three-line comment at current lines 159-161:

Code: Select all

// An en passant capture can be an evasion only if the checking piece
// is the double pushed pawn and so is in the target. Otherwise this
// is a discovery check and we are forced to do otherwise.
Which might explain the feature. A programmer opinion is valuable since I am not a programmer.

Regards from Spain.

Ajedrecista.

Michel
Posts: 2159
Joined: Sun Sep 28, 2008 11:50 pm

Re: Position causes StockFish and Komodo to crash.

Post by Michel » Tue Dec 22, 2020 7:48 pm

Joerg Oster wrote:
Tue Dec 22, 2020 6:55 pm
Michel wrote:
Tue Dec 22, 2020 6:37 pm
Ajedrecista wrote:
Tue Dec 22, 2020 5:35 pm
Hello Michel:
Michel wrote:
Tue Dec 22, 2020 9:36 am
An interesting issue here https://github.com/official-stockfish/S ... ssues/3270

SF move generation assumes (correctly it seems) that in a game an escape move can never be an ep move. But of course one can create positions (without parent) in which there is an escape move which is indeed an ep move.

What about?

[d]8/8/8/4k3/2p5/8/3P4/4K3 w - - 0 1

Then 1.- d4+, cxd3 e.p. is possible and perfectly legal. It is true that the own moving pawn gives check, which might not fall in the same category as the example of Ke1, Qf1, Pd4; kb5, pe4 without legal previous move of d2-d4 because the black king was already in check by the white queen and the white pawn itself does not give check. A definition of 'escape move' would be useful. Avoiding check given by any opposite piece regardless if it has just moved or not?

Regards from Spain.

Ajedrecista.
Thanks. It seems I was wrong. In your position SF does find the ep move. Then I wonder why it does not consider the ep move in the parentless position...
Why generating an illegal move?
Why do you consider the ep move illegal?
Ideas=science. Simplification=engineering.
Without ideas there is nothing to simplify.

Joerg Oster
Posts: 815
Joined: Fri Mar 10, 2006 3:29 pm
Location: Germany

Re: Position causes StockFish and Komodo to crash.

Post by Joerg Oster » Tue Dec 22, 2020 7:55 pm

Michel wrote:
Tue Dec 22, 2020 7:48 pm
Joerg Oster wrote:
Tue Dec 22, 2020 6:55 pm
Michel wrote:
Tue Dec 22, 2020 6:37 pm
Thanks. It seems I was wrong. In your position SF does find the ep move. Then I wonder why it does not consider the ep move in the parentless position...
Why generating an illegal move?
Why do you consider the ep move illegal?
Because this kind of move can NEVER occur in a legal game of chess.
So I can only conclude it must be an illegal move.

The illegal position makes it look like a valid move, doesn't it? :D
Jörg Oster

Post Reply