cutechess-cli 0.8.0 beta (with pondering)

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

mvk
Posts: 589
Joined: Tue Jun 04, 2013 10:15 pm

Re: cutechess-cli 0.8.0 beta (with pondering)

Post by mvk »

That is nice news. I'm on the travelling now, but I can start some tests when I'm back home next week.
[Account deleted]
Ferdy
Posts: 4853
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: cutechess-cli 0.8.0 beta (with pondering)

Post by Ferdy »

ilari wrote:
Ferdy wrote:Can't download the win32 ATM, webpage is not available.
Maybe mbnet was doing maintenance. The file should be available now. I have removed the earlier betas though.
I just compile the source. One thing I observed is that cutechess is still sending a position without legal move to the engine, but it is not sending the go command so no problem there.
Perhaps it is better not to send the position without a legal move in the first place.
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: cutechess-cli 0.8.0 beta (with pondering)

Post by ilari »

Ferdy wrote:
ilari wrote:
Ferdy wrote:Can't download the win32 ATM, webpage is not available.
Maybe mbnet was doing maintenance. The file should be available now. I have removed the earlier betas though.
I just compile the source. One thing I observed is that cutechess is still sending a position without legal move to the engine, but it is not sending the go command so no problem there.
Perhaps it is better not to send the position without a legal move in the first place.
I'm not sure I follow. What do you mean by "without a legal move"? Does cutechess send a position with an illegal move somewhere?

After an engine makes a move cutechess sends the position after the ponder move to the engine, followed by "isready". While waiting for "readyok" it's possible that the opponent sends a "bestmove" really quickly (eg. because of ponderhit, easy move etc.). Then the "go ponder" to the first engine is cancelled and the engine gets a new position and "go" command. Is this what you meant?
Ferdy
Posts: 4853
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: cutechess-cli 0.8.0 beta (with pondering)

Post by Ferdy »

ilari wrote:
Ferdy wrote:
ilari wrote:
Ferdy wrote:Can't download the win32 ATM, webpage is not available.
Maybe mbnet was doing maintenance. The file should be available now. I have removed the earlier betas though.
I just compile the source. One thing I observed is that cutechess is still sending a position without legal move to the engine, but it is not sending the go command so no problem there.
Perhaps it is better not to send the position without a legal move in the first place.
I'm not sure I follow. What do you mean by "without a legal move"? Does cutechess send a position with an illegal move somewhere?

After an engine makes a move cutechess sends the position after the ponder move to the engine, followed by "isready". While waiting for "readyok" it's possible that the opponent sends a "bestmove" really quickly (eg. because of ponderhit, easy move etc.). Then the "go ponder" to the first engine is cancelled and the engine gets a new position and "go" command. Is this what you meant?
Here Floyd is mated, yet cutechess still sends the position to Floyd.

Code: Select all

