5 our $black = '0 0 0 1 setcmykcolor';
7 my $pumpkin = ["0 .50 0 1.00 0", "0 0 0 1"];
8 my $green = ["1 0 1 0", "0 0 0 0"];
9 my $red = ["0 1 1 0", "0 0 0 1"];
12 my ($cary, $pips) = @_; # put in a gsave translate
15 0 0 chip 0.5 mul 0 360 arc
16 gsave 1 setlinewidth $black stroke grestore
17 $cary->[0] setcmykcolor fill
18 $cary->[1] setcmykcolor
24 spot 0.5 sqrt mul 1.1 mul dup
31 $spot->( 0, 0) if $pips & 1;
32 $spot->(-1,-1) if $pips & 6;
33 $spot->(+1,+1) if $pips & 6;
34 $spot->(-1,+1) if $pips & 4;
35 $spot->(+1,-1) if $pips & 4;
40 sub ruby () { # put in gsave translate
48 0 1 0.5 0 setcmykcolor gsave fill grestore
49 $black 1 setlinewidth stroke
57 /Times-Roman findfont $fontsz scalefont setfont $black
60 my @lines = split /\n/, $text;
61 foreach my $y (0..$#lines) {
63 $l =~ s/[()\\]/\\$&/g;
64 my $yd = $fontsz * (0.5*@lines - $y);
68 ($l) dup stringwidth pop -0.5 mul 0 rmoveto
76 sub general_book ($$) { # put in a gsave
77 my ($this, $costs) = @_;
82 0 0 0 0.2 setcmykcolor
99 0 thirdlineh dc rlineto
100 -1 thirdlineh dc lineto stroke
102 /thirddivline { % xprop
104 dup -3 div 0 dc moveto
105 -3 div thirdlineh dc lineto stroke
114 foreach my $costi (0..2) {
115 my $cost = $costs->[$costi];
116 my $pips = qw(1 2 4)[$costi];
119 -2.5 $costi add 3 div
121 dup costcirch dc translate
122 ${\ chip($this,$pips) }
124 costtexth exch costtextdx add exch dc moveto
127 dup stringwidth pop -0.5 mul costtextsz neg rmoveto
136 my $o = general_book($green, [qw(5 9 15)]);
139 gsave 0.2 0.15 dc translate ${\ chip($pumpkin,0) } grestore
140 gsave 0.2 0.40 dc translate ${\ chip($green,0) } grestore
145 0.35 0.17 dc moveto (last) show
148 0.35 0.09 dc moveto (3) show
149 /Times-Roman findfont
151 0.45 0.14 dc moveto (}) show
154 0.85 0.275 dc translate
159 $o .= exposition(<<END);
160 For each pumpkin in the last 3 chips,
162 But, not more rubies than the number
163 of green chips in your pot.
170 my $o = general_book($red, [qw(4 9 16)]);
173 gsave 0.35 0.30 dc translate ${\ chip($pumpkin,0) } grestore
177 0.50 0.24 dc moveto (+1) show
181 $o .= exposition(<<END);
182 The next 1/2/4 pumpkins you place are
183 each moved one extra space.
184 (After applying any other special effects;
185 one extra space no matter how many reds)
199 while (my $d = shift @_) {
209 0 th 10 add $pos mul translate
214 dup th add 0 translate
216 $pos 3 sub mul 0 translate
229 print <<END or die $!;
232 72 25.4 div dup scale
247 /costtextdx -0.03 def
248 /costfont /Heletica-BoldOblique findfont costtextsz scalefont def
252 % diagonal conversion
254 dup th mul % xprop yprop y
255 3 1 roll % y xprop yprop
256 bdiag mul neg % y xprop x-margin-at-this-height
257 tw add % y xprop x-width-at-this-height
258 exch mul % y x-width-at-this-height xprop