lucasart / c-chess-cli

Command Line Interface for UCI Chess engines written in C
GNU General Public License v3.0
70 stars 9 forks source link

Engine is unresponsive (Fridolin 2.00) #19

Closed rchastain closed 4 years ago

rchastain commented 4 years ago

Hello! I have just made a quick test with the latest code. As far as I see, it works perfectly. I just encounter a problem with a game including Fridolin 2.00.

[roland@localhost c-chess-cli (master)]$ sh test.sh
[0] engine ../fridolin/200/src/Fridolin is unresponsive
[roland@localhost c-chess-cli (master)]$ 

I see in the log that the engine doesn't answer to uci command.

../fridolin/200/src/Fridolin <- uci
deadline: ../fridolin/200/src/Fridolin failed to respond by 2418738. Caught by main thread 1ms after.
etc.

I wonder what can be the problem with that engine, who works well under CuteChess. When you have time, could you give it a try? Maybe I made something wrong, but I don't see what.

lucasart commented 4 years ago

Can you please provide:

rchastain commented 4 years ago

Can you please provide:

* minimal reproduction steps (test.sh is not useful).

* recipie for compiling Fridolin, so we use the same engine.

Here is the content of test.sh:

./c-chess-cli \
-log \
-each tc=4 option.Threads=1 \
    -engine cmd=../fridolin/200/src/Fridolin \
    -engine cmd=../octochess/octochess \
    -games 2 -concurrency 1 -openings test/chess960.epd -random -repeat \
    -pgnout out.pgn

And to compile the engine:

[roland@localhost src]$ make
lucasart commented 4 years ago

