8 our $which = shift @ARGV;
12 return unless $which eq 'Base';
13 foreach my $count (qw(1 2 3)) {
14 foreach my $nspots (qw(0 1 2 3 4)) {
15 $_ = $cb->($count,$nspots)."\t".$_;
20 $_=<DATA>; chomp or die;
22 my ($xcount,$xnspots) = @_;
23 "${xcount}x". (qw(Zero One Two Three Four)[$xnspots]);
25 our @names = split /\t/, $_;
29 foreach my $nspots (qw(1 2 3 4 0)) {
30 $_=<DATA>; chomp or die;
32 my ($xcount,$xnspots) = @_;
33 $xnspots == $nspots and "$xcount+0";
35 my @l = split /\t/, $_;
36 foreach my $i (0..$#names) {
39 m/\+/ or die "$which $nspots ?";
41 $count{$names[$i]}{$nspots} =
42 $which eq 'All' ? $` + $' :
43 $which eq 'Base' ? $` :
44 $which eq 'Witches' ? $' :
55 our $total_real_count;
60 my $cs = $count{$name};
61 my $total = 0; $total += $_ foreach values %$cs;
63 print "module ${which}_$name(){ ////toplevel\n";
64 my $rowsz = ceil(sqrt($total));
65 my $nrows = ceil($total / $rowsz);
66 $total_count += $total;
67 $total_real_count += $total if $name =~ m/^[A-Z][a-z]+$/;
68 $max_nrows = $nrows if $nrows > $max_nrows;
69 $max_rowsz = $rowsz if $rowsz > $max_rowsz;
71 printf "// %s %-10s total=%2d rowsz=$rowsz nrows=$nrows\n",
72 $which, "$name", $total;
73 foreach my $nspots (sort keys %$cs) {
74 my $c = $cs->{$nspots};
77 Frame(\$phase, token_pitch * [ $rowsz + 1.00, $nrows + 0.50 ]);
81 my $xy = sprintf "[ %5.1f, %5.1f ]",
82 int($ix / $nrows) - 0.5 * ($rowsz-1),
83 $ix % $nrows - 0.5 * ($nrows-1);
84 print " translate(token_pitch * $xy) Token_L();\n";
94 foreach $name (sort keys %count) {
99 // $which total_count=$total_count total_real_count=$total_real_count
100 // $which max_rowsz=$max_rowsz max_nrows=$max_nrows
103 STDOUT->error and die $!;
106 White Green Blue Red Yellow Purple Black Orange Orange6 Loco WhiteSpare
107 21+6 15+10 14+8 12+6 13+6 15+8 18+8 20+12 1+0
108 9+3 10+5 10+5 8+5 6+5 1+0