Cutechess-cli 0.5.1 released

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

Moderator: Ras

User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: Cutechess-cli 0.5.1 released

Post by ilari »

SzG wrote:
ilari wrote:Only the engine name is compulsory, options can be removed. Didn't you get any errors about invalid JSON syntax? If not, then maybe you forgot the square brackets "[" and "]" from the beginning and the end of the file.
I did not notice any error message. The square brackets are certainly there. Well, it is obvious I have made some error, I am going to investigate the matter tomorrow.
Thanks for your help.
You could always send your engines.json to my email at ilari.pihlajisto@mbnet.fi. I'm pretty sure I'd spot the problem quickly.
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: Cutechess-cli 0.5.1 released

Post by ilari »

Ferdy wrote:Sample from my engines.json.

Code: Select all

   { 
      "command" : "BugChess2_V1.9.exe",
      "name" : "BugChess2-1.9",
      "arg": "-ThreadNb 1", 
      "arg": "-winboard",
      "arg": "-nolog",
      "protocol" : "xboard", 
      "workingDirectory" : "C:\\MyFiles\\Chess\\engines\\nobook\\bugchess2_V1.9"
   }
Oh, and this doesn't work as intended for a couple of reasons:
- There can be only one instance of each parameter name. In this case only the last "arg" would be kept. An array should be used for parameters with multiple values, eg. "initStrings":

Code: Select all

"initStrings" : [
    "line 1",
    "line 2",
    "line 3"
]
- The "arg" option isn't yet supported in the JSON config. Command line arguments should be simply appended to "command":

Code: Select all

"command" : "BugChess2_V1.9.exe -ThreadNb 1 -winboard -nolog"
Ferdy
Posts: 4846
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Cutechess-cli 0.5.1 released

Post by Ferdy »

ilari wrote:
Ferdy wrote:Sample from my engines.json.

Code: Select all

   { 
      "command" : "BugChess2_V1.9.exe",
      "name" : "BugChess2-1.9",
      "arg": "-ThreadNb 1", 
      "arg": "-winboard",
      "arg": "-nolog",
      "protocol" : "xboard", 
      "workingDirectory" : "C:\\MyFiles\\Chess\\engines\\nobook\\bugchess2_V1.9"
   }
Oh, and this doesn't work as intended for a couple of reasons:
- There can be only one instance of each parameter name. In this case only the last "arg" would be kept. An array should be used for parameters with multiple values, eg. "initStrings":

Code: Select all

"initStrings" : [
    "line 1",
    "line 2",
    "line 3"
]
- The "arg" option isn't yet supported in the JSON config. Command line arguments should be simply appended to "command":

Code: Select all

"command" : "BugChess2_V1.9.exe -ThreadNb 1 -winboard -nolog"
Thanks for pointing it out.
Ferdy
Posts: 4846
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Cutechess-cli 0.5.1 released

Post by Ferdy »

I run my command line and decided to exit it, cutechess-cli awarded the game to one of the sides. Would be nice if result is just *.

Code: Select all

[Event "?"]
[Site "?"]
[Date "2012.01.07"]
[Round "1"]
[White "x"]
[Black "y"]
[Result "1-0"]
[PlyCount "53"]
[Termination "abandoned"]
[TimeControl "60+0.01"]

1. d4 {book} Nf6 {book} 2. c4 {book} g6 {book} 3. Nc3 {book} Bg7 {book}
4. e4 {book} d6 {book} 5. Nf3 {book} O-O {book} 6. Be2 {book} e5 {book}
7. Be3 {book} c6 {book} 8. d5 {book} Ng4 {book} 9. Bg5 {book} f6 {book}
10. Bh4 {book} h5 {book} 11. h3 {+0.96/12 1.8s} Nh6 {-0.91/13 1.3s}
12. O-O {+1.12/11 1.7s} Nf7 {-0.77/14 3.7s} 13. Bg3 {+0.86/11 1.7s}
Bh6 {-0.70/12 0.84s} 14. a3 {+0.76/12 1.6s} Na6 {-0.46/14 4.7s}
15. b4 {+0.64/11 1.6s} c5 {-0.47/14 1.4s} 16. Qb3 {+0.69/12 1.5s}
Kg7 {-0.40/14 1.8s} 17. Rfb1 {+0.63/11 1.5s} Bd7 {-0.32/13 0.80s}
18. Ne1 {+0.75/12 1.5s} Rc8 {-0.41/12 1.7s} 19. Nd3 {+0.84/11 1.4s}
Bd2 {-0.24/13 1.6s} 20. Rb2 {+1.10/12 1.4s} Bxc3 {-0.50/13 0.79s}
21. Qxc3 {+0.98/12 1.3s} b5 {-0.38/13 2.8s} 22. f3 {+1.35/11 1.3s}
Rb8 {-0.32/13 2.4s} 23. cxb5 {+0.99/13 1.3s} Bxb5 {-0.47/12 0.55s}
24. Bf2 {+0.97/12 1.2s} Qc7 {-0.51/13 0.91s} 25. Rc1 {+1.23/12 1.2s}
Rfc8 {-0.86/12 0.91s} 26. Qd2 {+1.54/12 1.1s} Nd8 {-1.21/13 3.6s}
27. Rbb1 {+2.01/11 1.1s, Black disconnects} 1-0
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: Cutechess-cli 0.5.1 released

