Position Causes Stockfish and Komodo To Crash

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Sesse
Posts: 300
Joined: Mon Apr 30, 2018 11:51 pm

Re: Position Causes Stockfish and Komodo To Crash

Post by Sesse »

syzygy wrote: Sun Dec 20, 2020 2: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: 2272
Joined: Mon Sep 29, 2008 1:50 am

Re: Position Causes Stockfish and Komodo To Crash

Post by Michel »

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.

[d]8/8/8/1k6/3Pp3/8/8/4KQ2 b - d3 0 1
Ideas=science. Simplification=engineering.
Without ideas there is nothing to simplify.
Sesse
Posts: 300
Joined: Mon Apr 30, 2018 11:51 pm

Re: Position Causes Stockfish and Komodo To Crash

Post by Sesse »

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: 1969
Joined: Wed Jul 13, 2011 9:04 pm
Location: Madrid, Spain.

Re: Position causes StockFish and Komodo to crash.

Post by Ajedrecista »

Hello Michel:
Michel wrote: Tue Dec 22, 2020 10: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.

[d]8/8/8/1k6/3Pp3/8/8/4KQ2 b - d3 0 1
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: 2272
Joined: Mon Sep 29, 2008 1:50 am

Re: Position causes StockFish and Komodo to crash.

Post by Michel »

Ajedrecista wrote: Tue Dec 22, 2020 6:35 pm Hello Michel:
Michel wrote: Tue Dec 22, 2020 10: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.

[d]8/8/8/1k6/3Pp3/8/8/4KQ2 b - d3 0 1
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: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Position Causes Stockfish and Komodo To Crash

Post by Ras »

Michel wrote: Tue Dec 22, 2020 10:36 amSF 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: 937
Joined: Fri Mar 10, 2006 4:29 pm
Location: Germany

Re: Position causes StockFish and Komodo to crash.

Post by Joerg Oster »

Michel wrote: Tue Dec 22, 2020 7:37 pm
Ajedrecista wrote: Tue Dec 22, 2020 6:35 pm Hello Michel:
Michel wrote: Tue Dec 22, 2020 10: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.

[d]8/8/8/1k6/3Pp3/8/8/4KQ2 b - d3 0 1
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: 1969
Joined: Wed Jul 13, 2011 9:04 pm
Location: Madrid, Spain.

Re: Position causes StockFish and Komodo to crash.

Post by Ajedrecista »

Hello again:
Michel wrote: Tue Dec 22, 2020 7: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: 2272
Joined: Mon Sep 29, 2008 1:50 am

Re: Position causes StockFish and Komodo to crash.

Post by Michel »

Joerg Oster wrote: Tue Dec 22, 2020 7:55 pm
Michel wrote: Tue Dec 22, 2020 7:37 pm
Ajedrecista wrote: Tue Dec 22, 2020 6:35 pm Hello Michel:
Michel wrote: Tue Dec 22, 2020 10: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.

[d]8/8/8/1k6/3Pp3/8/8/4KQ2 b - d3 0 1
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: 937
Joined: Fri Mar 10, 2006 4:29 pm
Location: Germany

Re: Position causes StockFish and Komodo to crash.

Post by Joerg Oster »

Michel wrote: Tue Dec 22, 2020 8:48 pm
Joerg Oster wrote: Tue Dec 22, 2020 7:55 pm
Michel wrote: Tue Dec 22, 2020 7: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