+
+sub short_score {
+ my ($uciinfo, $ficsinfo, $mpv) = @_;
+
+ if (defined($uciinfo{'score_mate' . $mpv})) {
+ return sprintf "M%3d", $uciinfo{'score_mate' . $mpv};
+ } else {
+ if (exists($uciinfo{'score_cp' . $mpv})) {
+ my $score = $uciinfo{'score_cp' . $mpv} * 0.01;
+ if ($ficsinfo{'toplay'} eq 'B') {
+ $score = -$score;
+ }
+ return sprintf "%+5.2f", $score;
+ }
+ }
+
+ return undef;
+}
+
+sub long_score {
+ my ($uciinfo, $ficsinfo, $mpv) = @_;
+
+ if (defined($uciinfo{'score_mate' . $mpv})) {
+ my $mate = $uciinfo{'score_mate' . $mpv};
+ if ($ficsinfo{'toplay'} eq 'B') {
+ $mate = -$mate;
+ }
+ if ($mate > 0) {
+ return sprintf "White mates in %u", $mate;
+ } else {
+ return sprintf "Black mates in %u", -$mate;
+ }
+ } else {
+ if (exists($uciinfo{'score_cp' . $mpv})) {
+ my $score = $uciinfo{'score_cp' . $mpv} * 0.01;
+ if ($ficsinfo{'toplay'} eq 'B') {
+ $score = -$score;
+ }
+ return sprintf "Score: %+5.2f", $score;
+ }
+ }
+
+ return undef;
+}