Fulvio wrote: ↑
Wed Apr 08, 2020 12:22 am
- are all the options optional, or "memory" and "cores" must be sent if the engine requested "feature memory=1"?
Strictly speaking the 'cores' command should only be sent if the engine requested "feature smp=1". But fully compliant engines should not get upset if you send them a command they do not understand; they should reply with the "Unknown command" error message. If you don't send these commands, engines would run with their default hash size and number of threads, which they did not announce, and might be very different from what you want. So in practice these commands should be considered mandatory. If they are not supported the engine will likely have some non-compliant way to configure those, like command-line arguments or a config file.
For user-defined options (through 'feature option="$name -$type $value ..." ') you would know the current $value, and there is no need to set them when this is the desired one. Presumably most such options would have the $value that is optimal for the engine as default.
- "exit" must be sent only once like the UCI's "stop" and only if the engine is analyzing?
"exit" in all my engines does exactly the same as "force": switch the engine to a mode where it would not think no matter who is on move. So it seems a redundant command. But the specs describe it as the command needed to stop analysis. So strictly speaking a pedantic engine receiving "exit" while thinking or receeiving "force" while analyzing would be in its rights to refuse those commands with an error message.
- it is necessary to send "exit" before "quit" if the engine is analyzing?
I suppose not. In principle "quit", "force"/"exit", and "?" (= move now) are commands that should be instantly processed during thinking / analyzing. I think WinBoard first stops the thinking before sending "quit", though, and it is always tricky do do what engines have come not to expect. Analyzing would not work if the engines weren't sensitive to moves and "undo" commands, but many engine authors do not care about instant response to commands while an engine is thinking. So there are many engines that ignore all input until after they moved.
- when analyzing the user can jump to a very different position: it is better to use "setboard FEN"?
Well, WinBoard never sends a "setboard" to an analyzing engine, although the protocol specs say it would be allowed. But the user interface is such that the situation never arises. When you enter Edit Position mode it already terminates the analysis. And pasting FENs is implemented as if it was Edit Position followed by a transition to Edit Game, in which the engine is kept in 'force mode'.
Code: Select all
$is_thinking = true
send: setboard FEN
$is_thinking = false
send: ping 1
waitfor: pong 1
If 'is_thinking' means 'is_analyzing' this seems OK. By just analyzing positions from a game you would not allow the engine to detect the result of repetitions, though. So it might be better to load the position through a 'new' + all game moves. This could in some engines clear the hash table, though. So if it is important that results from the previous analysis are kept (as in back-propagation of a score along a line), it would be better to just move along the line through the required number of extra moves or 'undo' commands.
Note that 'ping' after 'exit' is not really necessary; exiting from analysis mode will never produce a move, but should also happen instantly. And even if there was a small delay, clocks are not running anyway during analysis. But it never hurts to send extra pings.
Code: Select all
[quoute]Is this correct?
I think so.