65026 <Floyd_0.7_w32(1): bestmove h7h6
65026 >D2015.1.275(0): ponderhit
65026 <D2015.1.275(0): info depth 5 seldepth 2 score mate 1 time 1 nodes 101 nps 101000 tbhits 0 pv b8h8
65026 <D2015.1.275(0): info depth 6 seldepth 2 score mate 1 time 1 nodes 121 nps 121000 tbhits 0 pv b8h8
65026 <D2015.1.275(0): info depth 7 seldepth 2 score mate 1 time 1 nodes 141 nps 141000 tbhits 0 pv b8h8
65027 <D2015.1.275(0): info depth 8 seldepth 2 score mate 1 time 1 nodes 161 nps 161000 tbhits 0 pv b8h8
65027 <D2015.1.275(0): info depth 9 seldepth 2 score mate 1 time 1 nodes 182 nps 182000 tbhits 0 pv b8h8
65027 <D2015.1.275(0): info depth 10 seldepth 2 score mate 1 time 1 nodes 203 nps 203000 tbhits 0 pv b8h8
65027 <D2015.1.275(0): info depth 11 seldepth 14 score mate 1 time 4 nodes 8184 nps 2046000 tbhits 0 pv b8h8
65031 <D2015.1.275(0): info depth 12 seldepth 14 score mate 1 time 10 nodes 24091 nps 2409100 tbhits 0 pv b8h8
65031 <D2015.1.275(0): info time 10 nodes 24091
65031 <D2015.1.275(0): bestmove b8h8
65031 >Floyd_0.7_w32(1): position startpos moves g1f3 g7g6 d2d4 f8g7 g2g3 d7d6 f1g2 f7f5 c2c3 g8f6 d1b3 c7c6 e1g1 h8f8 c1e3 f6g4 e3d2 d8b6 b1a3 b6b3 a2b3 b8d7 a3c4 h7h6 c4a5 e8f7 f3e1 g4f6 e1d3 f6e4 d2e3 d7f6 f2f3 f6d5 e3c1 e4g5 e2e4 d5f6 e4e5 f6d5 c1d2 d6e5 d3e5 g7e5 d4e5 f5f4 f1e1 f7g7 c3c4 d5e3 d2e3 f4e3 e1e3 f8d8 g1f2 a8b8 b3b4 d8d2 e3e2 d2d3 f3f4 g5h3 f2e1 c8g4 g2h3 g4h3 e2d2 d3d2 e1d2 h3f5 d2e3 f5e6 h2h4 h6h5 a1d1 e6f5 d1d4 g7f7 b2b3 f7g7 d4d2 f5g4 e3d4 g4f3 d2f2 f3h1 f2f1 h1g2 f1g1 g2f3 c4c5 b7b6 c5b6 a7b6 a5c4 f3g4 g1a1 b8d8 d4e3 b6b5 c4a5 g4f5 a5c6 d8d3 e3f2 f5e4 c6e7 d3f3 f2e2 f3g3 a1a7 g3b3 e7c8 g7h8 e5e6 e4f5 e6e7 b3b2 e2e3 b2b3 e3d4 b3b4 d4d5 b4e4 c8d6 e4e7 a7e7 b5b4 d6f5 g6f5 d5e6 b4b3 e7b7 h8g8 e6f6 b3b2 b7b2 g8h7 b2b8 h7h6 b8h8
65033 >D2015.1.275(0): isready
65033 >Floyd_0.7_w32(1): isready
65033 <D2015.1.275(0): readyok
65033 <Floyd_0.7_w32(1): readyok
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: cutechess-cli 0.8.0 beta (with pondering)

Post by ilari »

Ferdy wrote:Here Floyd is mated, yet cutechess still sends the position to Floyd.

Code: Select all

65026 <Floyd_0.7_w32(1): bestmove h7h6
65026 >D2015.1.275(0): ponderhit
65026 <D2015.1.275(0): info depth 5 seldepth 2 score mate 1 time 1 nodes 101 nps 101000 tbhits 0 pv b8h8
65026 <D2015.1.275(0): info depth 6 seldepth 2 score mate 1 time 1 nodes 121 nps 121000 tbhits 0 pv b8h8
65026 <D2015.1.275(0): info depth 7 seldepth 2 score mate 1 time 1 nodes 141 nps 141000 tbhits 0 pv b8h8
65027 <D2015.1.275(0): info depth 8 seldepth 2 score mate 1 time 1 nodes 161 nps 161000 tbhits 0 pv b8h8
65027 <D2015.1.275(0): info depth 9 seldepth 2 score mate 1 time 1 nodes 182 nps 182000 tbhits 0 pv b8h8
65027 <D2015.1.275(0): info depth 10 seldepth 2 score mate 1 time 1 nodes 203 nps 203000 tbhits 0 pv b8h8
65027 <D2015.1.275(0): info depth 11 seldepth 14 score mate 1 time 4 nodes 8184 nps 2046000 tbhits 0 pv b8h8
65031 <D2015.1.275(0): info depth 12 seldepth 14 score mate 1 time 10 nodes 24091 nps 2409100 tbhits 0 pv b8h8
65031 <D2015.1.275(0): info time 10 nodes 24091
65031 <D2015.1.275(0): bestmove b8h8
65031 >Floyd_0.7_w32(1): position startpos moves g1f3 g7g6 d2d4 f8g7 g2g3 d7d6 f1g2 f7f5 c2c3 g8f6 d1b3 c7c6 e1g1 h8f8 c1e3 f6g4 e3d2 d8b6 b1a3 b6b3 a2b3 b8d7 a3c4 h7h6 c4a5 e8f7 f3e1 g4f6 e1d3 f6e4 d2e3 d7f6 f2f3 f6d5 e3c1 e4g5 e2e4 d5f6 e4e5 f6d5 c1d2 d6e5 d3e5 g7e5 d4e5 f5f4 f1e1 f7g7 c3c4 d5e3 d2e3 f4e3 e1e3 f8d8 g1f2 a8b8 b3b4 d8d2 e3e2 d2d3 f3f4 g5h3 f2e1 c8g4 g2h3 g4h3 e2d2 d3d2 e1d2 h3f5 d2e3 f5e6 h2h4 h6h5 a1d1 e6f5 d1d4 g7f7 b2b3 f7g7 d4d2 f5g4 e3d4 g4f3 d2f2 f3h1 f2f1 h1g2 f1g1 g2f3 c4c5 b7b6 c5b6 a7b6 a5c4 f3g4 g1a1 b8d8 d4e3 b6b5 c4a5 g4f5 a5c6 d8d3 e3f2 f5e4 c6e7 d3f3 f2e2 f3g3 a1a7 g3b3 e7c8 g7h8 e5e6 e4f5 e6e7 b3b2 e2e3 b2b3 e3d4 b3b4 d4d5 b4e4 c8d6 e4e7 a7e7 b5b4 d6f5 g6f5 d5e6 b4b3 e7b7 h8g8 e6f6 b3b2 b7b2 g8h7 b2b8 h7h6 b8h8
65033 >D2015.1.275(0): isready
65033 >Floyd_0.7_w32(1): isready
65033 <D2015.1.275(0): readyok
65033 <Floyd_0.7_w32(1): readyok
Oh, that. I'm pretty sure that happens even without pondering. And I'm not really sure if that should be changed because some engines may want to get the final move too (for logging, learning, etc.).
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: cutechess-cli 0.8.0 beta (with pondering)

