chiark / gitweb /
quacks-ingredients: -counts: Add WhiteSpare
[reprap-play.git] / quacks-ingredients-counts
index cf883af99e3ac88517651c06c7abc29efea6b398..6f15df0a87ea40749deb6b88e72177aec7d42dd9 100755 (executable)
@@ -36,10 +36,10 @@ foreach my $nspots (qw(1 2 3 4)) {
     foreach my $i (0..$#names) {
        $_ = $l[$i] || '0+0';
        $_ ||= 0;
-       m/\+/;
+       m/\+/ or die "$which $nspots ?";
        
        $count{$names[$i]}{$nspots} =
-           $which eq 'All'    ? $` + $' :
+           $which eq 'All'     ? $` + $' :
            $which eq 'Base'    ? $`      :
            $which eq 'Witches' ?      $' :
            die "$which ?";
@@ -60,6 +60,7 @@ sub wrtoplevel () {
     print "module ${which}_$name(){ ////toplevel\n";
     my $cs = $count{$name};
     my $total = 0; $total += $_ foreach values %$cs;
+    return unless $total;
     my $rowsz = ceil(sqrt($total));
     my $nrows = ceil($total / $rowsz);
     $total_count += $total;
@@ -102,8 +103,8 @@ END
 STDOUT->error and die $!;
 
 __DATA__
-White  Green   Blue    Red     Yellow  Purple  Black   Orange
-20+6   15+10   14+8    12+6    13+6    15+8    18+8    20+12
-8+3    10+5    10+5    8+5     6+5
-4+2
+White  Green   Blue    Red     Yellow  Purple  Black   Orange  WhiteSpare
+20+6   15+10   14+8    12+6    13+6    15+8    18+8    20+12   1+0
+8+3    10+5    10+5    8+5     6+5                             1+0
+4+2                                                            1+0
        13+5    10+5    10+5    10+5