chiark / gitweb /
quacks-ingredients: better counting reports
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 28 Mar 2020 17:07:56 +0000 (17:07 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 28 Mar 2020 17:07:56 +0000 (17:07 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
quacks-ingredients-counts
quacks-ingredients-counts.scad
quacks-ingredients-update-levels

index 101629598d265555c2e578f3344c11061ccf72c9..e9f6acf1fde58562a48736930c091853e559579f 100755 (executable)
@@ -38,6 +38,7 @@ s{^}{// }mg;
 
 our $name;
 our $total_count;
+our $total_real_count;
 our $max_nrows=0;
 our $max_rowsz=0;
 
@@ -48,10 +49,11 @@ sub wrtoplevel () {
     my $rowsz = ceil(sqrt($total));
     my $nrows = ceil($total / $rowsz);
     $total_count += $total;
+    $total_real_count += $total if $name =~ m/^[A-Z][a-z]+$/;
     $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";
+    print "// $name: total=$total, rowsz=$rowsz, nrows=$nrows\n";
     foreach my $nspots (sort keys %$cs) {
        my $c = $cs->{$nspots};
        print <<END;
@@ -78,7 +80,7 @@ foreach $name (sort keys %count) {
 }
 
 print <<END;
-// total_count=$total_count
+// total_count=$total_count total_real_count=$total_real_count
 // max_rowsz=$max_rowsz max_nrows=$max_nrows
 END
 
index 27fbfec1cb4793a346f8b70c5992d6f43b0cc825..46b4f555f9ca4d07adf6b2e95f3a7a397fc0b843 100644 (file)
@@ -2,7 +2,7 @@
 //  update script is quacks-ingredients-updates-levels
 //  source is quacks-ingredients-counts
 module 1xFour(){ ////toplevel
-// total=1, rowsz=1, nrows=1
+// 1xFour: total=1, rowsz=1, nrows=1
   union(){
     Frame($phase, token_pitch * [ 1 + 1.00, 1 + 0.50 ]);
     $nspots = 1;
@@ -22,7 +22,7 @@ module 1xFour(){ ////toplevel
   };
 }
 module 1xOne(){ ////toplevel
-// total=1, rowsz=1, nrows=1
+// 1xOne: total=1, rowsz=1, nrows=1
   union(){
     Frame($phase, token_pitch * [ 1 + 1.00, 1 + 0.50 ]);
     $nspots = 1;
@@ -42,7 +42,7 @@ module 1xOne(){ ////toplevel
   };
 }
 module 1xThree(){ ////toplevel
-// total=1, rowsz=1, nrows=1
+// 1xThree: total=1, rowsz=1, nrows=1
   union(){
     Frame($phase, token_pitch * [ 1 + 1.00, 1 + 0.50 ]);
     $nspots = 1;
@@ -62,7 +62,7 @@ module 1xThree(){ ////toplevel
   };
 }
 module 1xTwo(){ ////toplevel
-// total=1, rowsz=1, nrows=1
+// 1xTwo: total=1, rowsz=1, nrows=1
   union(){
     Frame($phase, token_pitch * [ 1 + 1.00, 1 + 0.50 ]);
     $nspots = 1;
@@ -82,7 +82,7 @@ module 1xTwo(){ ////toplevel
   };
 }
 module 2xFour(){ ////toplevel
-// total=2, rowsz=2, nrows=1
+// 2xFour: total=2, rowsz=2, nrows=1
   union(){
     Frame($phase, token_pitch * [ 2 + 1.00, 1 + 0.50 ]);
     $nspots = 1;
@@ -103,7 +103,7 @@ module 2xFour(){ ////toplevel
   };
 }
 module 2xOne(){ ////toplevel
-// total=2, rowsz=2, nrows=1
+// 2xOne: total=2, rowsz=2, nrows=1
   union(){
     Frame($phase, token_pitch * [ 2 + 1.00, 1 + 0.50 ]);
     $nspots = 1;
@@ -124,7 +124,7 @@ module 2xOne(){ ////toplevel
   };
 }
 module 2xThree(){ ////toplevel
-// total=2, rowsz=2, nrows=1
+// 2xThree: total=2, rowsz=2, nrows=1
   union(){
     Frame($phase, token_pitch * [ 2 + 1.00, 1 + 0.50 ]);
     $nspots = 1;
@@ -145,7 +145,7 @@ module 2xThree(){ ////toplevel
   };
 }
 module 2xTwo(){ ////toplevel
-// total=2, rowsz=2, nrows=1
+// 2xTwo: total=2, rowsz=2, nrows=1
   union(){
     Frame($phase, token_pitch * [ 2 + 1.00, 1 + 0.50 ]);
     $nspots = 1;
@@ -166,7 +166,7 @@ module 2xTwo(){ ////toplevel
   };
 }
 module 3xFour(){ ////toplevel
-// total=3, rowsz=2, nrows=2
+// 3xFour: total=3, rowsz=2, nrows=2
   union(){
     Frame($phase, token_pitch * [ 2 + 1.00, 2 + 0.50 ]);
     $nspots = 1;
@@ -188,7 +188,7 @@ module 3xFour(){ ////toplevel
   };
 }
 module 3xOne(){ ////toplevel
-// total=3, rowsz=2, nrows=2
+// 3xOne: total=3, rowsz=2, nrows=2
   union(){
     Frame($phase, token_pitch * [ 2 + 1.00, 2 + 0.50 ]);
     $nspots = 1;
@@ -210,7 +210,7 @@ module 3xOne(){ ////toplevel
   };
 }
 module 3xThree(){ ////toplevel
-// total=3, rowsz=2, nrows=2
+// 3xThree: total=3, rowsz=2, nrows=2
   union(){
     Frame($phase, token_pitch * [ 2 + 1.00, 2 + 0.50 ]);
     $nspots = 1;
@@ -232,7 +232,7 @@ module 3xThree(){ ////toplevel
   };
 }
 module 3xTwo(){ ////toplevel
-// total=3, rowsz=2, nrows=2
+// 3xTwo: total=3, rowsz=2, nrows=2
   union(){
     Frame($phase, token_pitch * [ 2 + 1.00, 2 + 0.50 ]);
     $nspots = 1;
@@ -254,7 +254,7 @@ module 3xTwo(){ ////toplevel
   };
 }
 module Black(){ ////toplevel
-// total=18, rowsz=5, nrows=4
+// Black: total=18, rowsz=5, nrows=4
   union(){
     Frame($phase, token_pitch * [ 5 + 1.00, 4 + 0.50 ]);
     $nspots = 1;
@@ -291,7 +291,7 @@ module Black(){ ////toplevel
   };
 }
 module Blue(){ ////toplevel
-// total=34, rowsz=6, nrows=6
+// Blue: total=34, rowsz=6, nrows=6
   union(){
     Frame($phase, token_pitch * [ 6 + 1.00, 6 + 0.50 ]);
     $nspots = 1;
@@ -344,7 +344,7 @@ module Blue(){ ////toplevel
   };
 }
 module Green(){ ////toplevel
-// total=38, rowsz=7, nrows=6
+// Green: total=38, rowsz=7, nrows=6
   union(){
     Frame($phase, token_pitch * [ 7 + 1.00, 6 + 0.50 ]);
     $nspots = 1;
@@ -401,7 +401,7 @@ module Green(){ ////toplevel
   };
 }
 module Orange(){ ////toplevel
-// total=20, rowsz=5, nrows=4
+// Orange: total=20, rowsz=5, nrows=4
   union(){
     Frame($phase, token_pitch * [ 5 + 1.00, 4 + 0.50 ]);
     $nspots = 1;
@@ -440,7 +440,7 @@ module Orange(){ ////toplevel
   };
 }
 module Purple(){ ////toplevel
-// total=15, rowsz=4, nrows=4
+// Purple: total=15, rowsz=4, nrows=4
   union(){
     Frame($phase, token_pitch * [ 4 + 1.00, 4 + 0.50 ]);
     $nspots = 1;
@@ -474,7 +474,7 @@ module Purple(){ ////toplevel
   };
 }
 module Red(){ ////toplevel
-// total=30, rowsz=6, nrows=5
+// Red: total=30, rowsz=6, nrows=5
   union(){
     Frame($phase, token_pitch * [ 6 + 1.00, 5 + 0.50 ]);
     $nspots = 1;
@@ -523,7 +523,7 @@ module Red(){ ////toplevel
   };
 }
 module White(){ ////toplevel
-// total=32, rowsz=6, nrows=6
+// White: total=32, rowsz=6, nrows=6
   union(){
     Frame($phase, token_pitch * [ 6 + 1.00, 6 + 0.50 ]);
     $nspots = 1;
@@ -574,7 +574,7 @@ module White(){ ////toplevel
   };
 }
 module Yellow(){ ////toplevel
-// total=29, rowsz=6, nrows=5
+// Yellow: total=29, rowsz=6, nrows=5
   union(){
     Frame($phase, token_pitch * [ 6 + 1.00, 5 + 0.50 ]);
     $nspots = 1;
@@ -621,5 +621,5 @@ module Yellow(){ ////toplevel
     translate(token_pitch * [   2.5,   1.0 ]) Token_L();
   };
 }
-// total_count=240
+// total_count=240 total_real_count=216
 // max_rowsz=7 max_nrows=6
index 6ce8c4641a58607e21a8b3532065c7c87f39f52f..b54cca69f00ee4d8f8039f49866f497f45dca4f5 100755 (executable)
@@ -22,3 +22,5 @@ END
 
 ./quacks-ingredients-counts >>$f.tmp
 mv -f $f.tmp $f
+
+egrep '^//' $f | sort