Post by ilari »

Ferdy wrote:I run my command line and decided to exit it, cutechess-cli awarded the game to one of the sides. Would be nice if result is just *.

Code: Select all

[Event "?"]
[Site "?"]
[Date "2012.01.07"]
[Round "1"]
[White "x"]
[Black "y"]
[Result "1-0"]
[PlyCount "53"]
[Termination "abandoned"]
[TimeControl "60+0.01"]

1. d4 {book} Nf6 {book} 2. c4 {book} g6 {book} 3. Nc3 {book} Bg7 {book}
4. e4 {book} d6 {book} 5. Nf3 {book} O-O {book} 6. Be2 {book} e5 {book}
7. Be3 {book} c6 {book} 8. d5 {book} Ng4 {book} 9. Bg5 {book} f6 {book}
10. Bh4 {book} h5 {book} 11. h3 {+0.96/12 1.8s} Nh6 {-0.91/13 1.3s}
12. O-O {+1.12/11 1.7s} Nf7 {-0.77/14 3.7s} 13. Bg3 {+0.86/11 1.7s}
Bh6 {-0.70/12 0.84s} 14. a3 {+0.76/12 1.6s} Na6 {-0.46/14 4.7s}
15. b4 {+0.64/11 1.6s} c5 {-0.47/14 1.4s} 16. Qb3 {+0.69/12 1.5s}
Kg7 {-0.40/14 1.8s} 17. Rfb1 {+0.63/11 1.5s} Bd7 {-0.32/13 0.80s}
18. Ne1 {+0.75/12 1.5s} Rc8 {-0.41/12 1.7s} 19. Nd3 {+0.84/11 1.4s}
Bd2 {-0.24/13 1.6s} 20. Rb2 {+1.10/12 1.4s} Bxc3 {-0.50/13 0.79s}
21. Qxc3 {+0.98/12 1.3s} b5 {-0.38/13 2.8s} 22. f3 {+1.35/11 1.3s}
Rb8 {-0.32/13 2.4s} 23. cxb5 {+0.99/13 1.3s} Bxb5 {-0.47/12 0.55s}
24. Bf2 {+0.97/12 1.2s} Qc7 {-0.51/13 0.91s} 25. Rc1 {+1.23/12 1.2s}
Rfc8 {-0.86/12 0.91s} 26. Qd2 {+1.54/12 1.1s} Nd8 {-1.21/13 3.6s}
27. Rbb1 {+2.01/11 1.1s, Black disconnects} 1-0
The result definitely should be just *. Maybe the engine terminated just a bit sooner than Cutechess-cli expected. Did this happen on Windows? I'm guessing it's possible that when you pressed CTRL-C, one of the engines received the SIGINT before Cutechess-cli.
Ferdy
Posts: 4846
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Cutechess-cli 0.5.1 released

Post by Ferdy »

ilari wrote:
Ferdy wrote:I run my command line and decided to exit it, cutechess-cli awarded the game to one of the sides. Would be nice if result is just *.

Code: Select all

[Event "?"]
[Site "?"]
[Date "2012.01.07"]
[Round "1"]
[White "x"]
[Black "y"]
[Result "1-0"]
[PlyCount "53"]
[Termination "abandoned"]
[TimeControl "60+0.01"]

