nguyenpham / Banksia

Chess tournament manager, standard C++ 11
Apache License 2.0
81 stars 12 forks source link

macOS: generating json files #5

Closed twoplan closed 5 years ago

twoplan commented 5 years ago

Generating json files worked on my Mac, but sometimes the engine options are incomplete.

./nemorino-5.10 
uci
Initialization Time: 34ms
id name Nemorino 5.10
id author Christian Guenther
option name BookFile type string default book.bin
option name Clear Hash type button
option name Contempt type spin default 0 min -1000 max 1000
option name Hash type spin default 32 min 1 max 16384
option name MoveOverhead type spin default 0 min 0 max 60000
option name MultiPV type spin default 1 min 1 max 216
option name OwnBook type check default false
option name Ponder type check default false
option name SyzygyPath type string
option name SyzygyProbeDepth type spin default 0 min 0 max 129
option name Threads type spin default 4 min 1 max 128
option name UCI_Chess960 type check default false
option name UCI_Opponent type string
uciok

./banksia -u -c 4 -d /Users/max/chess generated the following entry for Nemorino, but missed SyzygyPath and UCI_Opponent :

...
 {
  "app" : 
  {
   "arguments" : [],
   "command" : "/Users/max/chess/Nemorino/nemorino-5.10",
   "elo" : 0,
   "initStrings" : [],
   "name" : "Nemorino 5.10",
   "protocol" : "uci",
   "working folder" : "/Users/max/chess/Nemorino"
  },
  "comment" : "",
  "options" : 
  [
   {
    "default" : "book.bin",
    "name" : "BookFile",
    "type" : "string",
    "value" : "book.bin"
   },
   {
    "name" : "Clear Hash",
    "type" : "button"
   },
   {
    "default" : 0,
    "max" : 1000,
    "min" : -1000,
    "name" : "Contempt",
    "type" : "spin",
    "value" : 0
   },
   {
    "default" : 32,
    "max" : 16384,
    "min" : 1,
    "name" : "Hash",
    "type" : "spin",
    "value" : 32
   },
   {
    "default" : 0,
    "max" : 60000,
    "min" : 0,
    "name" : "MoveOverhead",
    "type" : "spin",
    "value" : 0
   },
   {
    "default" : 1,
    "max" : 216,
    "min" : 1,
    "name" : "MultiPV",
    "type" : "spin",
    "value" : 1
   },
   {
    "default" : false,
    "name" : "OwnBook",
    "type" : "check",
    "value" : false
   },
   {
    "default" : false,
    "name" : "Ponder",
    "type" : "check",
    "value" : false
   },
   {
    "default" : 0,
    "max" : 129,
    "min" : 0,
    "name" : "SyzygyProbeDepth",
    "type" : "spin",
    "value" : 0
   },
   {
    "default" : 4,
    "max" : 128,
    "min" : 1,
    "name" : "Threads",
    "type" : "spin",
    "value" : 4
   },
   {
    "default" : false,
    "name" : "UCI_Chess960",
    "type" : "check",
    "value" : false
   }
  ]
 },
...
nguyenpham commented 5 years ago

Thanks for the report. That is an interesting issue. Those options are missing the field "default" thus Banksia thought it was broken and ignored. Other engines such as Stockfish always sends default fields even they are empty (e.g. it sends "default < empty >").

The issue is fixed and will be released in the next version.

twoplan commented 5 years ago

Just noticed that all engines, which are invoked by a shell script (like Java engines), are not found.

./chess22k-1.12.sh 
uci
id name chess22k 1.12
id author Sander MvdB
option name Hash type spin default 128 min 1 max 16384
option name Threads type spin default 1 min 1 max 64
option name Ponder type check default false
uciok

And these two wb-engines are also not detected on my system:

not an engine: /Users/max/chess/Monik/monik-2.2.7
not an engine: /Users/max/chess/Zeta/zetaDva-0.310

Banksia found more than 100 chess engines on my mac. For most of them I added manually the tablebase path. What happens after adding engines to the chess directory and rerun banksia? Do you update an existing engines.json with only the new engines found, or is a complete new file created (without the previous manual changes)?

nguyenpham commented 5 years ago

Just noticed that all engines, which are invoked by a shell script (like Java engines), are not found. And these two wb-engines are also not detected on my system:

Thanks for the report. I will check that issue for the next version (not today version).

Banksia found more than 100 chess engines on my mac. For most of them I added manually the tablebase path.

I have just added a new feature which can help to solve that problem: override options. You may declare some common options such as SyzygyPath (for uci engines), cores, memory (for wb engines)... in one place (tour.json) and Banksia will override those options to all engines whose use (it means you don't need to edit that info of each engine.

What happens after adding engines to the chess directory and rerun banksia? Do you update an existing engines.json with only the new engines found, or is a complete new file created (without the previous manual changes)?

Banksia is designed to keep previous information as much as possible. However, I did not test it carefully. You may help me to test: re-generate those JSON files. Remember to back up those files first.

twoplan commented 5 years ago

Perhaps a hint for the Readme: in the scanned directory only the engines/scripts should have a executable flag (mac & linux).

I had there tablebases too. These files had the x-flag set (caused by unzipping them ages ago). Banksia tried to find out, if these files are chess engines. This takes forever! Better interrupt, change the file properties and rerun.

twoplan commented 5 years ago

You may help me to test: re-generate those JSON files.

OK, added an engine and ran banksia again. The new engines.json still has all my handmade changes!

But one engine is now missed in engines.json at the 2nd run:

not an engine: /Users/max/chess/Garbo/garbo-3

In the 1st run engines.json got this entry for Garbo:

...
{
  "app" : 
  {
   "arguments" : [],
   "command" : "/Users/max/chess/Garbo/garbo-3",
   "elo" : 0,
   "initStrings" : [],
   "name" : "GarboChess 3",
   "protocol" : "uci",
   "working folder" : "/Users/max/chess/Garbo"
  },
  "comment" : "",
  "options" : []
 },
...
./garbo-3 

GarboChess 3
warning: this program uses gets(), which is unsafe.
uci

id name GarboChess 3
id author Gary Linscott
uciok
nguyenpham commented 5 years ago

I had there tablebases too. These files had the x-flag set (caused by unzipping them ages ago). Banksia tried to find out, if these files are chess engines. This takes forever! Better interrupt, change the file properties and rerun.

lol

I have just added a few more file extensions of some common tablebases into an exclusive list to avoid running them. Hope that can help Banksia to ignore them. I also add your suggestions to Readme. Thanks!

Nice to see Banksia can keep your previous work. I will check other issues later.

BTW, I have just released a new version 2.5 with some improvements and bug fixing.