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