From db15af4dd89c212f8e44d28d6713a6ed62deae84 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 17 Nov 2013 14:33:59 +0100 Subject: [PATCH] Deal with multipv not being the first element on the info line (e.g. for Stockfish). --- remoteglot.pl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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)$/) { -- 2.39.2