| 1 |
%====================================================================== |
| 2 |
% This is |
| 3 |
% king.mf |
| 4 |
% |
| 5 |
% Copyright (C) 1989-93 by Elmar Bartel. |
| 6 |
% |
| 7 |
% This program is free software; you can redistribute it and/or modify |
| 8 |
% it under the terms of the GNU General Public License as published by |
| 9 |
% the Free Software Foundation; either version 1, or (at your option) |
| 10 |
% any later version. |
| 11 |
% |
| 12 |
% This program is distributed in the hope that it will be useful, |
| 13 |
% but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
% GNU General Public License for more details. |
| 16 |
% |
| 17 |
% You should have received a copy of the GNU General Public License |
| 18 |
% along with this program; if not, write to the Free Software |
| 19 |
% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 20 |
%====================================================================== |
| 21 |
% |
| 22 |
def SetParam = |
| 23 |
numeric BowOneW,ThreeFour,SixHor,FourSix; |
| 24 |
BowOneW = .53qs; |
| 25 |
ThreeFour = .07; |
| 26 |
FourFive = .65; % z5 is Top of Heart |
| 27 |
SixHor = 1.52; |
| 28 |
FourSix = .27; |
| 29 |
|
| 30 |
numeric CrossWidth, CrossHeight, CrossAbove; |
| 31 |
CrossWidth = .20; |
| 32 |
CrossHeight = .10; |
| 33 |
CrossAbove = .20; %Middle of cross above center of heart. |
| 34 |
enddef; |
| 35 |
|
| 36 |
def DefinePointsAndBows = |
| 37 |
% Points are numbered from 0 to 9 from lower to upper |
| 38 |
% Points to the left have suffix a, right suffic b |
| 39 |
% points without further suffix are in the center |
| 40 |
|
| 41 |
SetParam; |
| 42 |
DefineFootBows( 0, % No Space to Bottom |
| 43 |
BowOneW, |
| 44 |
.275qs,% FootHeight |
| 45 |
.42, % BowTwoLoc |
| 46 |
.195, % WidthToHeight |
| 47 |
0.91, % BowTwoLen |
| 48 |
0.82); % BowThreeLen |
| 49 |
|
| 50 |
z4 = z3 + BowOneW*ThreeFour*up; |
| 51 |
z5 = z4 + BowOneW*FourFive*up; |
| 52 |
y6l= y6r = y4 + BowOneW*FourSix; |
| 53 |
x6l + x6r = qs; x6r - x6l = SixHor*BowOneW; |
| 54 |
|
| 55 |
z7 = z5 + CrossAbove*BowOneW*up; |
| 56 |
y7 = y7l = y7r; |
| 57 |
x7l + x7r = qs; x7r - x7l = CrossWidth*BowOneW; |
| 58 |
z8 = z7 + CrossHeight*BowOneW*up; |
| 59 |
|
| 60 |
path Cross[]; |
| 61 |
Cross1= z5--z8; |
| 62 |
Cross2= z7l--z7r; |
| 63 |
enddef; |
| 64 |
|
| 65 |
def DrawCross = |
| 66 |
draw Cross1; |
| 67 |
draw Cross2; |
| 68 |
enddef; |
| 69 |
|
| 70 |
def DefineKingPaths = |
| 71 |
path LeftPath,RightPath,LeftInnerPath,RightInnerPath, |
| 72 |
OuterPath,TopHeartPath,HeartPath; |
| 73 |
LeftPath = z1l .. z2l .. z3l & z3l{-1.3,1} .. z6l .. {.1,-1} z4 -- z3; |
| 74 |
RightPath= reverse LeftPath reflectedabout (z3,z4); |
| 75 |
%RightPath= z3 -- z4 {up} .. z6r .. z3r .. z2r .. z1r; |
| 76 |
LeftInnerPath = ParallelPath(subpath (1.8,5)of LeftPath, |
| 77 |
-1.6*thin); |
| 78 |
RightInnerPath = LeftInnerPath reflectedabout (z3,z4); |
| 79 |
|
| 80 |
OuterPath = LeftPath .. RightPath .. Bow0 .. cycle; |
| 81 |
HeartStart = 3.81; |
| 82 |
HeartPath = subpath (4,HeartStart) of LeftPath & |
| 83 |
point HeartStart of LeftPath |
| 84 |
{-direction HeartStart of LeftPath}.. |
| 85 |
{right}z5{right}.. |
| 86 |
point HeartStart of reverse RightPath |
| 87 |
{direction HeartStart of reverse RightPath} & |
| 88 |
subpath (HeartStart,4) of reverse RightPath; %.. point HeartStart of LeftPath; |
| 89 |
|
| 90 |
enddef; |
| 91 |
|
| 92 |
def MakeWhiteKing = |
| 93 |
clearit; |
| 94 |
pickup chess_pen; |
| 95 |
draw Bow[1]; |
| 96 |
draw Bow[2]; |
| 97 |
draw Bow[3]; |
| 98 |
draw OuterPath; |
| 99 |
draw HeartPath; |
| 100 |
DrawCross; |
| 101 |
%pickup inner_pen; |
| 102 |
%pickup chess_pen; |
| 103 |
%draw ParallelPath(subpath(1.7,5)of LeftPath,-2thin); |
| 104 |
%draw ParallelPath(subpath(0,3.3)of RightPath,-2thin); |
| 105 |
if proofing > 0: |
| 106 |
ScreenGrid(0,qs)(0,qs); |
| 107 |
fi; |
| 108 |
WhiteMan:= currentpicture; |
| 109 |
enddef; |
| 110 |
|
| 111 |
def MakeBlackKing = |
| 112 |
clearit; |
| 113 |
pickup chess_pen; |
| 114 |
filldraw HeartPath .. cycle; |
| 115 |
DrawCross; |
| 116 |
cullit; |
| 117 |
undraw ParallelPath(subpath (.6,3.4) of HeartPath, -thin); |
| 118 |
cullit; |
| 119 |
filldraw OuterPath; |
| 120 |
cullit; |
| 121 |
pickup chess_pen scaled 1.1; |
| 122 |
undraw ShortenPath(Bow[1],1.5thin); |
| 123 |
undraw ShortenPath(Bow[2],1.6thin); |
| 124 |
undraw ShortenPath(Bow[3],1.2thin); |
| 125 |
undraw subpath (4,9) of ParallelPath(LeftPath,-thin); |
| 126 |
undraw subpath (0,6) of ParallelPath(RightPath,-thin); |
| 127 |
BlackMan:= currentpicture; |
| 128 |
enddef; |
| 129 |
|
| 130 |
def MakeOuterShape = |
| 131 |
clearit; |
| 132 |
pickup frame_pen; |
| 133 |
DrawCross; |
| 134 |
filldraw OuterPath; |
| 135 |
filldraw HeartPath .. cycle; |
| 136 |
cullit; |
| 137 |
OuterShape:= currentpicture; |
| 138 |
enddef; |
| 139 |
|
| 140 |
DefinePointsAndBows; |
| 141 |
DefineKingPaths; |
| 142 |
|
| 143 |
MakeWhiteKing; |
| 144 |
MakeBlackKing; |
| 145 |
MakeNeutral(WhiteMan, BlackMan); |
| 146 |
MakeOuterShape; |
| 147 |
|
| 148 |
|
| 149 |
%ScreenGrid(0,qs,x6r)(0,qs,y6r); |
| 150 |
|
| 151 |
%=========================================================== |
| 152 |
% this one for testing |
| 153 |
%beginchar(King+Black+OnBlack, qs#, qs#, 0); |
| 154 |
% "Black king on black field"; |
| 155 |
% MakeBlackField; |
| 156 |
% cullit; |
| 157 |
% currentpicture:= currentpicture - OuterShape; |
| 158 |
% cullit; |
| 159 |
% currentpicture:= currentpicture + BlackMan; |
| 160 |
%endchar; |
| 161 |
%endinput |
| 162 |
%=========================================================== |
| 163 |
|
| 164 |
beginchar(King+White+OnWhite, qs#, qs#, 0); |
| 165 |
"White king on white field"; |
| 166 |
currentpicture:= WhiteMan; |
| 167 |
%labels(z0,z1l,z1,z1r,z2l,z2,z2r); |
| 168 |
%labels(z3l,z3,z3l,z4,z5,z6l,z6r); |
| 169 |
%labels(z7l,z7,z7r,z8); |
| 170 |
endchar; |
| 171 |
|
| 172 |
beginchar(King+White+OnWhite+LeftTurned, qs#, qs#, 0); |
| 173 |
"White king turned to the left on white field"; |
| 174 |
currentpicture:= TurnLeft(WhiteMan); |
| 175 |
endchar; |
| 176 |
|
| 177 |
beginchar(King+White+OnWhite+RightTurned, qs#, qs#, 0); |
| 178 |
"White king turned to the right on white field"; |
| 179 |
currentpicture:= TurnRight(WhiteMan); |
| 180 |
endchar; |
| 181 |
|
| 182 |
beginchar(King+White+OnWhite+UpSideDown, qs#, qs#, 0); |
| 183 |
"White king turned upsidedown on white field"; |
| 184 |
currentpicture:= TurnUpSideDown(WhiteMan); |
| 185 |
endchar; |
| 186 |
|
| 187 |
%=========================================================== |
| 188 |
|
| 189 |
beginchar(King+White+OnBlack, qs#, qs#, 0); |
| 190 |
"White king on black field"; |
| 191 |
MakeBlackField; |
| 192 |
cullit; |
| 193 |
currentpicture:= currentpicture - OuterShape; |
| 194 |
cullit; |
| 195 |
currentpicture:= currentpicture + WhiteMan; |
| 196 |
endchar; |
| 197 |
|
| 198 |
beginchar(King+White+OnBlack+LeftTurned, qs#, qs#, 0); |
| 199 |
"White king turned to the left on black field"; |
| 200 |
MakeBlackField; |
| 201 |
cullit; |
| 202 |
currentpicture:= currentpicture - TurnLeft(OuterShape); |
| 203 |
cullit; |
| 204 |
currentpicture:= currentpicture + TurnLeft(WhiteMan); |
| 205 |
endchar; |
| 206 |
|
| 207 |
beginchar(King+White+OnBlack+RightTurned, qs#, qs#, 0); |
| 208 |
"White king turned to the right on black field"; |
| 209 |
MakeBlackField; |
| 210 |
currentpicture:= currentpicture - TurnRight(OuterShape); |
| 211 |
cullit; |
| 212 |
currentpicture:= currentpicture + TurnRight(WhiteMan); |
| 213 |
endchar; |
| 214 |
|
| 215 |
beginchar(King+White+OnBlack+UpSideDown, qs#, qs#, 0); |
| 216 |
"White king turned upsidedown on black field"; |
| 217 |
MakeBlackField; |
| 218 |
cullit; |
| 219 |
currentpicture:= currentpicture - TurnUpSideDown(OuterShape); |
| 220 |
cullit; |
| 221 |
currentpicture:= currentpicture + TurnUpSideDown(WhiteMan); |
| 222 |
endchar; |
| 223 |
|
| 224 |
%=========================================================== |
| 225 |
|
| 226 |
beginchar(King+Neutral+OnWhite, qs#, qs#, 0); |
| 227 |
"Neutral king on white field"; |
| 228 |
currentpicture:= NeutralMan; |
| 229 |
endchar; |
| 230 |
|
| 231 |
beginchar(King+Neutral+OnWhite+LeftTurned, qs#, qs#, 0); |
| 232 |
"Neutral king turned to the left on white field"; |
| 233 |
currentpicture:= TurnLeft(NeutralMan); |
| 234 |
endchar; |
| 235 |
|
| 236 |
beginchar(King+Neutral+OnWhite+RightTurned, qs#, qs#, 0); |
| 237 |
"Neutral king turned to the right on white field"; |
| 238 |
currentpicture:= TurnRight(NeutralMan); |
| 239 |
endchar; |
| 240 |
|
| 241 |
beginchar(King+Neutral+OnWhite+UpSideDown, qs#, qs#, 0); |
| 242 |
"Neutral king turned upsidedown on white field"; |
| 243 |
currentpicture:= TurnUpSideDown(NeutralMan); |
| 244 |
endchar; |
| 245 |
|
| 246 |
%=========================================================== |
| 247 |
|
| 248 |
beginchar(King+Neutral+OnBlack, qs#, qs#, 0); |
| 249 |
"Neutral king on black field"; |
| 250 |
MakeBlackField; |
| 251 |
cullit; |
| 252 |
currentpicture:= currentpicture - OuterShape; |
| 253 |
cullit; |
| 254 |
currentpicture:= currentpicture + NeutralMan; |
| 255 |
endchar; |
| 256 |
|
| 257 |
beginchar(King+Neutral+OnBlack+LeftTurned, qs#, qs#, 0); |
| 258 |
"Neutral king turned to the left on black field"; |
| 259 |
MakeBlackField; |
| 260 |
cullit; |
| 261 |
currentpicture:= currentpicture - TurnLeft(OuterShape); |
| 262 |
cullit; |
| 263 |
currentpicture:= currentpicture + TurnLeft(NeutralMan); |
| 264 |
endchar; |
| 265 |
|
| 266 |
beginchar(King+Neutral+OnBlack+RightTurned, qs#, qs#, 0); |
| 267 |
"Neutral king turned to the right on black field"; |
| 268 |
MakeBlackField; |
| 269 |
currentpicture:= currentpicture - TurnRight(OuterShape); |
| 270 |
cullit; |
| 271 |
currentpicture:= currentpicture + TurnRight(NeutralMan); |
| 272 |
endchar; |
| 273 |
|
| 274 |
beginchar(King+Neutral+OnBlack+UpSideDown, qs#, qs#, 0); |
| 275 |
"Neutral king turned upsidedown on black field"; |
| 276 |
MakeBlackField; |
| 277 |
cullit; |
| 278 |
currentpicture:= currentpicture - TurnUpSideDown(OuterShape); |
| 279 |
cullit; |
| 280 |
currentpicture:= currentpicture + TurnUpSideDown(NeutralMan); |
| 281 |
endchar; |
| 282 |
|
| 283 |
%=========================================================== |
| 284 |
|
| 285 |
beginchar(King+Black+OnWhite, qs#, qs#, 0); |
| 286 |
"Black king on white field"; |
| 287 |
currentpicture:= BlackMan; |
| 288 |
endchar; |
| 289 |
|
| 290 |
beginchar(King+Black+OnWhite+LeftTurned, qs#, qs#, 0); |
| 291 |
"Black king turned to the left on white field"; |
| 292 |
currentpicture:= TurnLeft(BlackMan); |
| 293 |
endchar; |
| 294 |
|
| 295 |
beginchar(King+Black+OnWhite+RightTurned, qs#, qs#, 0); |
| 296 |
"Black king turned to the right on white field"; |
| 297 |
currentpicture:= TurnRight(BlackMan); |
| 298 |
endchar; |
| 299 |
|
| 300 |
beginchar(King+Black+OnWhite+UpSideDown, qs#, qs#, 0); |
| 301 |
"Black king turned upsidedown on white field"; |
| 302 |
currentpicture:= TurnUpSideDown(BlackMan); |
| 303 |
endchar; |
| 304 |
|
| 305 |
%=========================================================== |
| 306 |
|
| 307 |
beginchar(King+Black+OnBlack, qs#, qs#, 0); |
| 308 |
"Black king on black field"; |
| 309 |
MakeBlackField; |
| 310 |
cullit; |
| 311 |
currentpicture:= currentpicture - OuterShape; |
| 312 |
cullit; |
| 313 |
currentpicture:= currentpicture + BlackMan; |
| 314 |
endchar; |
| 315 |
|
| 316 |
beginchar(King+Black+OnBlack+LeftTurned, qs#, qs#, 0); |
| 317 |
"Black king turned to the left on black field"; |
| 318 |
MakeBlackField; |
| 319 |
cullit; |
| 320 |
currentpicture:= currentpicture - TurnLeft(OuterShape); |
| 321 |
cullit; |
| 322 |
currentpicture:= currentpicture + TurnLeft(BlackMan); |
| 323 |
endchar; |
| 324 |
|
| 325 |
beginchar(King+Black+OnBlack+RightTurned, qs#, qs#, 0); |
| 326 |
"Black king turned to the right on black field"; |
| 327 |
MakeBlackField; |
| 328 |
currentpicture:= currentpicture - TurnRight(OuterShape); |
| 329 |
cullit; |
| 330 |
currentpicture:= currentpicture + TurnRight(BlackMan); |
| 331 |
endchar; |
| 332 |
|
| 333 |
beginchar(King+Black+OnBlack+UpSideDown, qs#, qs#, 0); |
| 334 |
"Black king turned upsidedown on black field"; |
| 335 |
MakeBlackField; |
| 336 |
cullit; |
| 337 |
currentpicture:= currentpicture - TurnUpSideDown(OuterShape); |
| 338 |
cullit; |
| 339 |
currentpicture:= currentpicture + TurnUpSideDown(BlackMan); |
| 340 |
endchar; |
| 341 |
|
| 342 |
endinput |