Post by ilari »

petero2 wrote:
ilari wrote:
petero2 wrote:Hi and thanks for the new pondering feature.

I have encountered a small problem related to how games are saved. The PGN output file is now kept open, and it uses internal buffering. This means that if you try to read the file during a match, the most recently finished game is typically truncated. To fix this I suggest the following patch:

Code: Select all

diff --git a/projects/lib/src/pgngame.cpp b/projects/lib/src/pgngame.cpp
index 128e09a..ebd7c9f 100644
--- a/projects/lib/src/pgngame.cpp
+++ b/projects/lib/src/pgngame.cpp
@@ -308,6 +308,8 @@ bool PgnGame::write(QTextStream& out, PgnMode mode) const
        else
                out << " " << str << "\n\n";
 
+       out.flush();
+
        return true;
 }
 
Thanks! That sounds very sensible. Did you test this change and verify that it solves the problem?
Yes it does solve my problem. I have only tested in linux because that is what I use to run all my engine tests.
I have now pushed this change to origin/master.
Ferdy
Posts: 4853
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: cutechess-cli 0.8.0 beta (with pondering)

Post by Ferdy »

ilari wrote:
Ferdy wrote:Here Floyd is mated, yet cutechess still sends the position to Floyd.

Code: Select all

65026 <Floyd_0.7_w32(1): bestmove h7h6
65026 >D2015.1.275(0): ponderhit
65026 <D2015.1.275(0): info depth 5 seldepth 2 score mate 1 time 1 nodes 101 nps 101000 tbhits 0 pv b8h8
65026 <D2015.1.275(0): info depth 6 seldepth 2 score mate 1 time 1 nodes 121 nps 121000 tbhits 0 pv b8h8
65026 <D2015.1.275(0): info depth 7 seldepth 2 score mate 1 time 1 nodes 141 nps 141000 tbhits 0 pv b8h8
65027 <D2015.1.275(0): info depth 8 seldepth 2 score mate 1 time 1 nodes 161 nps 161000 tbhits 0 pv b8h8
65027 <D2015.1.275(0): info depth 9 seldepth 2 score mate 1 time 1 nodes 182 nps 182000 tbhits 0 pv b8h8
65027 <D2015.1.275(0): info depth 10 seldepth 2 score mate 1 time 1 nodes 203 nps 203000 tbhits 0 pv b8h8
65027 <D2015.1.275(0): info depth 11 seldepth 14 score mate 1 time 4 nodes 8184 nps 2046000 tbhits 0 pv b8h8
65031 <D2015.1.275(0): info depth 12 seldepth 14 score mate 1 time 10 nodes 24091 nps 2409100 tbhits 0 pv b8h8
65031 <D2015.1.275(0): info time 10 nodes 24091
65031 <D2015.1.275(0): bestmove b8h8
65031 >Floyd_0.7_w32(1): position startpos moves g1f3 g7g6 d2d4 f8g7 g2g3 d7d6 f1g2 f7f5 c2c3 g8f6 d1b3 c7c6 e1g1 h8f8 c1e3 f6g4 e3d2 d8b6 b1a3 b6b3 a2b3 b8d7 a3c4 h7h6 c4a5 e8f7 f3e1 g4f6 e1d3 f6e4 d2e3 d7f6 f2f3 f6d5 e3c1 e4g5 e2e4 d5f6 e4e5 f6d5 c1d2 d6e5 d3e5 g7e5 d4e5 f5f4 f1e1 f7g7 c3c4 d5e3 d2e3 f4e3 e1e3 f8d8 g1f2 a8b8 b3b4 d8d2 e3e2 d2d3 f3f4 g5h3 f2e1 c8g4 g2h3 g4h3 e2d2 d3d2 e1d2 h3f5 d2e3 f5e6 h2h4 h6h5 a1d1 e6f5 d1d4 g7f7 b2b3 f7g7 d4d2 f5g4 e3d4 g4f3 d2f2 f3h1 f2f1 h1g2 f1g1 g2f3 c4c5 b7b6 c5b6 a7b6 a5c4 f3g4 g1a1 b8d8 d4e3 b6b5 c4a5 g4f5 a5c6 d8d3 e3f2 f5e4 c6e7 d3f3 f2e2 f3g3 a1a7 g3b3 e7c8 g7h8 e5e6 e4f5 e6e7 b3b2 e2e3 b2b3 e3d4 b3b4 d4d5 b4e4 c8d6 e4e7 a7e7 b5b4 d6f5 g6f5 d5e6 b4b3 e7b7 h8g8 e6f6 b3b2 b7b2 g8h7 b2b8 h7h6 b8h8
65033 >D2015.1.275(0): isready
65033 >Floyd_0.7_w32(1): isready
65033 <D2015.1.275(0): readyok
65033 <Floyd_0.7_w32(1): readyok
Oh, that. I'm pretty sure that happens even without pondering. And I'm not really sure if that should be changed because some engines may want to get the final move too (for logging, learning, etc.).
But then you are not sending the go command which is most likely needed so that the last move sent in the position will be recorded in the engine game move history for learning processing etc.

