mcostalba wrote:Sven Schüle wrote: But that still means you allow a dot in an FEN string, just for reasons of reusing the PieceToChar map?
Yes, I am a very bad guy
And, BTW, if you want to see some spectacular crash you can just place a series of consecutive slashes '/' in the fen. Placing a dot probably would go unoticed (is considered an empty square because it is at index 0, just a guess, not tested). The point is, or you commit to do error handling in fen parsing or you don't...and I don't because I _want_ to assume GUI sends correct fens. If I was developing a GUI probably I'd be more careful, but for an engine it is ok like this, at least it is ok for me.
Multiple slashes do not crash SF, to my surprise (I still have SF2.1 on that PC here):
Code: Select all
bash$ printf "position fen K6k///////////////////////// w - - 0 1\ngo"|./stockfish-21-32-ja.exe
Stockfish 2.1 JA by Tord Romstad, Marco Costalba and Joona Kiiski
info depth 1
info depth 1 seldepth 1 multipv 1 score cp 0 nodes 7 nps 112 time 62 pv a8a7
info nodes 7 nps 112 time 62
bestmove a8a7
Stockfish can also play 9x9 chess:
Code: Select all
bash$ printf "position fen 9/9/9/9/9/9/9/9/7Kk w - - 0 1\ngo"|./stockfish-21-32-ja.exe
Stockfish 2.1 JA by Tord Romstad, Marco Costalba and Joona Kiiski
info depth 1
info depth 1 seldepth 1 multipv 1 score cp 0 nodes 7 nps 152 time 46 pv h1g1
info nodes 7 nps 112 time 62
bestmove h1g1
But two kings are required, though:
Code: Select all
bash$ printf "position fen 9/9/9/9/9/9/9/9/9 w - - 0 1\ngo"|./stockfish-21-32-ja.exe
Stockfish 2.1 JA by Tord Romstad, Marco Costalba and Joona Kiiski
<crashes>
This is subject of personal taste, of course. Both HGM and you say sth. like "crap in - crap out". I say "never crash on external input". That's two completely different positions, and a personal decision which one to follow, in this case for FEN parsing.
Sven