Giter Site home page Giter Site logo

Comments (5)

Disservin avatar Disservin commented on June 2, 2024

Your fen isn't a valid FEN. position fen 3qk1nb/1p3p2/p1r1p1p1/3p4/3P4/2N1BP2/PPPQ1P2/R3K3 w Qk - 0 15 Black cannot castle king side. There's a bishop in the corner not a rook.

from stockfish.

Mercutio1243 avatar Mercutio1243 commented on June 2, 2024

Thank you, this is a good pointer!

Why is Stockfish then accepting the following fen:
position fen 2rqk1nb/1p3p2/p1B1p1p1/3p4/3P4/2N1BP2/PPPQ1P2/R3K3 b Qk - 0 14

from stockfish.

Disservin avatar Disservin commented on June 2, 2024

Probably because the king is in check and chess rules say we cant castle, so we dont try to generate the move and after the king moves we clear all castling squares for the king.

from stockfish.

PGG106 avatar PGG106 commented on June 2, 2024

How the engine reacts to illegal fens should be considered undefined behaviour, you can't rely on the engine consistently saving itself from a crash.
If you want fen validation your best bet currently it to validate the fen before passing it to sf.

from stockfish.

Mercutio1243 avatar Mercutio1243 commented on June 2, 2024

Ok, thank you very much for the super fast response! I fully agree, the error is with the generation of the fens that I am using (not your problem).

For future reference below all the previous fens from that game that I am using were also faulty but did not result in an error. But again, not your issue as PGG106 is pointing out (but maybe interesting for someone else at some point).

rnbqk1nr/ppp1ppb1/6p1/3p4/8/2N5/PPPPPPP1/R1BQKBNR w KQkq - 0 5 -- here still okay
rnbqk1nR/ppp1ppb1/6p1/3p4/8/2N5/PPPPPPP1/R1BQKBN1 b Qkq - 0 5 -- here the rook gets taken but castling rights are preserved for black
rnbqk1nb/ppp1pp2/6p1/3p4/8/2N5/PPPPPPP1/R1BQKBN1 w Qkq - 0 6
rnbqk1nb/ppp1pp2/6p1/3p4/8/2N1P3/PPPP1PP1/R1BQKBN1 b Qkq - 0 6
rnbqk1nb/pp2pp2/6p1/2pp4/8/2N1P3/PPPP1PP1/R1BQKBN1 w Qkq c6 0 7
rnbqk1nb/pp2pp2/6p1/2pp4/8/2N1PN2/PPPP1PP1/R1BQKB2 b Qkq - 1 7
r1bqk1nb/pp2pp2/2n3p1/2pp4/8/2N1PN2/PPPP1PP1/R1BQKB2 w Qkq - 2 8
r1bqk1nb/pp2pp2/2n3p1/2pp4/3P4/2N1PN2/PPP2PP1/R1BQKB2 b Qkq d3 0 8
r2qk1nb/pp2pp2/2n3p1/2pp4/3P2b1/2N1PN2/PPP2PP1/R1BQKB2 w Qkq - 1 9
r2qk1nb/pp2pp2/2n3p1/1Bpp4/3P2b1/2N1PN2/PPP2PP1/R1BQK3 b Qkq - 2 9
r2qk1nb/pp2pp2/2n3p1/1B1p4/3p2b1/2N1PN2/PPP2PP1/R1BQK3 w Qkq - 0 10
r2qk1nb/pp2pp2/2n3p1/1B1p4/3P2b1/2N2N2/PPP2PP1/R1BQK3 b Qkq - 0 10
2rqk1nb/pp2pp2/2n3p1/1B1p4/3P2b1/2N2N2/PPP2PP1/R1BQK3 w Qk - 1 11
2rqk1nb/pp2pp2/2n3p1/1B1p4/3P2b1/2N1BN2/PPP2PP1/R2QK3 b Qk - 2 11
2rqk1nb/pp3p2/2n1p1p1/1B1p4/3P2b1/2N1BN2/PPP2PP1/R2QK3 w Qk - 0 12
2rqk1nb/pp3p2/2n1p1p1/1B1p4/3P2b1/2N1BN2/PPPQ1PP1/R3K3 b Qk - 1 12
2rqk1nb/pp3p2/2n1p1p1/1B1p4/3P4/2N1Bb2/PPPQ1PP1/R3K3 w Qk - 0 13
2rqk1nb/pp3p2/2n1p1p1/1B1p4/3P4/2N1BP2/PPPQ1P2/R3K3 b Qk - 0 13
2rqk1nb/1p3p2/p1n1p1p1/1B1p4/3P4/2N1BP2/PPPQ1P2/R3K3 w Qk - 0 14
2rqk1nb/1p3p2/p1B1p1p1/3p4/3P4/2N1BP2/PPPQ1P2/R3K3 b Qk - 0 14
3qk1nb/1p3p2/p1r1p1p1/3p4/3P4/2N1BP2/PPPQ1P2/R3K3 w Qk - 0 15 -- here stockfish 15.1 crashes

Feel free to mark the issue as closed

from stockfish.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.