Closed ccanger closed 4 years ago
Hi, you can enable logging to see if the communication work as expected or if the engine prints some error: https://python-chess.readthedocs.io/en/latest/engine.html#logging
Unfortunately the UCI protocol has no standardized mechanism for error reporting, so python-chess doesn't know if the engine was happy with the option. engine.options
is just a dictionary of the available options. It doesn't refelect the current configuration.
Here is the logging:
It work fine and I don't see errors. Is there a way to get out options after the "uci" or "ucinewgame" command during or after the game ? I would like to check whether he processed the option correctly. The problem is that there are no engine error messages, as you said correctly.
begin logging:
DEBUG:asyncio:Using proactor: IocpProactor DEBUG:chess.engine:<UciProtocol (pid=17528)>: Connection made DEBUG:chess.engine:<UciProtocol (pid=17528)>: << uci DEBUG:chess.engine:<UciProtocol (pid=17528)>: >> id name Rodent III 0.273 64-bit/MSVS2017/POPCNT DEBUG:chess.engine:<UciProtocol (pid=17528)>: >> id author Pawel Koziol (based on Sungorus 1.4 by Pablo Vazquez) DEBUG:chess.engine:<UciProtocol (pid=17528)>: >> option name Clear Hash type button DEBUG:chess.engine:<UciProtocol (pid=17528)>: >> option name Hash type spin default 16 min 1 max 4096 DEBUG:chess.engine:<UciProtocol (pid=17528)>: >> option name Threads type spin default 1 min 1 max 48 DEBUG:chess.engine:<UciProtocol (pid=17528)>: >> option name MultiPV type spin default 1 min 1 max 12 DEBUG:chess.engine:<UciProtocol (pid=17528)>: >> option name TimeBuffer type spin default 10 min 0 max 1000 DEBUG:chess.engine:<UciProtocol (pid=17528)>: >> option name PersonalityFile type string default default.txt DEBUG:chess.engine:<UciProtocol (pid=17528)>: >> option name Verbose type check default false DEBUG:chess.engine:<UciProtocol (pid=17528)>: >> option name Ponder type check default false DEBUG:chess.engine:<UciProtocol (pid=17528)>: >> option name UseBook type check default true DEBUG:chess.engine:<UciProtocol (pid=17528)>: >> option name VerboseBook type check default false DEBUG:chess.engine:<UciProtocol (pid=17528)>: >> uciok DEBUG:chess.engine:<UciProtocol (pid=17528)>: << setoption name PersonalityFile value amy.txt DEBUG:chess.engine:<UciProtocol (pid=17528)>: << ucinewgame DEBUG:chess.engine:<UciProtocol (pid=17528)>: << isready DEBUG:chess.engine:<UciProtocol (pid=17528)>: >> readyok DEBUG:chess.engine:<UciProtocol (pid=17528)>: << position startpos DEBUG:chess.engine:<UciProtocol (pid=17528)>: << go depth 1 DEBUG:chess.engine:<UciProtocol (pid=17528)>: >> info depth 1 DEBUG:chess.engine:<UciProtocol (pid=17528)>: >> info depth 1 time 0 nodes 2 nps 0 score cp 3 pv a2a4 DEBUG:chess.engine:<UciProtocol (pid=17528)>: >> info depth 1 time 0 nodes 4 nps 0 score cp 7 pv b2b4 DEBUG:chess.engine:<UciProtocol (pid=17528)>: >> info depth 1 time 0 nodes 6 nps 0 score cp 8 pv c2c4 DEBUG:chess.engine:<UciProtocol (pid=17528)>: >> info depth 1 time 0 nodes 8 nps 0 score cp 36 pv d2d4 DEBUG:chess.engine:<UciProtocol (pid=17528)>: >> info depth 1 time 0 nodes 10 nps 0 score cp 46 pv e2e4 DEBUG:chess.engine:<UciProtocol (pid=17528)>: >> bestmove e2e4 Option(name='PersonalityFile', type='string', default='default.txt', min=None, max=None, var=[]) DEBUG:chess.engine:<UciProtocol (pid=17528)>: Process exited DEBUG:chess.engine:<UciProtocol (pid=17528)>: Connection lost (exit code: 1, error: None)
The UCI protocol only allows retrieving the available options, not the current values. The log shows that it was sent correctly, that's all that python-chess can do :disappointed:
Dear Niclas,
I'm not getting anywhere on my own. I describe the problem: I want to use the Rodent III engine and set an option: setoption name PersonalityFile = "amy.txt".
The program: (mini variant)
import chess import chess.engine
board=chess.Board() engine=chess.engine.SimpleEngine.popen_uci("RodentIII_x64_POPCNT_pgo.exe") engine.configure({"PersonalityFile": "amy.txt"}) result=engine.play(board,chess.engine.Limit(depth=1),game=1,info=15) print engine.options["PersonalityFile"] engine.close()
Now is the output:
Option(name='PersonalityFile', type='string', default='default.txt', min=None, max=None, var=[])
The new option is not correctly transmitted to the engine. The output is "default.txt" and not "amy.txt". I suspect the option change doesn't work.
If I let the engine work, there is no corresponding effect with this Option.
What can I do ?
If I have set a new option, how can I check whether you have correctly arrived at the engine. ?
Thank you !