Bill wrote:
I think you are making this more complex than it needs to be:
Agreed.
This makes sense because the whole point of the abort is not to undo things - instead, it is to get the GTP client to stop what it is doing and start listening to commands from the server again.
This is the key point to the whole issue.
Whether the client stops because it completed the command (in which case the command returns success & the abort returns an error) or because it has aborted the command (in which case the command returns an error & the abort returns success) doesn't matter.
I don't see any reason for the abort command to return an error just because the engine didn't notice it in time to actually abort anything. It should be apparent from the results of the pending commands whether anything was aborted.
* Since "abort" causes the previous command to fail (if the abort succeeds), and the GTP spec says that a failed command should not change the state of the engine, that does imply that if you can't return to the original engine state, you should continue working on the genmove then return an error for the abort. This is fine with me, but if we explicitly say that an aborted genmove can change the engine state that is fine with me also; I don't see that it matters whether you undo your engine state or not after an abort to a genmove. If you can, fine, if you can't, fine, as long as these state changes don't leave you with a broken engine! For example, in a "genmove/abort/genmove", if you have worked out some life&death situations in the first genmove, why not be able to use them in the 2nd?
The protocol does not concern itself with any random internal state in the engine, like cached life&death statuses. Only the state variables explicitly listed in the spec are required to be unchanged by a failed command. This should hold also for failures due to an abort.
I do agree that abort needs to be 100% optional.
Indeed.
If you can't abort anything, just treat abort as an unrecognized command.
Also agreed.
A server must treat abort as a "hint" that it doesn't care about the output of the current command, so this "hint" is only needed to save time, not needed for correctness.
A corollary is that if your engine is fast enough to respond to any command in a fraction of a second, just don't bother with abort. There's no point.
A few more comments to other things mentioned somewhere in this discussion and a few which have not been mentioned:
* I think it's clear that it's not worthwhile to involve control characters. A regular command "abort" is good enough and fits better with the overall protocol structure.
* An engine which receives an abort during the processing of a genmove may freely choose whether to: * Abort the processing and fail the genmove with the error message "aborted". * Abort the processing and return a "half thought through" move successfully. * Finish the processing and successfully return the generated move as usual. However, if it would always choose the latter alternative, regardless of where it is in the processing, it probably shouldn't implement the abort command at all.
* If several commands are pending when the abort is received and one command is aborted (i.e. failing with the "aborted" error message), all the following commands must also be aborted.
* The response to the abort command must of course come after the responses to pending commands. I think it should always succeed, and return nothing, if it is recognized at all. It isn't worthwhile to have it report anything.
Finally I'd like to hear, just out of curiousity, how the various go programs out there would be able to handle abort of a genmove (whether or not GTP has been implemented in the program at this time). I guess there are five major categories:
1a. The program isn't able to poll for abort commands at all. 1b. The program is so fast that there's no point polling for an abort. 2. The program isn't able to abort the genmove. 3. The program can abort the genmove but not generate a half thought through move. 4. The program can abort the genmove and return a half thought through move.