- if (!defined($pos_waiting)) {
- uciprint($engine, "stop");
- }
- if ($remoteglotconf::uci_assume_full_compliance) {
- $pos_waiting = $pos;
- } else {
- uciprint($engine, "position fen " . $pos->fen());
- uciprint($engine, "go infinite");
- $pos_calculating = $pos;
- }
- } else {
- # it's wrong just to give the FEN (the move history is useful,
- # and per the UCI spec, we should really have sent "ucinewgame"),
- # but it's easier
- uciprint($engine, "position fen " . $pos->fen());
- uciprint($engine, "go infinite");
- $pos_calculating = $pos;
+ # Ask the engine to stop; we will throw away its data until it
+ # sends us "bestmove", signaling the end of it.
+ $engine->{'stopping'} = 1;
+ uciprint($engine, "stop");