1. d4 {book} Nf6 {book} 2. c4 {book} g6 {book} 3. Nc3 {book} Bg7 {book}
4. e4 {book} d6 {book} 5. Nf3 {book} O-O {book} 6. Be2 {book} e5 {book}
7. Be3 {book} c6 {book} 8. d5 {book} Ng4 {book} 9. Bg5 {book} f6 {book}
10. Bh4 {book} h5 {book} 11. h3 {+0.96/12 1.8s} Nh6 {-0.91/13 1.3s}
12. O-O {+1.12/11 1.7s} Nf7 {-0.77/14 3.7s} 13. Bg3 {+0.86/11 1.7s}
Bh6 {-0.70/12 0.84s} 14. a3 {+0.76/12 1.6s} Na6 {-0.46/14 4.7s}
15. b4 {+0.64/11 1.6s} c5 {-0.47/14 1.4s} 16. Qb3 {+0.69/12 1.5s}
Kg7 {-0.40/14 1.8s} 17. Rfb1 {+0.63/11 1.5s} Bd7 {-0.32/13 0.80s}
18. Ne1 {+0.75/12 1.5s} Rc8 {-0.41/12 1.7s} 19. Nd3 {+0.84/11 1.4s}
Bd2 {-0.24/13 1.6s} 20. Rb2 {+1.10/12 1.4s} Bxc3 {-0.50/13 0.79s}
21. Qxc3 {+0.98/12 1.3s} b5 {-0.38/13 2.8s} 22. f3 {+1.35/11 1.3s}
Rb8 {-0.32/13 2.4s} 23. cxb5 {+0.99/13 1.3s} Bxb5 {-0.47/12 0.55s}
24. Bf2 {+0.97/12 1.2s} Qc7 {-0.51/13 0.91s} 25. Rc1 {+1.23/12 1.2s}
Rfc8 {-0.86/12 0.91s} 26. Qd2 {+1.54/12 1.1s} Nd8 {-1.21/13 3.6s}
27. Rbb1 {+2.01/11 1.1s, Black disconnects} 1-0
The result definitely should be just *. Maybe the engine terminated just a bit sooner than Cutechess-cli expected. Did this happen on Windows? I'm guessing it's possible that when you pressed CTRL-C, one of the engines received the SIGINT before Cutechess-cli.
Yes this is on windows, I press the x of the console box.
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: Cutechess-cli 0.5.1 released

Post by ilari »

Ferdy wrote:
ilari wrote:The result definitely should be just *. Maybe the engine terminated just a bit sooner than Cutechess-cli expected. Did this happen on Windows? I'm guessing it's possible that when you pressed CTRL-C, one of the engines received the SIGINT before Cutechess-cli.
Yes this is on windows, I press the x of the console box.
Well that explains it. When you close the console with the "X" button it terminates every process created in that console, including Cutechess-cli and the engines. So if one of the engines is terminated before Cutechess-cli, the game will be a disconnection loss to that engine. I suggest that you terminate the match with CTRL+C (SIGINT) instead of closing the console, then everything should go smoothly.
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: Cutechess-cli 0.5.1 released

Post by ilari »

SzG wrote:Cancel, I have just read you wrote in this thread that "Command line arguments should be simply appended to "command":"

Or can it be done both ways, either via "command" or via "arg"?
In the config file "arg" is not supported - you should put all command line arguments in "command". "arg" only works as a command line argument to Cutechess-cli, but even there it's not really needed anymore.
SzG wrote:One has to be very careful with this engine.json file.
True. Even though the syntax checking is pretty good, I still need to improve the JSON implementation's error handling and reporting.

EDIT: I just tried putting an unescaped backslash in my engines.json, and I get this warning:

Code: Select all

Warning: bad engine configuration file line 680 in "/home/ilari/.config/cutechess/engines.json" : "Unknown escape sequence: \S"
Didn't you get a warning like this, eg. when running "cutechess-cli --engines"?
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: Cutechess-cli 0.5.1 released

Post by ilari »

SzG wrote:I never get any warning. I just wanted to ask where those warning can be read. When I run cutechess-cli --engines I can only see a window flashing up then disappearing. If I direct the output to a file I get a 0-byte file when something is wrong.
I am afraid that warning is displayed only in Linux (?).
The 0-byte file probably happens because you're redirecting stdout to a file, but errors and warnings are sent to stderr. You can redirect output from stderr with "command 2> output.txt" where "command" is the Cutechess-cli command and "output.txt" the output file.

The warnings should be displayed also on Windows, you just have to keep the console window open even after Cutechess-cli terminates. If you're running Cutechess-cli as a parameter for cmd.exe you can pass cmd.exe the /k parameter to keep the console open. And if you're using a batch file (eg. "cutie.bat"), you can append the line "pause" after the Cutechess-cli command, and the console should stay open.
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: Cutechess-cli 0.5.1 released

Post by ilari »

SzG wrote:These were very useful hints. With the --engines 2>errors.txt I could obtain the error message which, in my latest case, was an unrecognized parameter "always". It helped me to place it within quotation marks and the error disappeared.

I have learnt a lot. Thank you very much, Ilari.

Cheers,
I'm glad I could help.