Debian Codegraph @

texmf-dist/metapost/bbcard/scorecard.mp

raw
1 %
2 % Ball score card
3
4 defaultfont:="rptmr";
5 defaultscale := 1;
6 prologues := 1;
7 special "/rptmr /Times-Roman def";
8
9 % pen for the outer box
10 pickup pencircle scaled 1 pt;
11 fat nib = savepen;
12
13 % pen for the cross-lines
14 pickup pencircle scaled .5 pt;
15 medium nib = savepen;
16
17 % pen for slashes
18 pickup pencircle scaled .1 pt;
19 thin nib = savepen;
20
21 un = 1 cm;
22
23 def urc (expr x,y) =
24 ((x,y)-(.2un,0)){right}..{down}((x,y)-(0,.2un))
25 enddef;
26 def lrc (expr x, y) =
27 ((x,y)+(0,.2un)){down}..{left}((x,y)-(.2un,0))
28 enddef;
29 def llc (expr x, y) =
30 ((x,y)+(.2un,0)){left}..{up}((x,y)+(0,.2un))
31 enddef;
32 def ulc (expr x, y) =
33 ((x,y)-(0,.2un)){up}..{right}((x,y)+(.2un,0))
34 enddef;
35
36
37 beginfig(-1);
38
39 picture pitcherbox, batterbox;
40
41 batterbox = image (
42 % outer frame
43 pickup fat nib;
44 draw llc (0,0)---ulc (0,11un)---urc(20un,11un)---lrc (20un,0)---cycle;
45
46 % and some frame-like lines
47 draw (0,1un)---(20un,1un);
48 draw (0,10un)---(20un,10un);
49 draw (4un,0)---(4un,11un);
50
51 % name separators
52 pickup medium nib;
53 for i = 2un step un until 9 un:
54 draw (0,i)---(20un,i);
55 endfor;
56
57 for i := 5 un step un until 19 un:
58 draw (i, 0)---(i, 11un);
59 endfor;
60 % added by Dave Rebnord
61 for i := 4 un step un until 14 un:
62 for j := 1 un step un until 9 un :
63 draw (i+0.2un,j+0.5un)---(i+0.5un, j+0.8un)---(i+0.8un,j+0.5un)---(i+0.5un,j+0.2un)---cycle withcolor .25[white, black];
64 endfor;
65 endfor;
66
67 % slashes and other light lines
68 pickup thin nib;
69 for i := 4un step un until 15un:
70 draw (i,0)---(i+un, un);
71 endfor;
72
73 for i := un step un until 9un:
74 draw (0, i+.5un)---(4un, i+.5un);
75 draw (15un, i)---(16un, i+un);
76 draw (19un, i)---(20un, i+un);
77 endfor;
78
79
80 draw (15un, 0)---(16un, un);
81 draw (19un, 0)---(20un, un);
82 draw (15un, 10un)---(16un, 11un);
83 draw (19un, 10un)---point .5 of (urc (20un,11un));
84
85
86 % labels
87 for i := 1 upto 11:
88 label(decimal i, ((3.5+i)*un, 10.5un));
89 endfor;
90
91 label.rt("Totals", (0, .5un));
92
93 label.lft("Runs", (4un, 2/3un));
94 label.lft("Hits", (4un, 1/3un));
95
96
97 label.bot("ab", (15.3un, 11un));
98 label.top("ap", (15.7un, 10un));
99
100 label("r", (16.5un, 10.5un));
101 label("h", (17.5un, 10.5un));
102 label("rbi", (18.5un, 10.5un));
103
104 label.bot("ob", (19.3un, 11un));
105 label.top("e", (19.7un, 10un));
106 );
107
108
109 pitcherbox = image (
110 % outer frame
111 pickup fat nib;
112 ph = 4.5un/5;
113 draw llc (0,0)---ulc (0, 5ph)---urc (20un,5ph)---lrc (20un,0)---cycle;
114
115 % and some frame-like lines
116 draw urc (10un,5ph)---lrc (10un, 4ph)---llc (0,4ph);
117
118 draw urc (10un, 4ph)---(10un,0);
119 draw (4un,0)..(4un,5ph);
120
121 % name separators
122 pickup medium nib;
123
124 draw ulc (10un, 4ph)---(20un,4ph);
125 draw llc (10un, 4ph);
126
127 for i = ph step ph until 3ph:
128 draw (0,i)---(20un,i);
129 endfor;
130
131 for i := 0 step un until 4un:
132 draw (5un+i,0)---(5un+i, 5ph);
133 draw (14un+i,0)---(14un+i, 5ph);
134 endfor;
135 draw (19un,0)---(19un, 5ph);
136
137 label("Pitchers", (2un, 4.5ph));
138 label("IP", (4.5un, 4.5ph));
139 label("H", (5.5un, 4.5ph));
140 label("R", (6.5un, 4.5ph));
141 label("ER", (7.5un, 4.5ph));
142 label("K", (8.5un, 4.5ph));
143 label("BB", (9.5un, 4.5ph));
144 );
145
146
147 draw batterbox shifted (.75un, .75un);
148 draw pitcherbox shifted (.75un, 11.85un);
149 draw batterbox shifted (.75un, 16.45un);
150
151 endfig;
152 end;