chiark / gitweb /
quacks-ingredients: counts works
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 16 Feb 2020 21:11:09 +0000 (21:11 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 16 Feb 2020 21:11:17 +0000 (21:11 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
quacks-ingredients-counts
quacks-ingredients-counts.scad

index 6ee3500196c5dcf72a75a6b7003f9b09409d6233..a1e5f27e40bbcbd86da57aaa6116b2427b0cf13e 100755 (executable)
@@ -20,6 +20,9 @@ $_ = Dumper(\%count);
 s{^}{// }mg;
 
 our $name;
+our $total_count;
+our $max_nrows=0;
+our $max_rowsz=0;
 
 sub wrtoplevel () {
     print "module $name(){ ////toplevel\n";
@@ -27,6 +30,9 @@ sub wrtoplevel () {
     my $total = 0; $total += $_ foreach values %$cs;
     my $rowsz = ceil(sqrt($total));
     my $nrows = ceil($total / $rowsz);
+    $total_count += $total;
+    $max_nrows = $nrows if $nrows > $max_nrows;
+    $max_rowsz = $rowsz if $rowsz > $max_rowsz;
     my $ix = 0;
     print "// total=$total, rowsz=$rowsz, nrows=$nrows\n";
     foreach my $nspots (sort keys %$cs) {
@@ -54,6 +60,11 @@ foreach $name (sort keys %count) {
     wrtoplevel();
 }
 
+print <<END;
+// total_count=$total_count
+// max_rowsz=$max_rowsz max_nrows=$max_nrows
+END
+
 STDOUT->error and die $!;
 
 __DATA__
index 1c33a55bcca6054dbb6d1da992cdb9dcc3fd8d32..844d6f51706039c3b235421589908d1d001ead4e 100644 (file)
@@ -369,3 +369,5 @@ module Yellow(){ ////toplevel
     translate(token_pitch * [   2.5,   1.0 ]) Token_L();
   };
 }
+// total_count=216
+// max_rowsz=7 max_nrows=6