There is a vital difference between "go ponder ... " and "go ...", in the latter the engine will reply without waiting for ponderhit or stop commands, but in the previous either the stop command or the ponderhit command is needed. So when a position without legal move is sent to the engine with go ... command there is no problem sending the stop or ponderhit commands since the engine is expected to reply with bestmove, can be bestmove 0000, or bestmove anything. But if it was go ponder ... command, the engine needs stop or ponderhit commands so that it will stop searching a move in a position without a legal move. In ponder off games there is no problem, since the engine received go ... command.

It seems logical to send go ... command when position command was sent in a stalemate and checkmate positions. When the engine received the go ... command it will search the position and returns a mate score and that signaled the end of a game, it gets the last move and also knew the move score.
User avatar
Ozymandias
Posts: 1537
Joined: Sun Oct 25, 2009 2:30 am

Re: cutechess-cli 0.8.0 beta (with pondering)

Post by Ozymandias »

Could be have 6-men syzygy adjudication, instead of 5-men gaviota?
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: cutechess-cli 0.8.0 beta (with pondering)

Post by ilari »

Ozymandias wrote:Could be have 6-men syzygy adjudication, instead of 5-men gaviota?
I've been thinking of getting rid of Gaviota tbs in favor of Syzygy, but it's not a top priority at the moment. If somebody implements Syzygy support for cutechess and throws us a quality pull request, I would definitely merge that.
User avatar
Ozymandias
Posts: 1537
Joined: Sun Oct 25, 2009 2:30 am

Re: cutechess-cli 0.8.0 beta (with pondering)

Post by Ozymandias »

http://www.talkchess.com/forum/viewtopic.php?t=58299
Fathom can also be used for other projects, e.g. syzygy tablebase adjudication. This may be useful for GUIs. The Fathom repository also includes a stand-alone command-line tool for mapping FEN position strings to table-base results.
Close enough?