Thanks. I can reproduce, using official compile from the zip file (didn't even run make):

$ ./c-chess-cli -each cmd=../Fridolin-3.10/bin/linux/Fridolin310 tc=2+0.02 -engine name=e2 -engine name=e2 -openings ./test/chess960.epd -log
[0] engine e2 is unresponsive

If I remove -openings ./test/chess960.epd, no problem, which is a hint that Fridolin may some problem with Chess960. Note that c-chess-cli will auto-detect Chess960 and send setoption name UCI_Chess960 value true if the FEN is detected to require Chess960.

The [0] indicates that the main thread (id 0) had to come to the rescue and kill c-chess-cli, because the worker thread (id 1) was blocked on I/O, waiting for Fridolin to reply, which it didn't. c-chess-cli worked as expected:

lucasart commented 4 years ago

Fridolin is broken (for Chess960 at least). Here's a minimal session in Fridolin to reproduce the problem, without c-chess-cli:

$ ../Fridolin-3.10/bin/linux/Fridolin310 
uci
[...]
uciok
ucinewgame
setoption name UCI_Chess960 value true

position fen bb3rkr/p4p2/4pp2/2Q5/4P2p/4N2P/P2q1PP1/1B3RKR b KQkq - 0 15 moves f8d8 b1c2 g8g7
go depth 8
info depth 1 seldepth 3 time 1 nodes 60 nps 60000 score cp 10 hashfull 0 tbhits 0 pv f1b1
info depth 2 seldepth 7 time 1 nodes 327 nps 327000 score cp -25 hashfull 0 tbhits 0 pv f1b1 b8f4
info depth 3 seldepth 9 time 2 nodes 3135 nps 1567500 score cp 3 hashfull 0 tbhits 0 pv f1d1 d2e2 d1b1
info depth 4 seldepth 11 time 3 nodes 5378 nps 1792666 score cp -37 hashfull 0 tbhits 0 pv f1d1 d2e2 d1b1 d8d2
info depth 5 seldepth 17 time 6 nodes 14357 nps 2392833 score cp -62 hashfull 0 tbhits 0 pv f1d1 d2e2 d1c1 d8d2 f2f3
info depth 6 seldepth 19 time 17 nodes 47124 nps 2772000 score cp -121 hashfull 1 tbhits 0 pv f1d1 d2e2 d1d8 e2e1 e3f1 h8d8 c5e7
info depth 7 seldepth 23 time 39 nodes 103373 nps 2650589  cp -107 hashfull 2 tbhits 0 pv c5e7 d2d6 e7d6 b8d6 f1b1 a8c6 c2d3
info depth 8 seldepth 22 time 73 nodes 199931 nps 2738780 score cp -108 hashfull 5 tbhits 0 pv f1d1 d2e2 d1d8 e2e1 e3f1 h8d8 c5e3 e1a1 a2a3
info time 73 nodes 199931 nps 2738780 cpuload 1000 hashfull 5 tbhits 0
bestmove f1d1 ponder d2e2

position fen bb3rkr/p4p2/4pp2/2Q5/4P2p/4N2P/P2q1PP1/1B3RKR b KQkq - 0 15 moves f8d8 b1c2 g8g7 f1d1
go depth 8
info depth 1 seldepth 5 time 0 nodes 117 nps 117 score cp 28 hashfull 0 tbhits 0 pv d8c8
info depth 2 seldepth 7 time 0 nodes 360 nps 360 score cp 108 hashfull 0 tbhits 0 pv d2e2 d1d8
info depth 3 seldepth 8 time 0 nodes 538 nps 538 score cp 108 hashfull 0 tbhits 0 pv d2e2 d1d8
info depth 4 seldepth 9 time 0 nodes 708 nps 708 score cp 108 hashfull 0 tbhits 0 pv d2e2 d1d8
info depth 5 seldepth 10 time 0 nodes 878 nps 878 score cp 108 hashfull 0 tbhits 0 pv d2e2 d1d8
info depth 6 seldepth 10 time 1 nodes 1127 nps 1127000 score cp 108 hashfull 0 tbhits 0 pv d2e2 d1d8
info depth 7 seldepth 11 time 1 nodes 1394 nps 1394000 score cp 108 hashfull 0 tbhits 0 pv d2e2 d1d8
info depth 8 seldepth 21 time 25 nodes 70695 nps 2827800 score cp 70 hashfull 2 tbhits 0 pv d2e2 O-O d8c8 c5e7 c8c2 d1d7 h8f8 e3c2
info time 25 nodes 70695 nps 2827800 cpuload 960 hashfull 2 tbhits 0
bestmove d2e2
info string No legal ponder move!

position fen bb3rkr/p4p2/4pp2/2Q5/4P2p/4N2P/P2q1PP1/1B3RKR b KQkq - 0 15 moves f8d8 b1c2 g8g7 f1d1 d2e2
go depth 9
info depth 1 seldepth 8 time 0 nodes 173 nps 173 score cp 3 hashfull 0 tbhits 0 pv d1b1
info depth 2 seldepth 9 time 1 nodes 420 nps 420000 score cp -31 hashfull 0 tbhits 0 pv d1b1 d8d2
info depth 3 seldepth 12 time 1 nodes 1355 nps 1355000 score cp -70 hashfull 0 tbhits 0 pv O-O d8c8
info depth 4 seldepth 9 time 1 nodes 2001 nps 2001000 score cp -70 hashfull 0 tbhits 0 pv O-O d8c8
info depth 5 seldepth 12 time 2 nodes 4134 nps 2067000 score cp -70 hashfull 0 tbhits 0 pv O-O d8c8
info depth 6 seldepth 25 time 6 nodes 14684 nps 2447333 score cp -70 hashfull 0 tbhits 0 pv O-O d8c8
info depth 7 seldepth 14 time 6 nodes 15870 nps 2645000 score cp -70 hashfull 0 tbhits 0 pv O-O d8c8
info depth 8 seldepth 22 time 74 nodes 215581 nps 2913256 score cp -70 hashfull 6 tbhits 0 pv O-O d8c8 c5e7 c8c2 e3c2 e2c2 d1d7 h8f8
info depth 9 seldepth 28 time 178 nodes 516631 nps 2902421 score cp -108 hashfull 15 tbhits 0 pv O-O d8c8 c5e7 c8c2 e3c2 e2c2 d1d7 h8f8 e7e6
info time 178 nodes 516631 nps 2902421 cpuload 988 hashfull 15 tbhits 0
info string No legal best move!

And indeed it hangs forever at this point. You can verify by pasting the commands in Frido directly. It doesn't crash, but really hangs, hence the connection lost.

Not to mention that O-O is illegal in Fridolin's PV (UCI uses LAN not SAN). c-chess-cli notices this btw:

WARNING: invalid PV
        fen: 'bb1r3r/p4pk1/4pp2/2Q5/4P2p/4N2P/P1Bq1PP1/3R2KR b K - 4 17'
        pv: 'd2e2 d1c1 d8c8 c5d4 h8d8 d4b4 b8g3 O-O'
        'O-O' starts with an illegal move
rchastain commented 4 years ago

Thank you for the test and for the detailed explanation. I need time to study your answer.

Just an idea. Maybe Fridolin doesn't support the KQkq notation for castling in Chess960 mode? If I remember correctly, CuteChess uses the "Shredder-FEN" convention. And (tell me if I am wrong), you decided to use the "X-FEN" notation, isn't it?

Anyway, it's a good new that the problem doesn't come from c-chess-cli. So with your permission I close the issue. I will now test the tournament function.

Regards.

Roland

lucasart commented 4 years ago

Just an idea. Maybe Fridolin doesn't support the KQkq notation for castling in Chess960 mode?

I tried. You can verify with the above session, changing to Shredder FEN, Fridolin exhibits the same problems.

If I remember correctly, CuteChess uses the "Shredder-FEN" convention. And (tell me if I am wrong), you decided to use the "X-FEN" notation, isn't it?

No, the choice is not made by c-chess-cli, which simply reads FEN from the EPD file, and send them as they are to the engine. I believe cutechess-cli behaves the same way.

The choice is (and should be) made by the user, who provides the EPD file. It's just that test/chess960.epd happens to use X-FEN. But you can give a different EPD file with Shredder-FEN positions, or even mix X-FEN and Shredder-FEN in the same file, or even mix Standard Chess and X-FEN 960 and Shredder-FEN 960 in the same file.