| 1 |
%====================================================================== |
| 2 |
% This is |
| 3 |
% equi.mf |
| 4 |
% |
| 5 |
% Copyright (C) 1995 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 |
% 11 _______________________ 12 |
| 23 |
% \ / |
| 24 |
% \ / |
| 25 |
% \ / |
| 26 |
% 9 \---------------/ 10 |
| 27 |
% \ / |
| 28 |
% \ / |
| 29 |
% \ / |
| 30 |
% \ / |
| 31 |
% \ / |
| 32 |
% \ / |
| 33 |
% 7 +-------------+ 8 - |
| 34 |
% |<---wdbar--->| | htbar |
| 35 |
% 5 +-------------+ 6 - |
| 36 |
% / \ |
| 37 |
% / \ |
| 38 |
% / \ |
| 39 |
% / \ |
| 40 |
% / \ |
| 41 |
% / \ |
| 42 |
% / \ |
| 43 |
% 3 /-----------------\ 4 |
| 44 |
% / \ |
| 45 |
% / \ |
| 46 |
% 1 ----------------------- 2 |
| 47 |
% |<--------wdbot-------->| |
| 48 |
% |
| 49 |
def SetParam = |
| 50 |
numeric wdbott, wdbar, htbar, diagpos, rdiagpos; |
| 51 |
wdbott:= .75 BottomWidth; |
| 52 |
wdbar:= .50 BottomWidth; |
| 53 |
htbar:= 0.065*(qs - BottomSpace - TopSpace); |
| 54 |
diagpos=.095; |
| 55 |
rdiagpos= 1-diagpos; |
| 56 |
enddef; |
| 57 |
|
| 58 |
def DefinePointsAndPaths = |
| 59 |
% left points are odd numbered from 1 to 11 from lower to upper |
| 60 |
% right points are even numbered from 2 to 12 lower tot upper |
| 61 |
numeric x[], y[]; |
| 62 |
|
| 63 |
SetParam; |
| 64 |
|
| 65 |
% At first the diag's |
| 66 |
rt x1 = rt x11 = .5(qs-wdbott); |
| 67 |
lft x2 = lft x12 = .5(qs+wdbott); |
| 68 |
bot y1 = bot y2 = BottomSpace; |
| 69 |
top y11 = top y12 = qs-TopSpace; |
| 70 |
z0 = (.5qs, .5qs); |
| 71 |
path shape; shape:= z1--z0--z11--z12--z0--z2--z1--cycle; |
| 72 |
|
| 73 |
% now the top and bottom inner rule |
| 74 |
path Ndiag; Ndiag= z2--z11; |
| 75 |
path Zdiag; Zdiag= z12--z1; |
| 76 |
z4 = point diagpos of Ndiag; |
| 77 |
z3 = point rdiagpos of Zdiag; |
| 78 |
z9 = point rdiagpos of Ndiag; |
| 79 |
z10 = point diagpos of Zdiag; |
| 80 |
path botin; botin= z3--z4; |
| 81 |
path topin; topin= z9--z10; |
| 82 |
|
| 83 |
% the bar in the middle |
| 84 |
y7 - y5 = y8 - y6 = htbar; |
| 85 |
x6 - x5 = x8 - x7 = wdbar; |
| 86 |
x7 + x8 = x5 + x6 = qs; |
| 87 |
y5 + y7 = y8 + y6 = qs; |
| 88 |
path bar; bar=z5--z6--z8--z7--z5--cycle; |
| 89 |
enddef; |
| 90 |
|
| 91 |
|
| 92 |
def MakeWhiteEquihopper = |
| 93 |
clearit; |
| 94 |
pickup chess_pen; |
| 95 |
draw shape; |
| 96 |
pickup inner_pen; |
| 97 |
draw topin; |
| 98 |
draw botin; |
| 99 |
erase fill bar; |
| 100 |
draw bar; |
| 101 |
WhiteMan:= currentpicture; |
| 102 |
enddef; |
| 103 |
|
| 104 |
def MakeBlackEquihopper = |
| 105 |
clearit; |
| 106 |
pickup chess_pen; |
| 107 |
filldraw shape; |
| 108 |
pickup chess_pen scaled 1.1; |
| 109 |
undraw ShortenPath(topin, 2.5thin); |
| 110 |
undraw ShortenPath(botin, 2.5thin); |
| 111 |
filldraw bar; |
| 112 |
BlackMan:= currentpicture; |
| 113 |
enddef; |
| 114 |
|
| 115 |
def MakeOuterShape = |
| 116 |
clearit; |
| 117 |
pickup frame_pen; |
| 118 |
filldraw shape; |
| 119 |
filldraw bar; |
| 120 |
cullit; |
| 121 |
OuterShape:= currentpicture; |
| 122 |
enddef; |
| 123 |
|
| 124 |
DefinePointsAndPaths; |
| 125 |
MakeWhiteEquihopper; |
| 126 |
MakeBlackEquihopper; |
| 127 |
MakeNeutral(WhiteMan, BlackMan); |
| 128 |
MakeOuterShape; |
| 129 |
|
| 130 |
if proofing > 0: |
| 131 |
ScreenGrid(0,qs)(0,qs); |
| 132 |
% If you want a stop after each generated char: |
| 133 |
%let _endchar= endchar; |
| 134 |
%def endchar = |
| 135 |
% string ans; |
| 136 |
% ans= readstring; |
| 137 |
% _endchar; |
| 138 |
%enddef; |
| 139 |
fi; |
| 140 |
|
| 141 |
%%=========================================================== |
| 142 |
%% this one for testing |
| 143 |
%beginchar(Equihopper+White+OnWhite, qs#, qs#, 0); |
| 144 |
% "White Equihopper on white field"; |
| 145 |
% currentpicture:= WhiteMan; |
| 146 |
% %currentpicture:= BlackMan; |
| 147 |
%endchar; |
| 148 |
%endinput |
| 149 |
%%=========================================================== |
| 150 |
|
| 151 |
beginchar(Equihopper+White+OnWhite, qs#, qs#, 0); |
| 152 |
"White equihopper on white field"; |
| 153 |
currentpicture:= WhiteMan; |
| 154 |
endchar; |
| 155 |
|
| 156 |
beginchar(Equihopper+White+OnWhite+LeftTurned, qs#, qs#, 0); |
| 157 |
"White equihopper turned to the left on white field"; |
| 158 |
currentpicture:= TurnLeft(WhiteMan); |
| 159 |
endchar; |
| 160 |
|
| 161 |
%=========================================================== |
| 162 |
|
| 163 |
beginchar(Equihopper+White+OnBlack, qs#, qs#, 0); |
| 164 |
"White equihopper on black field"; |
| 165 |
MakeBlackField; |
| 166 |
cullit; |
| 167 |
currentpicture:= currentpicture - OuterShape; |
| 168 |
cullit; |
| 169 |
currentpicture:= currentpicture + WhiteMan; |
| 170 |
endchar; |
| 171 |
|
| 172 |
beginchar(Equihopper+White+OnBlack+LeftTurned, qs#, qs#, 0); |
| 173 |
"White equihopper turned to the left on black field"; |
| 174 |
MakeBlackField; |
| 175 |
cullit; |
| 176 |
currentpicture:= currentpicture - TurnLeft(OuterShape); |
| 177 |
cullit; |
| 178 |
currentpicture:= currentpicture + TurnLeft(WhiteMan); |
| 179 |
endchar; |
| 180 |
|
| 181 |
%=========================================================== |
| 182 |
|
| 183 |
beginchar(Equihopper+Neutral+OnWhite, qs#, qs#, 0); |
| 184 |
"Neutral equihopper on white field"; |
| 185 |
currentpicture:= NeutralMan; |
| 186 |
endchar; |
| 187 |
|
| 188 |
beginchar(Equihopper+Neutral+OnWhite+LeftTurned, qs#, qs#, 0); |
| 189 |
"Neutral equihopper turned to the left on white field"; |
| 190 |
currentpicture:= TurnLeft(NeutralMan); |
| 191 |
endchar; |
| 192 |
|
| 193 |
%=========================================================== |
| 194 |
|
| 195 |
beginchar(Equihopper+Neutral+OnBlack, qs#, qs#, 0); |
| 196 |
"Neutral equihopper on black field"; |
| 197 |
MakeBlackField; |
| 198 |
cullit; |
| 199 |
currentpicture:= currentpicture - OuterShape; |
| 200 |
cullit; |
| 201 |
currentpicture:= currentpicture + NeutralMan; |
| 202 |
endchar; |
| 203 |
|
| 204 |
beginchar(Equihopper+Neutral+OnBlack+LeftTurned, qs#, qs#, 0); |
| 205 |
"Neutral equihopper turned to the left on black field"; |
| 206 |
MakeBlackField; |
| 207 |
cullit; |
| 208 |
currentpicture:= currentpicture - TurnLeft(OuterShape); |
| 209 |
cullit; |
| 210 |
currentpicture:= currentpicture + TurnLeft(NeutralMan); |
| 211 |
endchar; |
| 212 |
|
| 213 |
%=========================================================== |
| 214 |
|
| 215 |
beginchar(Equihopper+Black+OnWhite, qs#, qs#, 0); |
| 216 |
"Black equihopper on white field"; |
| 217 |
currentpicture:= BlackMan; |
| 218 |
endchar; |
| 219 |
|
| 220 |
beginchar(Equihopper+Black+OnWhite+LeftTurned, qs#, qs#, 0); |
| 221 |
"Black equihopper turned to the left on white field"; |
| 222 |
currentpicture:= TurnLeft(BlackMan); |
| 223 |
endchar; |
| 224 |
|
| 225 |
%=========================================================== |
| 226 |
|
| 227 |
beginchar(Equihopper+Black+OnBlack, qs#, qs#, 0); |
| 228 |
"Black equihopper on black field"; |
| 229 |
MakeBlackField; |
| 230 |
cullit; |
| 231 |
currentpicture:= currentpicture - OuterShape; |
| 232 |
cullit; |
| 233 |
currentpicture:= currentpicture + BlackMan; |
| 234 |
endchar; |
| 235 |
|
| 236 |
beginchar(Equihopper+Black+OnBlack+LeftTurned, qs#, qs#, 0); |
| 237 |
"Black equihopper turned to the left on black field"; |
| 238 |
MakeBlackField; |
| 239 |
cullit; |
| 240 |
currentpicture:= currentpicture - TurnLeft(OuterShape); |
| 241 |
cullit; |
| 242 |
currentpicture:= currentpicture + TurnLeft(BlackMan); |
| 243 |
endchar; |
| 244 |
|
| 245 |
endinput |