5 our $black = '0 0 0 setrgbcolor';
7 my $pumpkin = [".9 .7 0", "0 0 0"];
8 my $green = ["0 .5 0", "1 1 1"];
9 my $red = ["1 0 0", "0 0 0"];
10 my $blue = ["0.4 0.4 1", "1 1 1"];
11 my $yellow = [".9 .9 0", "0 0 0"];
12 my $moth = ["0 0 0", "1 1 1"];
13 my $purple = ["1 0 0.8", "0 0 0"];
14 my $lotus = ["0.6 0.7 .5", "0.5 0.5 0"];
17 my ($cary, $pips) = @_; # put in a gsave translate
20 0 0 chip 0.5 mul 0 360 arc
21 gsave 1 setlinewidth $black stroke grestore
22 $cary->[0] setrgbcolor fill
23 $cary->[1] setrgbcolor
29 spot 0.5 sqrt mul 1.1 mul dup
36 $spot->( 0, 0) if $pips & 1;
37 $spot->(-1,-1) if $pips & 6;
38 $spot->(+1,+1) if $pips & 6;
39 $spot->(-1,+1) if $pips & 4;
40 $spot->(+1,-1) if $pips & 4;
49 0 chip -0.5 mul translate
51 newpath 0 0 chip 0.5 mul 0 360 arc stroke
52 /Times-Bold findfont 7 scalefont setfont
56 -1 -1 moveto 6 0 rlineto 0 7 rlineto -6 0 rlineto
57 closepath 0.5 setlinewidth stroke
68 chip -0.5 mul $fsz -0.30 mul moveto
69 /Helvetica-Bold findfont $fsz scalefont setfont
70 (Any) dup stringwidth 3 2 roll show
73 ${\ chip(['0 0 0 0.5', '0 0 0 0'], $pips) }
78 sub ruby () { # put in gsave translate
86 1 0.5 0.5 setrgbcolor gsave fill grestore
87 $black 1 setlinewidth stroke
95 /Times-Roman findfont $fontsz scalefont setfont $black
98 my @lines = split /\n/, $text;
99 foreach my $y (0..$#lines) {
101 $l =~ s/[()\\]/\\$&/g;
102 my $yd = $fontsz * (0.5*@lines - $y);
106 ($l) dup stringwidth pop -0.5 mul 0 rmoveto
114 sub general_book ($$) { # put in a gsave
115 my ($this, $costs) = @_;
137 0 thirdlineh dc rlineto
138 -1 thirdlineh dc lineto stroke
140 /thirddivline { % xprop
142 dup -3 div 0 dc moveto
143 -3 div thirdlineh dc lineto stroke
149 $o .= <<END if @$costs == 3;
154 foreach my $costi (0..2) {
157 $cost = $costs->[$costi];
158 $pips = qw(1 2 4)[$costi];
160 next unless $costi == 1;
166 -2.5 $costi add 3 div
168 dup costcirch dc translate
169 ${\ chip($this,$pips) }
171 costtexth exch costtextdx add exch dc moveto
174 dup stringwidth pop -0.5 mul costtextsz neg rmoveto
183 my $o = general_book($green, [qw(5 9 15)]);
186 gsave 0.25 0.15 dc translate ${\ chip($pumpkin,0) } grestore
187 gsave 0.25 0.40 dc translate ${\ chip($green,0) } grestore
192 0.40 0.17 dc moveto (last) show
195 0.40 0.09 dc moveto (3) show
196 /Times-Roman findfont
198 0.45 0.14 dc moveto (}) show
201 0.85 0.275 dc translate
206 $o .= exposition(<<END);
207 For each pumpkin in the last 3 chips,
209 But, not more rubies than the number
210 of green chips in your pot.
217 my $o = general_book($red, [qw(4 9 16)]);
220 gsave 0.35 0.30 dc translate ${\ chip($pumpkin,0) } grestore
224 0.50 0.24 dc moveto (+1) show
228 $o .= exposition(<<END);
229 The next 1/2/4 pumpkins you place are
230 each moved one extra space.
231 (After applying any other special effects;
232 one extra space no matter how many reds)
239 my $o = general_book($blue, [qw(4 10 18)]);
242 /Times-Bold findfont 15 scalefont setfont $black
246 my ($that, $pips) = @_;
248 gsave ${\ chip($that, $pips) } grestore
259 my ($y, $pips, $content) = @_;
262 0.16 0.15 0.16 $y mul add dc translate
264 gsave ${\ chip($blue,$pips) } grestore
273 0.50 0.65 dc translate
275 gsave -10 0 translate ${\ chip($pumpkin,1) } grestore
281 $o .= $exchline->(2, 1, <<END);
282 ${\ $exchip->($green,1) } ${\ $exslash->() }
283 ${\ $exchip->($red, 1) } ${\ $exslash->() }
284 ${\ $exchip->($blue, 1) } ${\ $exslash->() }
285 ${\ $exchip->($yellow, 1) }
288 $o .= $exchline->(1, 2, <<END);
289 ${\ $exchip->($moth,1) } ${\ $exslash->() }
290 ${\ $exchip->($purple,1) } ${\ $exslash->() }
294 $o .= $exchline->(0, 4, <<END);
298 $o .= exposition(<<END);
299 If the previous chip placed was a pumpkin,
300 you may exchange it as follows:
309 my $o = general_book($lotus, [8, 0]);
312 /Times-Bold findfont 15 scalefont setfont $black
315 0.36 0.38 dc translate
317 gsave ${\ chip($lotus,0) } grestore
322 0.20 0.15 dc translate
324 gsave ${\ chip($pumpkin,0) } grestore
325 chip 0.5 mul 0 translate
326 gsave ${\ chip($pumpkin,0) } grestore
328 10 -4.5 moveto (... +1) show
334 0.16 0.20 dc translate
337 gsave ${\ veepsspot(chip($pumpkin, 0)) } grestore
338 gsave 0 20 translate ${\ chip($purple, 1) } grestore
343 /Times-Roman findfont
345 0.48 0.14 dc moveto (}) show
349 0.83 0.25 dc translate
351 ${\ chip(['0 0 0 0.5', ''], 0) }
355 0.72 0.22 dc translate
357 $black 0 0 moveto (?+?) show
362 $o .= exposition(<<END);
363 The value of this chip is
364 1 higher than the number of pumpkins
365 previously placed in the pot (but max.4)
372 my $o = general_book($purple, [10, 1]);
375 gsave ${\ veepsspot(chip($pumpkin, 0)) } grestore
376 gsave 0 20 translate ${\ chip($purple, 1) } grestore
380 /Times-Bold findfont 15 scalefont setfont $black
382 0.16 0.20 dc translate
386 8 -12 moveto (...) show
392 /Times-Roman findfont
394 0.48 0.14 dc moveto (}) show
398 0.83 0.25 dc translate
400 ${\ chip(['0 0 0 0.5', ''], 0) }
404 0.72 0.22 dc translate
406 $black 0 0 moveto (?+?) show
410 $o .= exposition(<<END);
411 For each pumpkin in the pot (but
412 not more than the number of purple chips),
413 add up the VPs of the covered spaces.
414 Buy 1/2 chips of up to that total value.
421 my $index = scalar @_;
429 while (my $d = pop @_) {
439 0 th 10 add $pos mul translate
444 dup th add 0 translate
446 $pos 3 sub mul 0 translate
452 /Courier-Bold findfont 6 scalefont setfont
465 print <<END or die $!;
468 72 25.4 div dup scale
485 /costtextdx -0.03 def
486 /costfont /Heletica-BoldOblique findfont costtextsz scalefont def
490 % diagonal conversion
492 dup th mul % xprop yprop y
493 3 1 roll % y xprop yprop
494 bdiag mul neg % y xprop x-margin-at-this-height
495 tw add % y xprop x-width-at-this-height
496 exch mul % y x-width-at-this-height xprop
501 $black 1 setlinewidth
503 0 0 moveto arrowlen 0 rlineto
504 arrowhead dup neg exch rmoveto
505 arrowhead dup neg rlineto
506 arrowhead neg dup rlineto