X-Git-Url: https://git.sesse.net/?p=remoteglot;a=blobdiff_plain;f=remoteglot.pl;h=c4518fc1c8837fa61285ed6de36e901c8a4ff550;hp=fc812976ef7b6cf79cedf9ac1a66515bedef7dc7;hb=db15af4dd89c212f8e44d28d6713a6ed62deae84;hpb=3db9b1ff9ef62d40e50b4e3bd7747b74a1a5ed7f diff --git a/remoteglot.pl b/remoteglot.pl index fc81297..c4518fc 100755 --- a/remoteglot.pl +++ b/remoteglot.pl @@ -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)$/) {