use strict;
+our $black = '0 0 0 1 setcmykcolor';
+
my $green = ["1 0 1 0", "0 0 0 0"];
sub chip ($$) {
$o;
}
-sub general_book ($) {
- my ($this) = @_;
+sub general_book ($$) {
+ my ($this, $costs) = @_;
my $o = <<END;
%!
90 rotate
10 10 translate
-0 0 0 1 setcmykcolor
+$black
1 setlinewidth
/tw 57.5 def
/chip 15 def
/spot 3.5 def
+/costtexth 0.215 def
+/costtextsz 12 def
+/costtextdx -0.03 def
+/costfont /Heletica-BoldOblique findfont costtextsz scalefont def
tw 0 translate
END
foreach my $costi (0..2) {
+ my $cost = $costs->[$costi];
my $pips = qw(1 2 4)[$costi];
$o .= <<END
+ costfont setfont
+ -2.5 $costi add 3 div
gsave
- -2.5 $costi add 3 div costcirch dc translate
+ dup costcirch dc translate
${\ chip($this,$pips) }
grestore
+ costtexth exch costtextdx add exch dc moveto
+ $black
+ ($cost)
+ dup stringwidth pop -0.5 mul costtextsz neg rmoveto
+ show
END
}
}
sub green_book () {
- general_book($green);
+ general_book($green, [qw(5 9 15)]);
}
print green_book() or die $!;