-sub print_inputs () {
- printf("%40s",'');
- map { printf " %5s ", $_ } @rums;
- print "\n\n";
- if (defined $price{Swill}) {
- map { $price{$_}= undef if $price{$_} eq 'x' } @rums;
- pr('prices', %price, 'poe ea.');
- }
- if (defined $have{Swill}) {
- $have_proof= 0;
- map { $have_proof += $have{$_} * $proof{$_} } @rums;
- pr('stock on board', %have, 'rum');
+ my $initial_value;
+ my $last_value;
+ my $si=0; for my $stocks (@have) {
+ my $stock_rum= 0;
+ foreach my $i (qw(0 1 2)) {
+ $stock_rum += $stocks->[$i] * $proofs[$i] / 100;
+ }
+ my $rum_value= defined($best) ? $stock_rum * $best_norm_price : 0;
+ my $shot_value= valid($price[3]) ? $stocks->[3] * $price[3] : 0;
+ my $total_value= $rum_value + $shot_value;
+
+ printf "%-10s ", 'stocks'.fmt_stock_index(++$si).':';
+ pr1s($stock_rum);
+ pr1s($rum_value);
+ printf "%6d", $stocks->[3];
+ pr1s($shot_value);
+ pr1s($total_value);
+
+ if (defined $last_value) {
+ printf(" %10.1f %10.1f",
+ $total_value - $last_value,
+ $total_value - $initial_value);
+ }
+ $initial_value= $total_value unless defined $initial_value;
+ $last_value= $total_value;
+ print "\n";