Invalid fen

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Invalid fen

Post by Henk »

Stockfish accepts this fen which says that black has short castling rights. That makes no sense.

[d] rrrrkr1R/rr1rr3/8/8/8/8/8/6K1 b k - 0 1
mar
Posts: 2554
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Invalid fen

Post by mar »

Henk wrote:Stockfish accepts this fen which says that black has short castling rights. That makes no sense.

[d] rrrrkr1R/rr1rr3/8/8/8/8/8/6K1 b k - 0 1
My engine accepts that FEN as well.
It assumes it's a valid X-FEN from Chess960.
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: Invalid fen

Post by Henk »

mar wrote:
Henk wrote:Stockfish accepts this fen which says that black has short castling rights. That makes no sense.

[d] rrrrkr1R/rr1rr3/8/8/8/8/8/6K1 b k - 0 1
My engine accepts that FEN as well.
It assumes it's a valid X-FEN from Chess960.
Engines. It's all crap.
mar
Posts: 2554
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Invalid fen

Post by mar »

Henk wrote:Engines. It's all crap.
Blame the GUIs :) Arena's FRC supports is certainly crap and I had to add a hack to support FRC under Arena.
My engine simply ignores UCI_Chess960 flag because it can be determined directly from the (X-/S-/FEN).
You may/may not like this approach. I like it because it makes the code simpler.
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: Invalid fen

Post by Henk »

mar wrote:
Henk wrote:Engines. It's all crap.
Blame the GUIs :) Arena's FRC supports is certainly crap and I had to add a hack to support FRC under Arena.
My engine simply ignores UCI_Chess960 flag because it can be determined directly from the (X-/S-/FEN).
You may/may not like this approach. I like it because it makes the code simpler.
At least user should see a warning if it types an invalid fen. But maybe engines assume there are no Spartan users anymore that create fens. O yes it really assumes Spartan users.
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: Invalid fen

Post by Henk »

Actually problem was that Skipper computed perft(3) = 17838 instead of 17835. Because if short castling rights are set wrongly in the fen, Skipper doesn't correct them and a move like f8-h8 does not update them. For why should it be updated. So it thinks that after f8-h8 it can castle short.
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Invalid fen

Post by lucasart »

Henk wrote:Stockfish accepts this fen which says that black has short castling rights. That makes no sense.

[d] rrrrkr1R/rr1rr3/8/8/8/8/8/6K1 b k - 0 1
what's the point of this trolling post? to ask a question to which you know the answer?
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: Invalid fen

Post by Henk »

lucasart wrote:
Henk wrote:Stockfish accepts this fen which says that black has short castling rights. That makes no sense.

[d] rrrrkr1R/rr1rr3/8/8/8/8/8/6K1 b k - 0 1
what's the point of this trolling post? to ask a question to which you know the answer?
Yes to troll only. Stockfish and more engines allow import of invalid fens. As I said they should at least give a warning. In the fen given above the user probably meant q instead of k. For castling on the queen side makes sense.
Removing seven black rooks in this position would make it a more realistic example. [b8, c8, d8] and the rooks on the seventh row.
User avatar
hgm
Posts: 27789
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Invalid fen

Post by hgm »

Well, being user friendly does not bring any Elo, I guess. We should not forget that the purpose of the Stockfish project is to inflict maximal hurt on its users. That needs high Elo to make sure there will be any users, and then mess up anything else as long as it doesn't cost any Elo. :lol:
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Invalid fen

Post by lucasart »

hgm wrote:Well, being user friendly does not bring any Elo, I guess. We should not forget that the purpose of the Stockfish project is to inflict maximal hurt on its users. That needs high Elo to make sure there will be any users, and then mess up anything else as long as it doesn't cost any Elo. :lol:
UCI is made for engine <-> GUI communication, so the engine can assume correct input, and any invalid input is a GUI bug. "Inflicting pain" to some smart ass user who knowingly inputs wrong FEN to fuel his trolling posts on talkchess… maybe that's a good thing ?
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.