]> git.sesse.net Git - remoteglot/blobdiff - remoteglot.pl
Deal with multipv not being the first element on the info line (e.g. for Stockfish).
[remoteglot] / remoteglot.pl
index fc812976ef7b6cf79cedf9ac1a66515bedef7dc7..c4518fc1c8837fa61285ed6de36e901c8a4ff550 100755 (executable)
@@ -258,10 +258,19 @@ sub parse_infos {
 
        my $info = $engine->{'info'};
 
+       # Search for "multipv" first of all, since e.g. Stockfish doesn't put it first.
+       for my $i (0..$#x - 1) {
+               if ($x[$i] =~ 'multipv') {
+                       $mpv = $x[$i + 1];
+                       next;
+               }
+       }
+
        while (scalar @x > 0) {
                if ($x[0] =~ 'multipv') {
+                       # Dealt with above
+                       shift @x;
                        shift @x;
-                       $mpv = shift @x;
                        next;
                }
                if ($x[0] =~ /^(currmove|currmovenumber|cpuload)$/) {