OSDN Git Service

First commit
[dicend/dicend.git] / sourcwin.bas
1 '$Lang: "FBLite"
2
3 #INCLUDE "Windows.bi"
4 Screen 12
5 DefInt A-Z
6 Randomize Timer
7
8 declare sub dice1 ()
9 declare sub dice2 ()
10 declare sub dice3 ()
11 declare sub dice4 ()
12 declare sub dice5 ()
13 declare sub dice6 ()
14 declare sub dice7 ()
15 declare sub dice8 ()
16 declare sub dice9 ()
17 declare sub dice0 ()
18 declare sub number1 ()
19 declare sub number2 ()
20 declare sub number3 ()
21 declare sub number4 ()
22 declare sub number5 ()
23 declare sub number6 ()
24 declare sub number7 ()
25 declare sub number8 ()
26 declare sub number9 ()
27 declare sub number0 ()
28 declare sub numberA ()
29 declare sub numberB ()
30 declare sub numberC ()
31 declare sub numberD ()
32 declare sub numberE ()
33 declare sub numberF ()
34 declare sub numberG ()
35 declare sub numberH ()
36 declare sub numberI ()
37 declare sub numberJ ()
38 declare sub letter1 ()
39 declare sub letter2 ()
40 declare sub letter3 ()
41 declare sub letter4 ()
42 declare sub letter5 ()
43 declare sub letter6 ()
44 declare sub letter7 ()
45 declare sub letter8 ()
46 declare sub letter9 ()
47 declare sub letter0 ()
48 declare sub letterA ()
49 declare sub letterB ()
50 declare sub letterC ()
51 declare sub letterD ()
52 declare sub letterE ()
53 declare sub letterF ()
54 declare sub letterG ()
55 declare sub letterH ()
56 declare sub letterI ()
57 declare sub letterJ ()
58 declare sub king ()
59 declare sub queen ()
60 declare sub bishop ()
61 declare sub knight ()
62 declare sub rook ()
63 declare sub pawn ()
64 declare sub cannon ()
65 declare sub lance ()
66 declare sub general ()
67 declare sub tokin ()
68 declare sub dragon ()
69 declare sub horse ()
70 declare sub dame ()
71 declare sub checker ()
72 declare sub cells ()
73 declare sub dices ()
74 declare sub chessboard ()
75 declare sub makrukboard ()
76 declare sub xiangqiboard ()
77 declare sub shogiboard ()
78 declare sub draughtsboard ()
79 declare sub chess ()
80 declare sub makruk ()
81 declare sub xiangqi ()
82 declare sub shogi ()
83 declare sub draughts ()
84 declare sub chessfen ()
85 declare sub makrukfen ()
86 declare sub xiangqifen ()
87 declare sub shogifen ()
88 declare sub draughtsfen ()
89 declare sub message ()
90 DECLARE SUB SetTextClpbrd (Text AS STRING)
91
92 DIM Shared AS Integer x, y, cd1, cd2, cn, cll, cf, cb1, cb2, cb3, cb4, cb5
93 DIM Shared AS Integer dc1, dc2, dc3, dc4, dc5, dc6, w1, b1, w2, b2, w3, b3, w4, b4, fw1, fb1, fw2, fb2, fw3, fb3, fw4, fb4, row, col, index, count
94 DIM Shared AS Integer fw1x, fw1y, fb1x, fb1y, fw2x, fw2y, fb2x, fb2y, fw3x, fw3y, fb3x, fb3y, fw4x, fw4y, fb4x, fb4y
95 DIM Shared AS Integer fig1w, fig1b, fig2w, fig2b, fig3w, fig3b, fig4w, fig4b, mas1, mas2, mas3, mas4, mas5, mas6, mas7, mas8, mas9, mas0, lin1, lin2, lin3, lin4, lin5, lin6, lin7, lin8, lin9, lin0', fen
96 cd1 = 2:cd2 = 15:cn = 7:cll = 14:cf = 1:cb1 = 7:cb2 = 6:cb3 = 3:cb4 = 13:cb5 = 9
97
98 Dim Shared board(8, 8) As Integer
99 index = 100
100 For row = 1 To 8: For col = 1 To 8
101    board(row, col) = index + 1
102    index = index + 1
103 Next col: Next row
104
105 Dim Shared xiabo(10, 9) As Integer
106 index = 100
107 For row = 1 To 10: For col = 1 To 9
108    xiabo(row, col) = index + 1
109    index = index + 1
110 Next col: Next row
111
112 Dim Shared shobo(9, 9) As Integer
113 index = 100
114 For row = 1 To 9: For col = 1 To 9
115    shobo(row, col) = index + 1
116    index = index + 1
117 Next col: Next row
118
119 Dim Shared drabo(10, 10) As Integer
120 index = 100
121 For row = 1 To 10: For col = 1 To 10
122    drabo(row, col) = index + 1
123    index = index + 1
124 Next col:index = index + 1: Next row
125
126 Line (2, 2)-(122, 4), 14, BF: Line -(120, 338), 14, BF: Line -(2, 336), 14, BF: Line -(4, 2), 14, BF
127 Line (4, 42)-(120, 44), 14, BF: Paint (20, 20), 8, 14
128 Line (128, 2)-(248, 4), 14, BF: Line -(246, 338), 14, BF: Line -(128, 336), 14, BF: Line -(130, 2), 14, BF
129 Line (130, 42)-(246, 44), 14, BF: Paint (160, 20), 8, 14
130 Line (254, 2)-(394, 4), 14, BF: Line -(392, 386), 14, BF: Line -(254, 384), 14, BF: Line -(256, 2), 14, BF
131 Line (256, 42)-(392, 44), 14, BF: Paint (300, 20), 8, 14
132 Line (400, 2)-(637, 4), 14, BF: Line -(635, 338), 14, BF: Line -(400, 336), 14, BF: Line -(402, 2), 14, BF
133 Line (402, 42)-(635, 44), 14, BF: Paint (440, 20), 8, 14
134 Line (2, 344)-(248, 346), 14, BF: Line -(246, 432), 14, BF: Line -(2, 430), 14, BF: Line -(4, 344), 14, BF
135 Line (4, 378)-(246, 376), 14, BF: Paint (20, 360), 8, 14
136 Color 14, 8: Locate 2, 4: Print "1 - Chess": Locate 2, 19: Print "2 - Makruk": Locate 2, 36: Print "3 - Xiangqi": Locate 2, 61: Print "4 - Shogi": Locate 23, 10: Print "5 - Draughts"
137 Color 12, 0: Locate 23, 52: Print "Press number to select game": Locate 24, 59: Print "or Esc to exit"
138
139 Color 11, 0
140 x = 10: For y = 50 To 300 Step 48
141      cells
142 Next y
143 x = 10:y = 50:  king
144 x = 10:y = y + 48:  queen
145 x = 10:y = y + 48:  bishop
146 x = 10:y = y + 48:  knight
147 x = 10:y = y + 48:  rook
148 x = 10:y = y + 48:  pawn
149 Locate 5, 9: Print "King": Locate 8, 9: Print "Queen"
150 Locate 11, 9: Print "Bishop": Locate 14, 9: Print "Knight"
151 Locate 17, 9: Print "Rook": Locate 20, 9: Print "Pawn"
152 x = 136: For y = 50 To 300 Step 48
153      cells
154 Next y
155 x = 136:y = 50:  king
156 x = 136:y = y + 48:  queen
157 x = 136:y = y + 48:  bishop
158 x = 136:y = y + 48:  knight
159 x = 136:y = y + 48:  rook
160 x = 136:y = y + 48:  checker
161 Locate 5, 25: Print "Lord": Locate 8, 25: Print "Seed"
162 Locate 11, 25: Print "Noble": Locate 14, 25: Print "Horse"
163 Locate 17, 25: Print "Boat": Locate 20, 25: Print "Shell"
164 x = 262: For y = 50 To 350 Step 48
165      cells
166 Next y
167 x = 262:y = 50:  king
168 x = 262:y = y + 48:  queen
169 x = 262:y = y + 48:  bishop
170 x = 262:y = y + 48:  knight
171 x = 262:y = y + 48:  rook
172 x = 262:y = y + 48:  cannon
173 x = 262:y = y + 48:  pawn
174 Locate 5, 41: Print "General": Locate 8, 41: Print "Advisor"
175 Locate 11, 41: Print "Elephant": Locate 14, 41: Print "Horse"
176 Locate 17, 41: Print "Chariot": Locate 20, 41: Print "Cannon"
177 Locate 23, 41: Print "Soldier"
178 x = 408: For y = 50 To 300 Step 48
179      cells
180 Next y
181 x = 528: For y = 50 To 250 Step 48
182      cells
183 Next y
184 x = 408:y = 50:  king
185 x = 408:y = y + 48:  queen
186 x = 408:y = y + 48:  general
187 x = 408:y = y + 48:  bishop
188 x = 408:y = y + 48:  knight
189 x = 408:y = y + 48:  rook
190 x = 528:y = 50:  lance
191 x = 528:y = y + 48:  pawn
192 x = 528:y = y + 48:  horse
193 x = 528:y = y + 48:  dragon
194 x = 528:y = y + 48:  tokin
195 Locate 5, 59: Print "King": Locate 8, 59: Print "Gold"
196 Locate 11, 59: Print "Silver": Locate 14, 59: Print "Bishop"
197 Locate 17, 59: Print "Knight": Locate 20, 59: Print "Rook"
198 Locate 5, 74: Print "Lance": Locate 8, 74: Print "Pawn"
199 Locate 11, 74: Print "Horse": Locate 14, 74: Print "Dragon"
200 Locate 17, 74: Print "Tokin"
201 x = 10:y = 384
202  cells ()
203  checker ()
204 x = 136:y = 384
205  cells ()
206  dame ()
207 Locate 26, 9: Print "Checker": Locate 26, 25: Print "Dame"
208
209 Do
210     Select Case InKey$
211         Case Is = Chr$(49)
212             CLS
213              message ()
214              chessboard ()
215              dices ()
216              chess ()
217         Case Is = Chr$(50)
218             CLS
219              message ()
220              makrukboard ()
221              dices ()
222              makruk ()
223         Case Is = Chr$(51)
224             CLS
225              message ()
226              xiangqiboard ()
227              dices ()
228              xiangqi ()
229         Case Is = Chr$(52)
230             CLS
231              message ()
232              shogiboard ()
233              dices ()
234              shogi ()
235         Case Is = Chr$(53)
236             CLS
237              message ()
238              draughtsboard ()
239              dices ()
240              draughts ()
241         Case Is = Chr$(27)
242             Exit Do
243     End Select
244 Loop
245 End
246
247 Sub dice1 ()
248     Line (x, y)-(40 + x, 40 + y), cd1, BF
249     Line (16 + x, 16 + y)-(24 + x, 24 + y), cd2, BF
250 End Sub
251
252 Sub dice2 ()
253     Line (x, y)-(40 + x, 40 + y), cd1, BF
254     Line (28 + x, 4 + y)-(36 + x, 12 + y), cd2, BF
255     Line (4 + x, 28 + y)-(12 + x, 36 + y), cd2, BF
256 End Sub
257
258 Sub dice3 ()
259     Line (x, y)-(40 + x, 40 + y), cd1, BF
260     Line (28 + x, 4 + y)-(36 + x, 12 + y), cd2, BF
261     Line (16 + x, 16 + y)-(24 + x, 24 + y), cd2, BF
262     Line (4 + x, 28 + y)-(12 + x, 36 + y), cd2, BF
263 End Sub
264
265 Sub dice4 ()
266     Line (x, y)-(40 + x, 40 + y), cd1, BF
267     Line (4 + x, 4 + y)-(12 + x, 12 + y), cd2, BF
268     Line (28 + x, 4 + y)-(36 + x, 12 + y), cd2, BF
269     Line (4 + x, 28 + y)-(12 + x, 36 + y), cd2, BF
270     Line (28 + x, 28 + y)-(36 + x, 36 + y), cd2, BF
271 End Sub
272
273 Sub dice5 ()
274     Line (x, y)-(40 + x, 40 + y), cd1, BF
275     Line (4 + x, 4 + y)-(12 + x, 12 + y), cd2, BF
276     Line (28 + x, 4 + y)-(36 + x, 12 + y), cd2, BF
277     Line (16 + x, 16 + y)-(24 + x, 24 + y), cd2, BF
278     Line (4 + x, 28 + y)-(12 + x, 36 + y), cd2, BF
279     Line (28 + x, 28 + y)-(36 + x, 36 + y), cd2, BF
280 End Sub
281
282 Sub dice6 ()
283     Line (x, y)-(40 + x, 40 + y), cd1, BF
284     Line (4 + x, 4 + y)-(12 + x, 12 + y), cd2, BF
285     Line (28 + x, 4 + y)-(36 + x, 12 + y), cd2, BF
286     Line (4 + x, 16 + y)-(12 + x, 24 + y), cd2, BF
287     Line (28 + x, 16 + y)-(36 + x, 24 + y), cd2, BF
288     Line (4 + x, 28 + y)-(12 + x, 36 + y), cd2, BF
289     Line (28 + x, 28 + y)-(36 + x, 36 + y), cd2, BF
290 End Sub
291
292 Sub dice7 ()
293     Line (x, y)-(40 + x, 40 + y), cd1, BF
294     Line (4 + x, 4 + y)-(12 + x, 12 + y), cd2, BF
295     Line (28 + x, 4 + y)-(36 + x, 12 + y), cd2, BF
296     Line (4 + x, 16 + y)-(12 + x, 24 + y), cd2, BF
297     Line (16 + x, 16 + y)-(24 + x, 24 + y), cd2, BF
298     Line (28 + x, 16 + y)-(36 + x, 24 + y), cd2, BF
299     Line (4 + x, 28 + y)-(12 + x, 36 + y), cd2, BF
300     Line (28 + x, 28 + y)-(36 + x, 36 + y), cd2, BF
301 End Sub
302
303 Sub dice8 ()
304     Line (x, y)-(40 + x, 40 + y), cd1, BF
305     Line (4 + x, 4 + y)-(12 + x, 12 + y), cd2, BF
306     Line (16 + x, 4 + y)-(24 + x, 12 + y), cd2, BF
307     Line (28 + x, 4 + y)-(36 + x, 12 + y), cd2, BF
308     Line (4 + x, 16 + y)-(12 + x, 24 + y), cd2, BF
309     Line (28 + x, 16 + y)-(36 + x, 24 + y), cd2, BF
310     Line (4 + x, 28 + y)-(12 + x, 36 + y), cd2, BF
311     Line (16 + x, 28 + y)-(24 + x, 36 + y), cd2, BF
312     Line (28 + x, 28 + y)-(36 + x, 36 + y), cd2, BF
313 End Sub
314
315 Sub dice9 ()
316     Line (x, y)-(40 + x, 40 + y), cd1, BF
317     Line (4 + x, 4 + y)-(12 + x, 12 + y), cd2, BF
318     Line (16 + x, 4 + y)-(24 + x, 12 + y), cd2, BF
319     Line (28 + x, 4 + y)-(36 + x, 12 + y), cd2, BF
320     Line (4 + x, 16 + y)-(12 + x, 24 + y), cd2, BF
321     Line (16 + x, 16 + y)-(24 + x, 24 + y), cd2, BF
322     Line (28 + x, 16 + y)-(36 + x, 24 + y), cd2, BF
323     Line (4 + x, 28 + y)-(12 + x, 36 + y), cd2, BF
324     Line (16 + x, 28 + y)-(24 + x, 36 + y), cd2, BF
325     Line (28 + x, 28 + y)-(36 + x, 36 + y), cd2, BF
326 End Sub
327
328 Sub dice0 ()
329     Line (x, y)-(40 + x, 40 + y), cd1, BF
330     Line (4 + x, 4 + y)-(12 + x, 12 + y), cd2, BF
331     Line (28 + x, 4 + y)-(36 + x, 12 + y), cd2, BF
332     Line (4 + x, 16 + y)-(12 + x, 24 + y), cd2, BF
333     Line (28 + x, 16 + y)-(36 + x, 24 + y), cd2, BF
334     Line (4 + x, 28 + y)-(12 + x, 36 + y), cd2, BF
335     Line (28 + x, 28 + y)-(36 + x, 36 + y), cd2, BF
336     Line (16 + x, 1 + y)-(24 + x, 9 + y), cd2, BF
337     Line (16 + x, 11 + y)-(24 + x, 19 + y), cd2, BF
338     Line (16 + x, 21 + y)-(24 + x, 29 + y), cd2, BF
339     Line (16 + x, 31 + y)-(24 + x, 39 + y), cd2, BF
340 End Sub
341
342 Sub number1 ()
343     Line (1 + x, 10 + y)-(10 + x, 9 + y), cn, BF
344     Line (5 + x, 8 + y)-(6 + x, 1 + y), cn, BF
345     Line (4 + x, 2 + y)-(1 + x, 5 + y), cn
346     Line (4 + x, 3 + y)-(1 + x, 6 + y), cn
347 End Sub
348
349 Sub number2 ()
350     Line (1 + x, 10 + y)-(10 + x, 9 + y), cn, BF
351     Line (1 + x, 6 + y)-(10 + x, 5 + y), cn, BF
352     Line (1 + x, 2 + y)-(10 + x, 1 + y), cn, BF
353     Line (1 + x, 8 + y)-(2 + x, 7 + y), cn, BF
354     Line (10 + x, 4 + y)-(9 + x, 3 + y), cn, BF
355 End Sub
356
357 Sub number3 ()
358     Line (2 + x, 2 + y)-(9 + x, 1 + y), cn, BF
359     Line (2 + x, 10 + y)-(9 + x, 9 + y), cn, BF
360     Line (5 + x, 5 + y)-(9 + x, 6 + y), cn, BF
361     Line (9 + x, 2 + y)-(10 + x, 4 + y), cn, BF
362     Line (9 + x, 7 + y)-(10 + x, 9 + y), cn, BF
363 End Sub
364
365 Sub number4 ()
366     Line (1 + x, 6 + y)-(10 + x, 5 + y), cn, BF
367     Line (1 + x, 1 + y)-(2 + x, 4 + y), cn, BF
368     Line (9 + x, 1 + y)-(10 + x, 10 + y), cn, BF
369 End Sub
370
371 Sub number5 ()
372     Line (1 + x, 10 + y)-(10 + x, 9 + y), cn, BF
373     Line (1 + x, 6 + y)-(10 + x, 5 + y), cn, BF
374     Line (1 + x, 2 + y)-(10 + x, 1 + y), cn, BF
375     Line (10 + x, 8 + y)-(9 + x, 7 + y), cn, BF
376     Line (2 + x, 4 + y)-(1 + x, 3 + y), cn, BF
377 End Sub
378
379 Sub number6 ()
380     Line (1 + x, 10 + y)-(10 + x, 9 + y), cn, BF
381     Line (1 + x, 6 + y)-(10 + x, 5 + y), cn, BF
382     Line (1 + x, 2 + y)-(10 + x, 1 + y), cn, BF
383     Line (10 + x, 8 + y)-(9 + x, 7 + y), cn, BF
384     Line (1 + x, 8 + y)-(2 + x, 3 + y), cn, BF
385 End Sub
386
387 Sub number7 ()
388     Line (1 + x, 2 + y)-(10 + x, 1 + y), cn, BF
389     Line (10 + x, 3 + y)-(3 + x, 10 + y), cn
390     Line (9 + x, 3 + y)-(2 + x, 10 + y), cn
391     Line (8 + x, 3 + y)-(1 + x, 10 + y), cn
392 End Sub
393
394 Sub number8 ()
395     Line (2 + x, 2 + y)-(9 + x, 1 + y), cn, BF
396     Line (2 + x, 10 + y)-(9 + x, 9 + y), cn, BF
397     Line (2 + x, 6 + y)-(9 + x, 5 + y), cn, BF
398     Line (1 + x, 2 + y)-(2 + x, 4 + y), cn, BF
399     Line (1 + x, 7 + y)-(2 + x, 9 + y), cn, BF
400     Line (9 + x, 2 + y)-(10 + x, 4 + y), cn, BF
401     Line (9 + x, 7 + y)-(10 + x, 9 + y), cn, BF
402 End Sub
403
404 Sub number9 ()
405     Line (1 + x, 10 + y)-(10 + x, 9 + y), cn, BF
406     Line (1 + x, 6 + y)-(10 + x, 5 + y), cn, BF
407     Line (1 + x, 2 + y)-(10 + x, 1 + y), cn, BF
408     Line (10 + x, 8 + y)-(9 + x, 3 + y), cn, BF
409     Line (2 + x, 4 + y)-(1 + x, 3 + y), cn, BF
410 End Sub
411
412 Sub number0 ()
413     Line (2 + x, 2 + y)-(9 + x, 1 + y), cn, BF
414     Line (2 + x, 10 + y)-(9 + x, 9 + y), cn, BF
415     Line (1 + x, 2 + y)-(2 + x, 9 + y), cn, BF
416     Line (9 + x, 2 + y)-(10 + x, 9 + y), cn, BF
417 End Sub
418
419 Sub numberA ()
420     Line (1 + x, 6 + y)-(10 + x, 5 + y), cn, BF
421     Line (1 + x, 2 + y)-(2 + x, 10 + y), cn, BF
422     Line (9 + x, 2 + y)-(10 + x, 10 + y), cn, BF
423     Line (2 + x, 2 + y)-(9 + x, 1 + y), cn, BF
424 End Sub
425
426 Sub numberB ()
427     Line (1 + x, 1 + y)-(2 + x, 10 + y), cn, BF
428     Line (1 + x, 10 + y)-(9 + x, 9 + y), cn, BF
429     Line (1 + x, 6 + y)-(9 + x, 5 + y), cn, BF
430     Line (1 + x, 2 + y)-(9 + x, 1 + y), cn, BF
431     Line (9 + x, 2 + y)-(10 + x, 4 + y), cn, BF
432     Line (9 + x, 7 + y)-(10 + x, 9 + y), cn, BF
433 End Sub
434
435 Sub numberC ()
436     Line (1 + x, 1 + y)-(2 + x, 10 + y), cn, BF
437     Line (1 + x, 1 + y)-(10 + x, 2 + y), cn, BF
438     Line (1 + x, 10 + y)-(10 + x, 9 + y), cn, BF
439 End Sub
440
441 Sub numberD ()
442     Line (2 + x, 2 + y)-(9 + x, 1 + y), cn, BF
443     Line (2 + x, 10 + y)-(9 + x, 9 + y), cn, BF
444     Line (1 + x, 1 + y)-(2 + x, 10 + y), cn, BF
445     Line (9 + x, 2 + y)-(10 + x, 9 + y), cn, BF
446 End Sub
447
448 Sub numberE ()
449     Line (1 + x, 1 + y)-(2 + x, 10 + y), cn, BF
450     Line (1 + x, 10 + y)-(10 + x, 9 + y), cn, BF
451     Line (1 + x, 6 + y)-(10 + x, 5 + y), cn, BF
452     Line (1 + x, 2 + y)-(10 + x, 1 + y), cn, BF
453 End Sub
454
455 Sub numberF ()
456     Line (1 + x, 1 + y)-(2 + x, 10 + y), cn, BF
457     Line (1 + x, 6 + y)-(10 + x, 5 + y), cn, BF
458     Line (1 + x, 2 + y)-(10 + x, 1 + y), cn, BF
459 End Sub
460
461 Sub numberG ()
462     Line (1 + x, 10 + y)-(10 + x, 9 + y), cn, BF
463     Line (8 + x, 6 + y)-(6 + x, 5 + y), cn, BF
464     Line (1 + x, 2 + y)-(10 + x, 1 + y), cn, BF
465     Line (10 + x, 8 + y)-(9 + x, 5 + y), cn, BF
466     Line (1 + x, 8 + y)-(2 + x, 3 + y), cn, BF
467 End Sub
468
469 Sub numberH ()
470     Line (1 + x, 6 + y)-(10 + x, 5 + y), cn, BF
471     Line (1 + x, 1 + y)-(2 + x, 10 + y), cn, BF
472     Line (9 + x, 1 + y)-(10 + x, 10 + y), cn, BF
473 End Sub
474
475 Sub numberI ()
476     Line (3 + x, 2 + y)-(8 + x, 1 + y), cn, BF
477     Line (3 + x, 10 + y)-(8 + x, 9 + y), cn, BF
478     Line (5 + x, 3 + y)-(6 + x, 8 + y), cn, BF
479 End Sub
480
481 Sub numberJ ()
482     Line (1 + x, 6 + y)-(2 + x, 9 + y), cn, BF
483     Line (9 + x, 1 + y)-(10 + x, 9 + y), cn, BF
484     Line (2 + x, 9 + y)-(9 + x, 10 + y), cn, BF
485 End Sub
486
487 Sub letter1 ()
488     Line (4 + x, 36 + y)-(36 + x, 32 + y), cll, BF
489     Line (18 + x, 31 + y)-(22 + x, 4 + y), cll, BF
490     Line (17 + x, 4 + y)-(4 + x, 17 + y), cll
491     Line (17 + x, 5 + y)-(5 + x, 17 + y), cll
492     Line (17 + x, 6 + y)-(6 + x, 17 + y), cll
493     Line (17 + x, 7 + y)-(7 + x, 17 + y), cll
494 End Sub
495
496 Sub letter2 ()
497     Line (4 + x, 4 + y)-(36 + x, 8 + y), cll, BF
498     Line (4 + x, 18 + y)-(36 + x, 22 + y), cll, BF
499     Line (4 + x, 36 + y)-(36 + x, 32 + y), cll, BF
500     Line (32 + x, 9 + y)-(36 + x, 17 + y), cll, BF
501     Line (4 + x, 23 + y)-(8 + x, 31 + y), cll, BF
502 End Sub
503
504 Sub letter3 ()
505     Line (4 + x, 4 + y)-(34 + x, 8 + y), cll, BF
506     Line (4 + x, 36 + y)-(34 + x, 32 + y), cll, BF
507     Line (36 + x, 23 + y)-(32 + x, 34 + y), cll, BF
508     Line (32 + x, 6 + y)-(36 + x, 17 + y), cll, BF
509     Line (18 + x, 18 + y)-(34 + x, 22 + y), cll, BF
510     Line (30 + x, 17 + y)-(31 + x, 17 + y), cll
511     Line (30 + x, 23 + y)-(31 + x, 23 + y), cll
512     Line (30 + x, 9 + y)-(31 + x, 9 + y), cll
513     Line (30 + x, 31 + y)-(31 + x, 31 + y), cll
514     PSet (31 + x, 10 + y), cll: PSet (31 + x, 30 + y), cll
515     PSet (31 + x, 16 + y), cll: PSet (31 + x, 24 + y), cll
516     PSet (35 + x, 18 + y), cll: PSet (35 + x, 22 + y), cll
517     PSet (35 + x, 5 + y), cll: PSet (35 + x, 35 + y), cll
518 End Sub
519
520 Sub letter4 ()
521     Line (4 + x, 4 + y)-(8 + x, 17 + y), cll, BF
522     Line (32 + x, 4 + y)-(36 + x, 36 + y), cll, BF
523     Line (4 + x, 18 + y)-(34 + x, 22 + y), cll, BF
524 End Sub
525
526 Sub letter5 ()
527     Line (4 + x, 4 + y)-(36 + x, 8 + y), cll, BF
528     Line (4 + x, 18 + y)-(36 + x, 22 + y), cll, BF
529     Line (4 + x, 36 + y)-(36 + x, 32 + y), cll, BF
530     Line (4 + x, 9 + y)-(8 + x, 17 + y), cll, BF
531     Line (32 + x, 23 + y)-(36 + x, 31 + y), cll, BF
532 End Sub
533
534 Sub letter6 ()
535     Line (4 + x, 4 + y)-(36 + x, 8 + y), cll, BF
536     Line (4 + x, 18 + y)-(36 + x, 22 + y), cll, BF
537     Line (4 + x, 36 + y)-(36 + x, 32 + y), cll, BF
538     Line (4 + x, 9 + y)-(8 + x, 31 + y), cll, BF
539     Line (32 + x, 23 + y)-(36 + x, 31 + y), cll, BF
540 End Sub
541
542 Sub letter7 ()
543     Line (4 + x, 4 + y)-(36 + x, 8 + y), cll, BF
544     Line (8 + x, 36 + y)-(35 + x, 9 + y), cll
545     Line (7 + x, 36 + y)-(34 + x, 9 + y), cll
546     Line (6 + x, 36 + y)-(33 + x, 9 + y), cll
547     Line (5 + x, 36 + y)-(32 + x, 9 + y), cll
548 End Sub
549
550 Sub letter8 ()
551     Line (8 + x, 23 + y)-(4 + x, 34 + y), cll, BF
552     Line (4 + x, 6 + y)-(8 + x, 17 + y), cll, BF
553     Line (6 + x, 4 + y)-(34 + x, 8 + y), cll, BF
554     Line (6 + x, 36 + y)-(34 + x, 32 + y), cll, BF
555     Line (36 + x, 23 + y)-(32 + x, 34 + y), cll, BF
556     Line (32 + x, 6 + y)-(36 + x, 17 + y), cll, BF
557     Line (6 + x, 18 + y)-(34 + x, 22 + y), cll, BF
558     Line (30 + x, 17 + y)-(31 + x, 17 + y), cll
559     Line (30 + x, 23 + y)-(31 + x, 23 + y), cll
560     Line (10 + x, 17 + y)-(9 + x, 17 + y), cll
561     Line (10 + x, 23 + y)-(9 + x, 23 + y), cll
562     Line (9 + x, 31 + y)-(10 + x, 31 + y), cll
563     Line (30 + x, 31 + y)-(31 + x, 31 + y), cll
564     Line (9 + x, 9 + y)-(10 + x, 9 + y), cll
565     Line (30 + x, 9 + y)-(31 + x, 9 + y), cll
566     PSet (35 + x, 5 + y), cll: PSet (35 + x, 35 + y), cll
567     PSet (5 + x, 5 + y), cll: PSet (5 + x, 35 + y), cll
568     PSet (9 + x, 30 + y), cll: PSet (31 + x, 30 + y), cll
569     PSet (9 + x, 10 + y), cll: PSet (31 + x, 10 + y), cll
570     PSet (5 + x, 18 + y), cll: PSet (5 + x, 22 + y), cll
571     PSet (9 + x, 16 + y), cll: PSet (9 + x, 24 + y), cll
572     PSet (31 + x, 16 + y), cll: PSet (31 + x, 24 + y), cll
573     PSet (35 + x, 18 + y), cll: PSet (35 + x, 22 + y), cll
574 End Sub
575
576 Sub letter9 ()
577     Line (4 + x, 4 + y)-(36 + x, 8 + y), cll, BF
578     Line (4 + x, 18 + y)-(36 + x, 22 + y), cll, BF
579     Line (4 + x, 36 + y)-(36 + x, 32 + y), cll, BF
580     Line (32 + x, 9 + y)-(36 + x, 31 + y), cll, BF
581 End Sub
582
583 Sub letter0 ()
584     Line (6 + x, 4 + y)-(34 + x, 8 + y), cll, BF
585     Line (6 + x, 36 + y)-(34 + x, 32 + y), cll, BF
586     Line (4 + x, 6 + y)-(8 + x, 34 + y), cll, BF
587     Line (36 + x, 6 + y)-(32 + x, 34 + y), cll, BF
588     Line (9 + x, 9 + y)-(10 + x, 9 + y), cll
589     Line (30 + x, 9 + y)-(31 + x, 9 + y), cll
590     Line (9 + x, 31 + y)-(10 + x, 31 + y), cll
591     Line (30 + x, 31 + y)-(31 + x, 31 + y), cll
592     Line (9 + x, 9 + y)-(10 + x, 9 + y), cll
593     Line (30 + x, 9 + y)-(31 + x, 9 + y), cll
594     PSet (35 + x, 5 + y), cll: PSet (35 + x, 35 + y), cll
595     PSet (5 + x, 5 + y), cll: PSet (5 + x, 35 + y), cll
596     PSet (9 + x, 30 + y), cll: PSet (31 + x, 30 + y), cll
597     PSet (9 + x, 10 + y), cll: PSet (31 + x, 10 + y), cll
598 End Sub
599
600 Sub letterA ()
601     Line (4 + x, 6 + y)-(8 + x, 36 + y), cll, BF
602     Line (32 + x, 6 + y)-(36 + x, 36 + y), cll, BF
603     Line (4 + x, 18 + y)-(34 + x, 22 + y), cll, BF
604     Line (6 + x, 4 + y)-(34 + x, 8 + y), cll, BF
605     Line (30 + x, 9 + y)-(31 + x, 9 + y), cll
606     Line (9 + x, 9 + y)-(10 + x, 9 + y), cll
607     PSet (9 + x, 10 + y), cll: PSet (31 + x, 10 + y), cll
608     PSet (5 + x, 5 + y), cll: PSet (35 + x, 5 + y), cll
609 End Sub
610
611 Sub letterB ()
612     Line (4 + x, 9 + y)-(8 + x, 31 + y), cll, BF
613     Line (4 + x, 4 + y)-(34 + x, 8 + y), cll, BF
614     Line (4 + x, 36 + y)-(34 + x, 32 + y), cll, BF
615     Line (36 + x, 23 + y)-(32 + x, 34 + y), cll, BF
616     Line (32 + x, 6 + y)-(36 + x, 17 + y), cll, BF
617     Line (9 + x, 18 + y)-(34 + x, 22 + y), cll, BF
618     Line (30 + x, 17 + y)-(31 + x, 17 + y), cll
619     Line (30 + x, 23 + y)-(31 + x, 23 + y), cll
620     Line (30 + x, 9 + y)-(31 + x, 9 + y), cll
621     Line (30 + x, 31 + y)-(31 + x, 31 + y), cll
622     PSet (31 + x, 10 + y), cll: PSet (31 + x, 30 + y), cll
623     PSet (31 + x, 16 + y), cll: PSet (31 + x, 24 + y), cll
624     PSet (35 + x, 18 + y), cll: PSet (35 + x, 22 + y), cll
625     PSet (35 + x, 5 + y), cll: PSet (35 + x, 35 + y), cll
626 End Sub
627
628 Sub letterC ()
629     Line (6 + x, 4 + y)-(36 + x, 8 + y), cll, BF
630     Line (6 + x, 36 + y)-(36 + x, 32 + y), cll, BF
631     Line (4 + x, 6 + y)-(8 + x, 34 + y), cll, BF
632     Line (9 + x, 9 + y)-(10 + x, 9 + y), cll
633     Line (9 + x, 31 + y)-(10 + x, 31 + y), cll
634     PSet (9 + x, 10 + y), cll: PSet (9 + x, 30 + y), cll
635     PSet (5 + x, 5 + y), cll: PSet (5 + x, 35 + y), cll
636 End Sub
637
638 Sub letterD ()
639     Line (4 + x, 4 + y)-(34 + x, 8 + y), cll, BF
640     Line (4 + x, 36 + y)-(34 + x, 32 + y), cll, BF
641     Line (4 + x, 4 + y)-(8 + x, 36 + y), cll, BF
642     Line (32 + x, 6 + y)-(36 + x, 34 + y), cll, BF
643     Line (30 + x, 9 + y)-(31 + x, 9 + y), cll
644     Line (30 + x, 31 + y)-(31 + x, 31 + y), cll
645     PSet (31 + x, 10 + y), cll: PSet (31 + x, 30 + y), cll
646     PSet (35 + x, 5 + y), cll: PSet (35 + x, 35 + y), cll
647 End Sub
648
649 Sub letterE ()
650     Line (4 + x, 4 + y)-(36 + x, 8 + y), cll, BF
651     Line (4 + x, 18 + y)-(36 + x, 22 + y), cll, BF
652     Line (4 + x, 36 + y)-(36 + x, 32 + y), cll, BF
653     Line (4 + x, 4 + y)-(8 + x, 36 + y), cll, BF
654 End Sub
655
656 Sub letterF ()
657     Line (4 + x, 4 + y)-(36 + x, 8 + y), cll, BF
658     Line (4 + x, 18 + y)-(36 + x, 22 + y), cll, BF
659     Line (4 + x, 4 + y)-(8 + x, 36 + y), cll, BF
660 End Sub
661
662 Sub letterG ()
663     Line (4 + x, 4 + y)-(36 + x, 8 + y), cll, BF
664     Line (20 + x, 18 + y)-(36 + x, 22 + y), cll, BF
665     Line (4 + x, 36 + y)-(36 + x, 32 + y), cll, BF
666     Line (4 + x, 9 + y)-(8 + x, 31 + y), cll, BF
667     Line (32 + x, 23 + y)-(36 + x, 31 + y), cll, BF
668 End Sub
669
670 Sub letterH ()
671     Line (4 + x, 4 + y)-(8 + x, 36 + y), cll, BF
672     Line (32 + x, 4 + y)-(36 + x, 36 + y), cll, BF
673     Line (4 + x, 18 + y)-(34 + x, 22 + y), cll, BF
674 End Sub
675
676 Sub letterI ()
677     Line (8 + x, 36 + y)-(32 + x, 32 + y), cll, BF
678     Line (18 + x, 31 + y)-(22 + x, 9 + y), cll, BF
679     Line (8 + x, 8 + y)-(32 + x, 3 + y), cll, BF
680 End Sub
681
682 Sub letterJ ()
683     Line (6 + x, 36 + y)-(34 + x, 32 + y), cll, BF
684     Line (32 + x, 4 + y)-(36 + x, 34 + y), cll, BF
685     Line (4 + x, 18 + y)-(8 + x, 34 + y), cll, BF
686     Line (9 + x, 31 + y)-(10 + x, 31 + y), cll
687     Line (30 + x, 31 + y)-(31 + x, 31 + y), cll
688     PSet (9 + x, 30 + y), cll: PSet (31 + x, 30 + y), cll
689     PSet (5 + x, 35 + y), cll: PSet (35 + x, 35 + y), cll
690 End Sub
691
692 Sub king ()
693     Line (8 + x, 36 + y)-(32 + x, 32 + y), cf, BF
694     Line (12 + x, 31 + y)-(28 + x, 31 + y), cf
695     Line (13 + x, 30 + y)-(27 + x, 30 + y), cf
696     Line (14 + x, 29 + y)-(26 + x, 29 + y), cf
697     Line (15 + x, 28 + y)-(25 + x, 28 + y), cf
698     Line (16 + x, 27 + y)-(24 + x, 10 + y), cf, BF
699     Line (15 + x, 24 + y)-(25 + x, 24 + y), cf
700     Line (14 + x, 23 + y)-(26 + x, 23 + y), cf
701     Line (13 + x, 22 + y)-(27 + x, 22 + y), cf
702     Line (12 + x, 21 + y)-(28 + x, 21 + y), cf
703     Line (11 + x, 20 + y)-(29 + x, 20 + y), cf
704     Line (10 + x, 19 + y)-(30 + x, 19 + y), cf
705     Line (9 + x, 18 + y)-(31 + x, 18 + y), cf
706     Line (8 + x, 17 + y)-(32 + x, 17 + y), cf
707     Line (7 + x, 16 + y)-(33 + x, 16 + y), cf
708     Line (6 + x, 15 + y)-(34 + x, 15 + y), cf
709     Line (5 + x, 14 + y)-(35 + x, 14 + y), cf
710     Line (4 + x, 13 + y)-(36 + x, 12 + y), cf, BF
711     Line (4 + x, 11 + y)-(14 + x, 10 + y), cf, BF
712     Line (5 + x, 9 + y)-(13 + x, 9 + y), cf
713     Line (6 + x, 8 + y)-(12 + x, 8 + y), cf
714     Line (7 + x, 7 + y)-(11 + x, 7 + y), cf
715     Line (26 + x, 11 + y)-(36 + x, 10 + y), cf, BF
716     Line (27 + x, 9 + y)-(35 + x, 9 + y), cf
717     Line (28 + x, 8 + y)-(34 + x, 8 + y), cf
718     Line (29 + x, 7 + y)-(33 + x, 7 + y), cf
719     Line (17 + x, 9 + y)-(23 + x, 8 + y), cf, BF
720     Line (18 + x, 7 + y)-(22 + x, 6 + y), cf, BF
721     Line (19 + x, 5 + y)-(21 + x, 4 + y), cf, BF
722 End Sub
723
724 Sub queen ()
725     Line (8 + x, 36 + y)-(32 + x, 32 + y), cf, BF
726     Line (9 + x, 31 + y)-(31 + x, 31 + y), cf
727     Line (10 + x, 30 + y)-(30 + x, 30 + y), cf
728     Line (11 + x, 29 + y)-(29 + x, 29 + y), cf
729     Line (12 + x, 28 + y)-(28 + x, 14 + y), cf, BF
730     Line (11 + x, 24 + y)-(29 + x, 24 + y), cf
731     Line (10 + x, 23 + y)-(30 + x, 23 + y), cf
732     Line (9 + x, 22 + y)-(31 + x, 22 + y), cf
733     Line (8 + x, 21 + y)-(32 + x, 21 + y), cf
734     Line (7 + x, 20 + y)-(33 + x, 20 + y), cf
735     Line (6 + x, 19 + y)-(34 + x, 18 + y), cf, BF
736     Line (6 + x, 17 + y)-(7 + x, 10 + y), cf, BF
737     Line (5 + x, 11 + y)-(8 + x, 14 + y), cf, BF
738     Line (4 + x, 12 + y)-(9 + x, 13 + y), cf, BF
739     Line (34 + x, 17 + y)-(33 + x, 10 + y), cf, BF
740     Line (35 + x, 11 + y)-(32 + x, 14 + y), cf, BF
741     Line (36 + x, 12 + y)-(31 + x, 13 + y), cf, BF
742     Line (12 + x, 13 + y)-(13 + x, 6 + y), cf, BF
743     Line (11 + x, 7 + y)-(14 + x, 10 + y), cf, BF
744     Line (10 + x, 8 + y)-(15 + x, 9 + y), cf, BF
745     Line (27 + x, 13 + y)-(28 + x, 6 + y), cf, BF
746     Line (26 + x, 7 + y)-(29 + x, 10 + y), cf, BF
747     Line (25 + x, 8 + y)-(30 + x, 9 + y), cf, BF
748     Line (19 + x, 13 + y)-(21 + x, 4 + y), cf, BF
749     Line (18 + x, 5 + y)-(22 + x, 8 + y), cf, BF
750     Line (17 + x, 6 + y)-(23 + x, 7 + y), cf, BF
751 End Sub
752
753 Sub bishop ()
754     Line (8 + x, 36 + y)-(32 + x, 32 + y), cf, BF
755     Line (18 + x, 31 + y)-(22 + x, 6 + y), cf, BF
756     Line (19 + x, 5 + y)-(21 + x, 4 + y), cf, BF
757     Line (12 + x, 31 + y)-(28 + x, 31 + y), cf
758     Line (13 + x, 30 + y)-(27 + x, 30 + y), cf
759     Line (14 + x, 29 + y)-(26 + x, 29 + y), cf
760     Line (15 + x, 28 + y)-(25 + x, 28 + y), cf
761     Line (16 + x, 27 + y)-(24 + x, 27 + y), cf
762     Line (17 + x, 26 + y)-(23 + x, 26 + y), cf
763     Line (17 + x, 21 + y)-(23 + x, 8 + y), cf, BF
764     Line (16 + x, 19 + y)-(24 + x, 10 + y), cf, BF
765     Line (15 + x, 17 + y)-(25 + x, 12 + y), cf, BF
766     Line (14 + x, 15 + y)-(26 + x, 14 + y), cf, BF
767 End Sub
768
769 Sub knight ()
770     Line (8 + x, 36 + y)-(32 + x, 32 + y), cf, BF
771     Line (12 + x, 31 + y)-(28 + x, 31 + y), cf
772     Line (13 + x, 30 + y)-(29 + x, 30 + y), cf
773     Line (14 + x, 29 + y)-(30 + x, 29 + y), cf
774     Line (15 + x, 28 + y)-(31 + x, 28 + y), cf
775     Line (16 + x, 27 + y)-(32 + x, 27 + y), cf
776     Line (17 + x, 26 + y)-(33 + x, 26 + y), cf
777     Line (18 + x, 25 + y)-(34 + x, 25 + y), cf
778     Line (19 + x, 24 + y)-(35 + x, 24 + y), cf
779     Line (20 + x, 23 + y)-(36 + x, 18 + y), cf, BF
780     Line (4 + x, 17 + y)-(35 + x, 17 + y), cf
781     Line (4 + x, 16 + y)-(34 + x, 16 + y), cf
782     Line (5 + x, 15 + y)-(33 + x, 15 + y), cf
783     Line (6 + x, 14 + y)-(32 + x, 14 + y), cf
784     Line (7 + x, 13 + y)-(31 + x, 13 + y), cf
785     Line (8 + x, 12 + y)-(30 + x, 12 + y), cf
786     Line (9 + x, 11 + y)-(29 + x, 11 + y), cf
787     Line (10 + x, 10 + y)-(28 + x, 10 + y), cf
788     Line (11 + x, 9 + y)-(27 + x, 9 + y), cf
789     Line (12 + x, 8 + y)-(26 + x, 8 + y), cf
790     Line (13 + x, 7 + y)-(25 + x, 7 + y), cf
791     Line (14 + x, 6 + y)-(24 + x, 6 + y), cf
792     Line (15 + x, 5 + y)-(23 + x, 5 + y), cf
793     Line (16 + x, 4 + y)-(22 + x, 4 + y), cf
794 End Sub
795
796 Sub rook ()
797     Line (8 + x, 36 + y)-(32 + x, 32 + y), cf, BF
798     Line (4 + x, 4 + y)-(8 + x, 12 + y), cf, BF
799     Line (13 + x, 4 + y)-(17 + x, 12 + y), cf, BF
800     Line (23 + x, 4 + y)-(27 + x, 12 + y), cf, BF
801     Line (32 + x, 4 + y)-(36 + x, 12 + y), cf, BF
802     Line (4 + x, 12 + y)-(36 + x, 16 + y), cf, BF
803     Line (12 + x, 16 + y)-(28 + x, 32 + y), cf, BF
804     Line (9 + x, 16 + y)-(11 + x, 16 + y), cf
805     Line (29 + x, 16 + y)-(31 + x, 16 + y), cf
806     Line (10 + x, 17 + y)-(11 + x, 17 + y), cf
807     Line (29 + x, 17 + y)-(30 + x, 17 + y), cf
808     PSet (11 + x, 18 + y), cf: PSet (29 + x, 18 + y), cf
809     Line (9 + x, 31 + y)-(11 + x, 31 + y), cf
810     Line (29 + x, 31 + y)-(31 + x, 31 + y), cf
811     Line (10 + x, 30 + y)-(11 + x, 30 + y), cf
812     Line (29 + x, 30 + y)-(30 + x, 30 + y), cf
813     PSet (11 + x, 29 + y), cf: PSet (29 + x, 29 + y), cf
814 End Sub
815
816 Sub pawn ()
817     Line (8 + x, 36 + y)-(32 + x, 32 + y), cf, BF
818     Line (18 + x, 32 + y)-(22 + x, 4 + y), cf, BF
819     Line (12 + x, 9 + y)-(28 + x, 14 + y), cf, BF
820     Line (9 + x, 31 + y)-(31 + x, 31 + y), cf
821     Line (10 + x, 30 + y)-(30 + x, 30 + y), cf
822     Line (11 + x, 29 + y)-(29 + x, 29 + y), cf
823     Line (12 + x, 28 + y)-(28 + x, 28 + y), cf
824     Line (13 + x, 27 + y)-(27 + x, 27 + y), cf
825     Line (14 + x, 26 + y)-(26 + x, 26 + y), cf
826     Line (15 + x, 25 + y)-(25 + x, 25 + y), cf
827     Line (16 + x, 24 + y)-(24 + x, 24 + y), cf
828     Line (17 + x, 23 + y)-(23 + x, 23 + y), cf
829     Line (17 + x, 19 + y)-(23 + x, 19 + y), cf
830     Line (16 + x, 18 + y)-(24 + x, 18 + y), cf
831     Line (15 + x, 17 + y)-(25 + x, 17 + y), cf
832     Line (14 + x, 16 + y)-(26 + x, 16 + y), cf
833     Line (13 + x, 15 + y)-(27 + x, 15 + y), cf
834     Line (13 + x, 8 + y)-(27 + x, 8 + y), cf
835     Line (14 + x, 7 + y)-(26 + x, 7 + y), cf
836     Line (15 + x, 6 + y)-(25 + x, 6 + y), cf
837     Line (16 + x, 5 + y)-(24 + x, 5 + y), cf
838     Line (17 + x, 4 + y)-(23 + x, 4 + y), cf
839 End Sub
840
841 Sub cannon ()
842     Line (8 + x, 36 + y)-(32 + x, 32 + y), cf, BF
843     Line (9 + x, 31 + y)-(31 + x, 31 + y), cf
844     Line (10 + x, 30 + y)-(30 + x, 30 + y), cf
845     Line (11 + x, 29 + y)-(29 + x, 29 + y), cf
846     Line (12 + x, 28 + y)-(28 + x, 28 + y), cf
847     Line (13 + x, 27 + y)-(27 + x, 27 + y), cf
848     Line (14 + x, 26 + y)-(26 + x, 26 + y), cf
849     Line (15 + x, 25 + y)-(25 + x, 25 + y), cf
850     Line (16 + x, 24 + y)-(24 + x, 4 + y), cf, BF
851     Line (6 + x, 9 + y)-(36 + x, 12 + y), cf, BF
852     Line (4 + x, 10 + y)-(6 + x, 11 + y), cf, BF
853     Line (14 + x, 16 + y)-(25 + x, 16 + y), cf
854     Line (12 + x, 15 + y)-(26 + x, 15 + y), cf
855     Line (10 + x, 14 + y)-(27 + x, 14 + y), cf
856     Line (8 + x, 13 + y)-(28 + x, 13 + y), cf
857     Line (8 + x, 8 + y)-(28 + x, 8 + y), cf
858     Line (10 + x, 7 + y)-(27 + x, 7 + y), cf
859     Line (12 + x, 6 + y)-(26 + x, 6 + y), cf
860     Line (14 + x, 5 + y)-(25 + x, 5 + y), cf
861     Line (16 + x, 4 + y)-(24 + x, 4 + y), cf
862 End Sub
863
864 Sub general ()
865     Line (8 + x, 36 + y)-(32 + x, 32 + y), cf, BF
866     Line (9 + x, 31 + y)-(31 + x, 31 + y), cf
867     Line (10 + x, 30 + y)-(30 + x, 30 + y), cf
868     Line (11 + x, 29 + y)-(29 + x, 29 + y), cf
869     Line (12 + x, 28 + y)-(28 + x, 28 + y), cf
870     Line (13 + x, 27 + y)-(27 + x, 27 + y), cf
871     Line (14 + x, 26 + y)-(26 + x, 26 + y), cf
872     Line (13 + x, 25 + y)-(27 + x, 22 + y), cf, BF
873     Line (16 + x, 21 + y)-(24 + x, 20 + y), cf, BF
874     Line (18 + x, 19 + y)-(22 + x, 12 + y), cf, BF
875     Line (19 + x, 11 + y)-(21 + x, 4 + y), cf, BF
876     Line (18 + x, 10 + y)-(22 + x, 5 + y), cf, BF
877     Line (17 + x, 9 + y)-(23 + x, 6 + y), cf, BF
878     Line (16 + x, 8 + y)-(24 + x, 7 + y), cf, BF
879     Line (15 + x, 20 + y)-(16 + x, 19 + y), cf, BF
880     Line (14 + x, 19 + y)-(15 + x, 18 + y), cf, BF
881     Line (13 + x, 18 + y)-(14 + x, 17 + y), cf, BF
882     Line (24 + x, 20 + y)-(25 + x, 19 + y), cf, BF
883     Line (25 + x, 19 + y)-(26 + x, 18 + y), cf, BF
884     Line (26 + x, 18 + y)-(27 + x, 17 + y), cf, BF
885     Line (11 + x, 18 + y)-(12 + x, 11 + y), cf, BF
886     Line (10 + x, 17 + y)-(13 + x, 12 + y), cf, BF
887     Line (9 + x, 16 + y)-(14 + x, 13 + y), cf, BF
888     Line (8 + x, 15 + y)-(15 + x, 14 + y), cf, BF
889     Line (28 + x, 18 + y)-(29 + x, 11 + y), cf, BF
890     Line (27 + x, 17 + y)-(30 + x, 12 + y), cf, BF
891     Line (26 + x, 16 + y)-(31 + x, 13 + y), cf, BF
892     Line (25 + x, 15 + y)-(32 + x, 14 + y), cf, BF
893     Line (4 + x, 24 + y)-(36 + x, 23 + y), cf, BF
894     Line (29 + x, 25 + y)-(35 + x, 22 + y), cf, BF
895     Line (30 + x, 26 + y)-(34 + x, 21 + y), cf, BF
896     Line (31 + x, 27 + y)-(33 + x, 20 + y), cf, BF
897     Line (5 + x, 25 + y)-(11 + x, 22 + y), cf, BF
898     Line (6 + x, 26 + y)-(10 + x, 21 + y), cf, BF
899     Line (7 + x, 27 + y)-(9 + x, 20 + y), cf, BF
900 End Sub
901
902 Sub tokin ()
903     Line (10 + x, 10 + y)-(30 + x, 30 + y), cf, BF
904     Line (4 + x, 4 + y)-(5 + x, 5 + y), cf, BF
905     Line (5 + x, 5 + y)-(7 + x, 7 + y), cf, BF
906     Line (6 + x, 6 + y)-(9 + x, 9 + y), cf, BF
907     Line (7 + x, 7 + y)-(11 + x, 11 + y), cf, BF
908     Line (8 + x, 8 + y)-(12 + x, 12 + y), cf, BF
909     Line (36 + x, 4 + y)-(35 + x, 5 + y), cf, BF
910     Line (35 + x, 5 + y)-(33 + x, 7 + y), cf, BF
911     Line (34 + x, 6 + y)-(31 + x, 9 + y), cf, BF
912     Line (33 + x, 7 + y)-(29 + x, 11 + y), cf, BF
913     Line (32 + x, 8 + y)-(28 + x, 12 + y), cf, BF
914     Line (36 + x, 36 + y)-(35 + x, 35 + y), cf, BF
915     Line (35 + x, 35 + y)-(33 + x, 33 + y), cf, BF
916     Line (34 + x, 34 + y)-(31 + x, 31 + y), cf, BF
917     Line (33 + x, 33 + y)-(29 + x, 29 + y), cf, BF
918     Line (32 + x, 32 + y)-(28 + x, 28 + y), cf, BF
919     Line (4 + x, 36 + y)-(5 + x, 35 + y), cf, BF
920     Line (5 + x, 35 + y)-(7 + x, 33 + y), cf, BF
921     Line (6 + x, 34 + y)-(9 + x, 31 + y), cf, BF
922     Line (7 + x, 33 + y)-(11 + x, 29 + y), cf, BF
923     Line (8 + x, 32 + y)-(12 + x, 28 + y), cf, BF
924     Line (17 + x, 9 + y)-(23 + x, 8 + y), cf, BF
925     Line (18 + x, 7 + y)-(22 + x, 6 + y), cf, BF
926     Line (19 + x, 5 + y)-(21 + x, 4 + y), cf, BF
927     Line (17 + x, 31 + y)-(23 + x, 32 + y), cf, BF
928     Line (18 + x, 33 + y)-(22 + x, 34 + y), cf, BF
929     Line (19 + x, 35 + y)-(21 + x, 36 + y), cf, BF
930     Line (8 + x, 17 + y)-(9 + x, 23 + y), cf, BF
931     Line (6 + x, 18 + y)-(7 + x, 22 + y), cf, BF
932     Line (4 + x, 19 + y)-(5 + x, 21 + y), cf, BF
933     Line (32 + x, 17 + y)-(31 + x, 23 + y), cf, BF
934     Line (34 + x, 18 + y)-(33 + x, 22 + y), cf, BF
935     Line (36 + x, 19 + y)-(35 + x, 21 + y), cf, BF
936 End Sub
937
938 Sub lance ()
939     Line (8 + x, 36 + y)-(32 + x, 32 + y), cf, BF
940     Line (9 + x, 31 + y)-(31 + x, 31 + y), cf
941     Line (10 + x, 30 + y)-(30 + x, 30 + y), cf
942     Line (11 + x, 29 + y)-(29 + x, 29 + y), cf
943     Line (12 + x, 28 + y)-(28 + x, 28 + y), cf
944     Line (13 + x, 27 + y)-(27 + x, 27 + y), cf
945     Line (14 + x, 26 + y)-(26 + x, 24 + y), cf, BF
946     Line (15 + x, 23 + y)-(25 + x, 20 + y), cf, BF
947     Line (16 + x, 19 + y)-(24 + x, 16 + y), cf, BF
948     Line (17 + x, 15 + y)-(23 + x, 12 + y), cf, BF
949     Line (18 + x, 11 + y)-(22 + x, 8 + y), cf, BF
950     Line (19 + x, 7 + y)-(21 + x, 4 + y), cf, BF
951 End Sub
952
953 Sub dragon ()
954     Line (8 + x, 36 + y)-(32 + x, 32 + y), cf, BF
955     Line (9 + x, 31 + y)-(31 + x, 31 + y), cf
956     Line (10 + x, 30 + y)-(30 + x, 30 + y), cf
957     Line (11 + x, 29 + y)-(29 + x, 29 + y), cf
958     Line (12 + x, 28 + y)-(28 + x, 28 + y), cf
959     Line (13 + x, 27 + y)-(27 + x, 27 + y), cf
960     Line (14 + x, 26 + y)-(26 + x, 26 + y), cf
961     Line (15 + x, 25 + y)-(25 + x, 25 + y), cf
962     Line (15 + x, 20 + y)-(25 + x, 20 + y), cf
963     Line (14 + x, 19 + y)-(26 + x, 19 + y), cf
964     Line (13 + x, 18 + y)-(27 + x, 18 + y), cf
965     Line (16 + x, 24 + y)-(24 + x, 8 + y), cf, BF
966     Line (17 + x, 7 + y)-(23 + x, 6 + y), cf, BF
967     Line (18 + x, 5 + y)-(22 + x, 5 + y), cf
968     Line (19 + x, 4 + y)-(21 + x, 4 + y), cf
969     Line (9 + x, 12 + y)-(31 + x, 17 + y), cf, BF
970     Line (10 + x, 11 + y)-(13 + x, 11 + y), cf
971     Line (11 + x, 10 + y)-(12 + x, 10 + y), cf
972     Line (27 + x, 11 + y)-(30 + x, 11 + y), cf
973     Line (28 + x, 10 + y)-(29 + x, 10 + y), cf
974     Line (10 + x, 11 + y)-(10 + x, 18 + y), cf
975     Line (9 + x, 12 + y)-(9 + x, 19 + y), cf
976     Line (8 + x, 13 + y)-(8 + x, 20 + y), cf
977     Line (7 + x, 14 + y)-(7 + x, 21 + y), cf
978     Line (6 + x, 15 + y)-(6 + x, 22 + y), cf
979     Line (5 + x, 16 + y)-(5 + x, 23 + y), cf
980     Line (4 + x, 17 + y)-(4 + x, 24 + y), cf
981     Line (30 + x, 11 + y)-(30 + x, 18 + y), cf
982     Line (31 + x, 12 + y)-(31 + x, 19 + y), cf
983     Line (32 + x, 13 + y)-(32 + x, 20 + y), cf
984     Line (33 + x, 14 + y)-(33 + x, 21 + y), cf
985     Line (34 + x, 15 + y)-(34 + x, 22 + y), cf
986     Line (35 + x, 16 + y)-(35 + x, 23 + y), cf
987     Line (36 + x, 17 + y)-(36 + x, 24 + y), cf
988 End Sub
989
990 Sub horse ()
991     Line (8 + x, 36 + y)-(32 + x, 32 + y), cf, BF
992     Line (10 + x, 31 + y)-(11 + x, 26 + y), cf, BF
993     Line (16 + x, 31 + y)-(17 + x, 26 + y), cf, BF
994     Line (23 + x, 31 + y)-(24 + x, 26 + y), cf, BF
995     Line (29 + x, 31 + y)-(30 + x, 26 + y), cf, BF
996     Line (8 + x, 25 + y)-(32 + x, 14 + y), cf, BF
997     Line (7 + x, 24 + y)-(7 + x, 15 + y), cf
998     Line (6 + x, 23 + y)-(6 + x, 16 + y), cf
999     Line (5 + x, 22 + y)-(5 + x, 17 + y), cf
1000     Line (4 + x, 21 + y)-(4 + x, 18 + y), cf
1001     Line (33 + x, 24 + y)-(33 + x, 15 + y), cf
1002     Line (34 + x, 23 + y)-(34 + x, 16 + y), cf
1003     Line (35 + x, 22 + y)-(35 + x, 17 + y), cf
1004     Line (36 + x, 21 + y)-(36 + x, 18 + y), cf
1005     Line (14 + x, 13 + y)-(26 + x, 10 + y), cf, BF
1006     Line (10 + x, 9 + y)-(30 + x, 7 + y), cf, BF
1007     Line (10 + x, 6 + y)-(13 + x, 6 + y), cf
1008     Line (10 + x, 5 + y)-(12 + x, 5 + y), cf
1009     Line (10 + x, 4 + y)-(11 + x, 4 + y), cf
1010     Line (30 + x, 6 + y)-(27 + x, 6 + y), cf
1011     Line (30 + x, 5 + y)-(28 + x, 5 + y), cf
1012     Line (30 + x, 4 + y)-(29 + x, 4 + y), cf
1013     Line (16 + x, 6 + y)-(24 + x, 6 + y), cf
1014     Line (17 + x, 5 + y)-(23 + x, 5 + y), cf
1015     Line (18 + x, 4 + y)-(22 + x, 4 + y), cf
1016 End Sub
1017
1018 Sub dame ()
1019     Line (14 + x, 36 + y)-(26 + x, 28 + y), cf, BF
1020     Line (14 + x, 4 + y)-(26 + x, 12 + y), cf, BF
1021     Line (4 + x, 14 + y)-(12 + x, 26 + y), cf, BF
1022     Line (28 + x, 14 + y)-(36 + x, 26 + y), cf, BF
1023     Line (17 + x, 36 + y)-(17 + x, 27 + y), cf
1024     Line (16 + x, 36 + y)-(16 + x, 26 + y), cf
1025     Line (15 + x, 36 + y)-(15 + x, 25 + y), cf
1026     Line (14 + x, 36 + y)-(14 + x, 24 + y), cf
1027     Line (13 + x, 35 + y)-(13 + x, 23 + y), cf
1028     Line (12 + x, 34 + y)-(12 + x, 22 + y), cf
1029     Line (23 + x, 36 + y)-(23 + x, 27 + y), cf
1030     Line (24 + x, 36 + y)-(24 + x, 26 + y), cf
1031     Line (25 + x, 36 + y)-(25 + x, 25 + y), cf
1032     Line (26 + x, 36 + y)-(26 + x, 24 + y), cf
1033     Line (27 + x, 35 + y)-(27 + x, 23 + y), cf
1034     Line (28 + x, 34 + y)-(28 + x, 22 + y), cf
1035     Line (17 + x, 4 + y)-(17 + x, 13 + y), cf
1036     Line (16 + x, 4 + y)-(16 + x, 14 + y), cf
1037     Line (15 + x, 4 + y)-(15 + x, 15 + y), cf
1038     Line (14 + x, 4 + y)-(14 + x, 16 + y), cf
1039     Line (13 + x, 5 + y)-(13 + x, 17 + y), cf
1040     Line (12 + x, 6 + y)-(12 + x, 18 + y), cf
1041     Line (23 + x, 4 + y)-(23 + x, 13 + y), cf
1042     Line (24 + x, 4 + y)-(24 + x, 14 + y), cf
1043     Line (25 + x, 4 + y)-(25 + x, 15 + y), cf
1044     Line (26 + x, 4 + y)-(26 + x, 16 + y), cf
1045     Line (27 + x, 5 + y)-(27 + x, 17 + y), cf
1046     Line (28 + x, 6 + y)-(28 + x, 18 + y), cf
1047     Line (5 + x, 13 + y)-(5 + x, 27 + y), cf
1048     Line (6 + x, 12 + y)-(6 + x, 28 + y), cf
1049     Line (7 + x, 11 + y)-(7 + x, 29 + y), cf
1050     Line (8 + x, 10 + y)-(8 + x, 30 + y), cf
1051     Line (9 + x, 9 + y)-(9 + x, 31 + y), cf
1052     Line (10 + x, 8 + y)-(10 + x, 32 + y), cf
1053     Line (11 + x, 7 + y)-(11 + x, 33 + y), cf
1054     Line (35 + x, 13 + y)-(35 + x, 27 + y), cf
1055     Line (34 + x, 12 + y)-(34 + x, 28 + y), cf
1056     Line (33 + x, 11 + y)-(33 + x, 29 + y), cf
1057     Line (32 + x, 10 + y)-(32 + x, 30 + y), cf
1058     Line (31 + x, 9 + y)-(31 + x, 31 + y), cf
1059     Line (30 + x, 8 + y)-(30 + x, 32 + y), cf
1060     Line (29 + x, 7 + y)-(29 + x, 33 + y), cf
1061 End Sub
1062
1063 Sub checker ()
1064     Line (14 + x, 36 + y)-(26 + x, 32 + y), cf, BF
1065     Line (14 + x, 4 + y)-(26 + x, 8 + y), cf, BF
1066     Line (4 + x, 14 + y)-(8 + x, 26 + y), cf, BF
1067     Line (32 + x, 14 + y)-(36 + x, 26 + y), cf, BF
1068     Line (13 + x, 35 + y)-(13 + x, 31 + y), cf
1069     Line (12 + x, 34 + y)-(12 + x, 30 + y), cf
1070     Line (11 + x, 33 + y)-(11 + x, 29 + y), cf
1071     Line (10 + x, 32 + y)-(10 + x, 28 + y), cf
1072     Line (9 + x, 31 + y)-(9 + x, 27 + y), cf
1073     Line (8 + x, 30 + y)-(8 + x, 26 + y), cf
1074     Line (27 + x, 35 + y)-(27 + x, 31 + y), cf
1075     Line (28 + x, 34 + y)-(28 + x, 30 + y), cf
1076     Line (29 + x, 33 + y)-(29 + x, 29 + y), cf
1077     Line (30 + x, 32 + y)-(30 + x, 28 + y), cf
1078     Line (31 + x, 31 + y)-(31 + x, 27 + y), cf
1079     Line (32 + x, 30 + y)-(32 + x, 26 + y), cf
1080     Line (13 + x, 5 + y)-(13 + x, 9 + y), cf
1081     Line (12 + x, 6 + y)-(12 + x, 10 + y), cf
1082     Line (11 + x, 7 + y)-(11 + x, 11 + y), cf
1083     Line (10 + x, 8 + y)-(10 + x, 12 + y), cf
1084     Line (9 + x, 9 + y)-(9 + x, 13 + y), cf
1085     Line (8 + x, 10 + y)-(8 + x, 14 + y), cf
1086     Line (27 + x, 5 + y)-(27 + x, 9 + y), cf
1087     Line (28 + x, 6 + y)-(28 + x, 10 + y), cf
1088     Line (29 + x, 7 + y)-(29 + x, 11 + y), cf
1089     Line (30 + x, 8 + y)-(30 + x, 12 + y), cf
1090     Line (31 + x, 9 + y)-(31 + x, 13 + y), cf
1091     Line (32 + x, 10 + y)-(32 + x, 14 + y), cf
1092     Line (5 + x, 13 + y)-(5 + x, 27 + y), cf
1093     Line (6 + x, 12 + y)-(6 + x, 28 + y), cf
1094     Line (7 + x, 11 + y)-(7 + x, 29 + y), cf
1095     Line (35 + x, 13 + y)-(35 + x, 27 + y), cf
1096     Line (34 + x, 12 + y)-(34 + x, 28 + y), cf
1097     Line (33 + x, 11 + y)-(33 + x, 29 + y), cf
1098     Line (17 + x, 28 + y)-(23 + x, 24 + y), cf, BF
1099     Line (17 + x, 12 + y)-(23 + x, 16 + y), cf, BF
1100     Line (12 + x, 17 + y)-(16 + x, 23 + y), cf, BF
1101     Line (24 + x, 17 + y)-(28 + x, 23 + y), cf, BF
1102     Line (18 + x, 28 + y)-(18 + x, 23 + y), cf
1103     Line (17 + x, 28 + y)-(17 + x, 22 + y), cf
1104     Line (16 + x, 27 + y)-(16 + x, 21 + y), cf
1105     Line (22 + x, 28 + y)-(22 + x, 23 + y), cf
1106     Line (23 + x, 28 + y)-(23 + x, 22 + y), cf
1107     Line (24 + x, 27 + y)-(24 + x, 21 + y), cf
1108     Line (18 + x, 12 + y)-(18 + x, 17 + y), cf
1109     Line (17 + x, 12 + y)-(17 + x, 18 + y), cf
1110     Line (16 + x, 13 + y)-(16 + x, 19 + y), cf
1111     Line (22 + x, 12 + y)-(22 + x, 17 + y), cf
1112     Line (23 + x, 12 + y)-(23 + x, 18 + y), cf
1113     Line (24 + x, 13 + y)-(24 + x, 19 + y), cf
1114     Line (13 + x, 16 + y)-(13 + x, 24 + y), cf
1115     Line (14 + x, 15 + y)-(14 + x, 25 + y), cf
1116     Line (15 + x, 14 + y)-(15 + x, 26 + y), cf
1117     Line (27 + x, 16 + y)-(27 + x, 24 + y), cf
1118     Line (26 + x, 15 + y)-(26 + x, 25 + y), cf
1119     Line (25 + x, 14 + y)-(25 + x, 26 + y), cf
1120 End Sub
1121
1122 Sub cells ()
1123     Line (x, y)-(x + 40, y + 40), cd1, BF
1124     Line (x - 1, y - 1)-(x + 41, y + 41), cb1, B
1125 End Sub
1126
1127 Sub dices ()
1128     Line (20, 160)-(60, 200), cd1, BF
1129     Line (20, 220)-(60, 260), cd1, BF
1130     Line (20, 280)-(60, 320), cd1, BF
1131     Line (580, 160)-(620, 200), cd1, BF
1132     Line (580, 220)-(620, 260), cd1, BF
1133     Line (580, 280)-(620, 320), cd1, BF
1134     Line (19, 159)-(61, 201), cb1, B
1135     Line (19, 219)-(61, 261), cb1, B
1136     Line (19, 279)-(61, 321), cb1, B
1137     Line (579, 159)-(621, 201), cb1, B
1138     Line (579, 219)-(621, 261), cb1, B
1139     Line (579, 279)-(621, 321), cb1, B
1140 End Sub
1141
1142 Sub chessboard ()
1143     Line (160, 80)-(480, 400), cb2, BF
1144     For x = 160 To 480 Step 40
1145         Line (x, 80)-(x, 400), cb1
1146     Next x
1147     For y = 80 To 400 Step 40
1148         Line (160, y)-(480, y), cb1
1149     Next y
1150     For y = 320 To 80 Step -80: For x = 400 To 160 Step -80
1151         Line (x + 1, y + 1)-(x + 39, y + 39), cb3, BF
1152         Line (x + 41, y + 41)-(x + 79, y + 79), cb3, BF
1153     Next x: Next y
1154    y = 405
1155    x = 175:  numberA
1156    x = 215:  numberB
1157    x = 255:  numberC
1158    x = 295:  numberD
1159    x = 335:  numberE
1160    x = 375:  numberF
1161    x = 415:  numberG
1162    x = 455:  numberH
1163    x = 145
1164    y = 95:  number8
1165    y = 135:  number7
1166    y = 175:  number6
1167    y = 215:  number5
1168    y = 255:  number4
1169    y = 295:  number3
1170    y = 335:  number2
1171    y = 375:  number1
1172 End Sub
1173
1174 Sub makrukboard ()
1175     Line (160, 80)-(480, 400), cb2, BF
1176     For x = 160 To 480 Step 40
1177         Line (x, 80)-(x, 400), cb1
1178     Next x
1179     For y = 80 To 400 Step 40
1180         Line (160, y)-(480, y), cb1
1181     Next y
1182    y = 405
1183    x = 175:  numberA ()
1184    x = 215:  numberB ()
1185    x = 255:  numberC ()
1186    x = 295:  numberD ()
1187    x = 335:  numberE ()
1188    x = 375:  numberF ()
1189    x = 415:  numberG ()
1190    x = 455:  numberH ()
1191    x = 145
1192    y = 95:  number8 ()
1193    y = 135:  number7 ()
1194    y = 175:  number6 ()
1195    y = 215:  number5 ()
1196    y = 255:  number4 ()
1197    y = 295:  number3 ()
1198    y = 335:  number2 ()
1199    y = 375:  number1 ()
1200 End Sub
1201
1202 Sub xiangqiboard ()
1203     Line (140, 40)-(500, 440), cb2, BF
1204     For x = 140 To 500 Step 40
1205         Line (x, 40)-(x, 440), cb1
1206     Next x
1207     For y = 40 To 440 Step 40
1208         Line (140, y)-(500, y), cb1
1209     Next y
1210     Line (259, 161)-(381, 159), cb4, BF
1211     Line (259, 41)-(261, 159), cb4, BF
1212     Line (379, 41)-(381, 159), cb4, BF
1213     Line (259, 321)-(381, 319), cb4, BF
1214     Line (259, 439)-(261, 319), cb4, BF
1215     Line (379, 439)-(381, 319), cb4, BF
1216     Line (141, 238)-(499, 242), cb5, BF
1217    y = 445
1218    x = 155:  numberA ()
1219    x = 195:  numberB ()
1220    x = 235:  numberC ()
1221    x = 275:  numberD ()
1222    x = 315:  numberE ()
1223    x = 355:  numberF ()
1224    x = 395:  numberG ()
1225    x = 435:  numberH ()
1226    x = 475:  numberI ()
1227    x = 125
1228    y = 55:  number0 ()
1229    y = 95:  number9 ()
1230    y = 135:  number8 ()
1231    y = 175:  number7 ()
1232    y = 215:  number6 ()
1233    y = 255:  number5 ()
1234    y = 295:  number4 ()
1235    y = 335:  number3 ()
1236    y = 375:  number2 ()
1237    y = 415:  number1 ()
1238 End Sub
1239
1240 Sub shogiboard ()
1241     Line (140, 60)-(500, 420), cb2, BF
1242     For x = 140 To 500 Step 40
1243         Line (x, 60)-(x, 420), cb1
1244     Next x
1245     For y = 60 To 400 Step 40
1246         Line (140, y)-(500, y), cb1
1247     Next y
1248    y = 425
1249    x = 155:  numberA ()
1250    x = 195:  numberB ()
1251    x = 235:  numberC ()
1252    x = 275:  numberD ()
1253    x = 315:  numberE ()
1254    x = 355:  numberF ()
1255    x = 395:  numberG ()
1256    x = 435:  numberH ()
1257    x = 475:  numberI ()
1258    x = 125
1259    y = 75:  number9 ()
1260    y = 115:  number8 ()
1261    y = 155:  number7 ()
1262    y = 195:  number6 ()
1263    y = 235:  number5 ()
1264    y = 275:  number4 ()
1265    y = 315:  number3 ()
1266    y = 355:  number2 ()
1267    y = 395:  number1 ()
1268 End Sub
1269
1270 Sub draughtsboard ()
1271     Line (120, 40)-(520, 440), cb2, BF
1272     For x = 120 To 520 Step 40
1273         Line (x, 40)-(x, 440), cb1
1274     Next x
1275     For y = 40 To 440 Step 40
1276         Line (120, y)-(520, y), cb1
1277     Next y
1278     For y = 360 To 40 Step -80: For x = 440 To 120 Step -80
1279         Line (x + 1, y + 1)-(x + 39, y + 39), cb3, BF
1280         Line (x + 41, y + 41)-(x + 79, y + 79), cb3, BF
1281     Next x: Next y
1282    y = 445
1283    x = 135:  numberA ()
1284    x = 175:  numberB ()
1285    x = 215:  numberC ()
1286    x = 255:  numberD ()
1287    x = 295:  numberE ()
1288    x = 335:  numberF ()
1289    x = 375:  numberG ()
1290    x = 415:  numberH ()
1291    x = 455:  numberI ()
1292    x = 495:  numberJ ()
1293    x = 105
1294    y = 55:  number0 ()
1295    y = 95:  number9 ()
1296    y = 135:  number8 ()
1297    y = 175:  number7 ()
1298    y = 215:  number6 ()
1299    y = 255:  number5 ()
1300    y = 295:  number4 ()
1301    y = 335:  number3 ()
1302    y = 375:  number2 ()
1303    y = 415:  number1 ()
1304 End Sub
1305
1306 Sub chess ()
1307
1308     Rem 1st roll
1309    count = 0:index = 0
1310    dc1 = Int(Rnd * 8 + 1)
1311    dc2 = Int(Rnd * 8 + 1)
1312    dc3 = 1
1313    dc4 = Int(Rnd * 8 + 1)
1314    dc5 = Int(Rnd * 8 + 1)
1315    dc6 = 1
1316    w1 = board(dc2, dc1): b1 = board(dc5, dc4)
1317
1318     Do
1319        count = count + 1
1320        dc1 = Int(Rnd * 8 + 1)
1321        dc2 = Int(Rnd * 8 + 1)
1322        dc4 = Int(Rnd * 8 + 1)
1323        dc5 = Int(Rnd * 8 + 1)
1324        w1 = board(dc2, dc1):b1 = board(dc5, dc4)
1325         If count > 8000 Then Exit Do
1326     Loop While Abs(w1 - b1) < 10
1327
1328    w1 = board(dc2, dc1):b1 = board(dc5, dc4)
1329    fw1x = dc1:fw1y = dc2:fb1x = dc4:fb1y = dc5
1330    fw1 = dc3:fb1 = dc6
1331
1332    x = 20:y = 160:cf = 15
1333     If dc3 = 1 Then  king ()
1334     If dc3 = 2 Then  queen ()
1335     If dc3 = 3 Then  bishop ()
1336     If dc3 = 4 Then  knight ()
1337     If dc3 = 5 Then  rook ()
1338     If dc3 = 6 Then  pawn ()
1339    x = 580:y = 160:cf = 0
1340     If dc6 = 1 Then  king ()
1341     If dc6 = 2 Then  queen ()
1342     If dc6 = 3 Then  bishop ()
1343     If dc6 = 4 Then  knight ()
1344     If dc6 = 5 Then  rook ()
1345     If dc6 = 6 Then  pawn ()
1346    x = 20:y = 220
1347     If dc1 = 1 Then  letterA ()
1348     If dc1 = 2 Then  letterB ()
1349     If dc1 = 3 Then  letterC ()
1350     If dc1 = 4 Then  letterD ()
1351     If dc1 = 5 Then  letterE ()
1352     If dc1 = 6 Then  letterF ()
1353     If dc1 = 7 Then  letterG ()
1354     If dc1 = 8 Then  letterH ()
1355    x = 20:y = 280
1356     If dc2 = 1 Then  letter1 ()
1357     If dc2 = 2 Then  letter2 ()
1358     If dc2 = 3 Then  letter3 ()
1359     If dc2 = 4 Then  letter4 ()
1360     If dc2 = 5 Then  letter5 ()
1361     If dc2 = 6 Then  letter6 ()
1362     If dc2 = 7 Then  letter7 ()
1363     If dc2 = 8 Then  letter8 ()
1364    x = 580:y = 220
1365     If dc4 = 1 Then  letterA ()
1366     If dc4 = 2 Then  letterB ()
1367     If dc4 = 3 Then  letterC ()
1368     If dc4 = 4 Then  letterD ()
1369     If dc4 = 5 Then  letterE ()
1370     If dc4 = 6 Then  letterF ()
1371     If dc4 = 7 Then  letterG ()
1372     If dc4 = 8 Then  letterH ()
1373    x = 580:y = 280
1374     If dc5 = 1 Then  letter1 ()
1375     If dc5 = 2 Then  letter2 ()
1376     If dc5 = 3 Then  letter3 ()
1377     If dc5 = 4 Then  letter4 ()
1378     If dc5 = 5 Then  letter5 ()
1379     If dc5 = 6 Then  letter6 ()
1380     If dc5 = 7 Then  letter7 ()
1381     If dc5 = 8 Then  letter8 ()
1382    x = (dc1 * 40) + 120:y = Abs((dc2 * 40) - 480) - 80
1383    cf = 15:  king
1384    x = (dc4 * 40) + 120:y = Abs((dc5 * 40) - 480) - 80
1385    cf = 0:  king
1386
1387     Do
1388         Select Case InKey$
1389             Case Is = Chr$(32)
1390                 Exit Do
1391             Case Is = Chr$(13)
1392                  chessfen ()
1393             Case Is = Chr$(27)
1394                 End
1395         End Select
1396     Loop
1397
1398      dices
1399
1400     Rem 2nd roll
1401    count = 0:index = 0
1402    dc1 = Int(Rnd * 8 + 1)
1403    dc2 = Int(Rnd * 8 + 1)
1404    dc3 = Int(Rnd * 5 + 2)
1405    dc4 = Int(Rnd * 8 + 1)
1406    dc5 = Int(Rnd * 8 + 1)
1407    dc6 = Int(Rnd * 5 + 2)
1408    w2 = board(dc2, dc1):b2 = board(dc5, dc4)
1409
1410     Select Case dc3
1411         Case Is = 1
1412             ''Exit Case
1413         Case Is = 2
1414             Do
1415                count = count + 1
1416                dc1 = Int(Rnd * 8 + 1)
1417                dc2 = Int(Rnd * 8 + 1)
1418                fw2x = dc1:fw2y = dc2
1419                w2 = board(dc2, dc1)
1420                 If count > 8000 Then Exit Do
1421             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
1422         Case Is = 3
1423             Do
1424                count = count + 1
1425                dc1 = Int(Rnd * 8 + 1)
1426                dc2 = Int(Rnd * 8 + 1)
1427                w2 = board(dc2, dc1)
1428                 If count > 8000 Then Exit Do
1429             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
1430         Case Is = 4
1431             Do
1432                count = count + 1
1433                dc1 = Int(Rnd * 8 + 1)
1434                dc2 = Int(Rnd * 8 + 1)
1435                w2 = board(dc2, dc1)
1436                 If count > 8000 Then Exit Do
1437             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
1438         Case Is = 5
1439             Do
1440                count = count + 1
1441                dc1 = Int(Rnd * 8 + 1)
1442                dc2 = Int(Rnd * 8 + 1)
1443                fw2x = dc1:fw2y = dc2
1444                w2 = board(dc2, dc1)
1445                 If count > 8000 Then Exit Do
1446             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
1447         Case Is = 6
1448             Do
1449                count = count + 1
1450                dc1 = Int(Rnd * 8 + 1)
1451                dc2 = Int(Rnd * 8 + 1)
1452                w2 = board(dc2, dc1)
1453                 If count > 8000 Then Exit Do
1454             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1 Or dc2 = 1 Or dc2 = 8
1455     End Select
1456     Select Case dc6
1457         Case Is = 1
1458             ''Exit Case
1459         Case Is = 2
1460             Do
1461                count = count + 1
1462                dc4 = Int(Rnd * 8 + 1)
1463                dc5 = Int(Rnd * 8 + 1)
1464                fb2x = dc4:fb2y = dc5
1465                b2 = board(dc5, dc4)
1466                 If count > 8000 Then Exit Do
1467             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
1468         Case Is = 3
1469             Do
1470                count = count + 1
1471                dc4 = Int(Rnd * 8 + 1)
1472                dc5 = Int(Rnd * 8 + 1)
1473                b2 = board(dc5, dc4)
1474                 If count > 8000 Then Exit Do
1475             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
1476         Case Is = 4
1477             Do
1478                count = count + 1
1479                dc4 = Int(Rnd * 8 + 1)
1480                dc5 = Int(Rnd * 8 + 1)
1481                b2 = board(dc5, dc4)
1482                 If count > 8000 Then Exit Do
1483             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
1484         Case Is = 5
1485             Do
1486                count = count + 1
1487                dc4 = Int(Rnd * 8 + 1)
1488                dc5 = Int(Rnd * 8 + 1)
1489                fb2x = dc4:fb2y = dc5
1490                b2 = board(dc5, dc4)
1491                 If count > 8000 Then Exit Do
1492             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
1493         Case Is = 6
1494             Do
1495                count = count + 1
1496                dc4 = Int(Rnd * 8 + 1)
1497                dc5 = Int(Rnd * 8 + 1)
1498                b2 = board(dc5, dc4)
1499                 If count > 8000 Then Exit Do
1500             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1 Or dc5 = 1 Or dc5 = 8
1501     End Select
1502
1503    w2 = board(dc2, dc1):b2 = board(dc5, dc4)
1504    fw2x = dc1:fw2y = dc2:fb2x = dc4:fb2y = dc5
1505    fw2 = dc3:fb2 = dc6
1506
1507    x = 20:y = 160:cf = 15
1508     If dc3 = 1 Then  king ()
1509     If dc3 = 2 Then  queen ()
1510     If dc3 = 3 Then  bishop ()
1511     If dc3 = 4 Then  knight ()
1512     If dc3 = 5 Then  rook ()
1513     If dc3 = 6 Then  pawn ()
1514    x = 580:y = 160:cf = 0
1515     If dc6 = 1 Then  king ()
1516     If dc6 = 2 Then  queen ()
1517     If dc6 = 3 Then  bishop ()
1518     If dc6 = 4 Then  knight ()
1519     If dc6 = 5 Then  rook ()
1520     If dc6 = 6 Then  pawn ()
1521    x = 20:y = 220
1522     If dc1 = 1 Then  letterA ()
1523     If dc1 = 2 Then  letterB ()
1524     If dc1 = 3 Then  letterC ()
1525     If dc1 = 4 Then  letterD ()
1526     If dc1 = 5 Then  letterE ()
1527     If dc1 = 6 Then  letterF ()
1528     If dc1 = 7 Then  letterG ()
1529     If dc1 = 8 Then  letterH ()
1530    x = 20:y = 280
1531     If dc2 = 1 Then  letter1 ()
1532     If dc2 = 2 Then  letter2 ()
1533     If dc2 = 3 Then  letter3 ()
1534     If dc2 = 4 Then  letter4 ()
1535     If dc2 = 5 Then  letter5 ()
1536     If dc2 = 6 Then  letter6 ()
1537     If dc2 = 7 Then  letter7 ()
1538     If dc2 = 8 Then  letter8 ()
1539    x = 580:y = 220
1540     If dc4 = 1 Then  letterA ()
1541     If dc4 = 2 Then  letterB ()
1542     If dc4 = 3 Then  letterC ()
1543     If dc4 = 4 Then  letterD ()
1544     If dc4 = 5 Then  letterE ()
1545     If dc4 = 6 Then  letterF ()
1546     If dc4 = 7 Then  letterG ()
1547     If dc4 = 8 Then  letterH ()
1548    x = 580:y = 280
1549     If dc5 = 1 Then  letter1 ()
1550     If dc5 = 2 Then  letter2 ()
1551     If dc5 = 3 Then  letter3 ()
1552     If dc5 = 4 Then  letter4 ()
1553     If dc5 = 5 Then  letter5 ()
1554     If dc5 = 6 Then  letter6 ()
1555     If dc5 = 7 Then  letter7 ()
1556     If dc5 = 8 Then  letter8 ()
1557    x = (dc1 * 40) + 120:y = Abs((dc2 * 40) - 480) - 80
1558    cf = 15
1559     If dc3 = 1 Then  king ()
1560     If dc3 = 2 Then  queen ()
1561     If dc3 = 3 Then  bishop ()
1562     If dc3 = 4 Then  knight ()
1563     If dc3 = 5 Then  rook ()
1564     If dc3 = 6 Then  pawn ()
1565    x = (dc4 * 40) + 120:y = Abs((dc5 * 40) - 480) - 80
1566    cf = 0
1567     If dc6 = 1 Then  king ()
1568     If dc6 = 2 Then  queen ()
1569     If dc6 = 3 Then  bishop ()
1570     If dc6 = 4 Then  knight ()
1571     If dc6 = 5 Then  rook ()
1572     If dc6 = 6 Then  pawn ()
1573
1574     Do
1575         Select Case InKey$
1576             Case Is = Chr$(32)
1577                 Exit Do
1578             Case Is = Chr$(13)
1579                  chessfen ()
1580             Case Is = Chr$(27)
1581                 End
1582         End Select
1583     Loop
1584
1585      dices ()
1586
1587     Rem 3rd roll
1588    count = 0:index = 0
1589    dc1 = Int(Rnd * 8 + 1)
1590    dc2 = Int(Rnd * 8 + 1)
1591    dc3 = Int(Rnd * 5 + 2)
1592    dc4 = Int(Rnd * 8 + 1)
1593    dc5 = Int(Rnd * 8 + 1)
1594    dc6 = Int(Rnd * 5 + 2)
1595    w3 = board(dc2, dc1):b3 = board(dc5, dc4)
1596
1597     Select Case dc3
1598         Case Is = 1
1599             ''Exit Case
1600         Case Is = 2
1601             Do
1602                count = count + 1
1603                dc1 = Int(Rnd * 8 + 1)
1604                dc2 = Int(Rnd * 8 + 1)
1605                fw3x = dc1:fw3y = dc2
1606                w3 = board(dc2, dc1)
1607                 If count > 8000 Then Exit Do
1608             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
1609         Case Is = 3
1610             Do
1611                count = count + 1
1612                dc1 = Int(Rnd * 8 + 1)
1613                dc2 = Int(Rnd * 8 + 1)
1614                w3 = board(dc2, dc1)
1615                 If count > 8000 Then Exit Do
1616             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
1617         Case Is = 4
1618             Do
1619                count = count + 1
1620                dc1 = Int(Rnd * 8 + 1)
1621                dc2 = Int(Rnd * 8 + 1)
1622                w3 = board(dc2, dc1)
1623                 If count > 8000 Then Exit Do
1624             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
1625         Case Is = 5
1626             Do
1627                count = count + 1
1628                dc1 = Int(Rnd * 8 + 1)
1629                dc2 = Int(Rnd * 8 + 1)
1630                fw3x = dc1:fw3y = dc2
1631                w3 = board(dc2, dc1)
1632                 If count > 8000 Then Exit Do
1633             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
1634         Case Is = 6
1635             Do
1636                count = count + 1
1637                dc1 = Int(Rnd * 8 + 1)
1638                dc2 = Int(Rnd * 8 + 1)
1639                w3 = board(dc2, dc1)
1640                 If count > 8000 Then Exit Do
1641             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2 Or dc2 = 1 Or dc2 = 8
1642     End Select
1643     Select Case dc6
1644         Case Is = 1
1645             ''Exit Case
1646         Case Is = 2
1647             Do
1648                count = count + 1
1649                dc4 = Int(Rnd * 8 + 1)
1650                dc5 = Int(Rnd * 8 + 1)
1651                fb3x = dc4:fb3y = dc5
1652                b3 = board(dc5, dc4)
1653                 If count > 8000 Then Exit Do
1654             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
1655         Case Is = 3
1656             Do
1657                count = count + 1
1658                dc4 = Int(Rnd * 8 + 1)
1659                dc5 = Int(Rnd * 8 + 1)
1660                b3 = board(dc5, dc4)
1661                 If count > 8000 Then Exit Do
1662             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
1663         Case Is = 4
1664             Do
1665                count = count + 1
1666                dc4 = Int(Rnd * 8 + 1)
1667                dc5 = Int(Rnd * 8 + 1)
1668                b3 = board(dc5, dc4)
1669                 If count > 8000 Then Exit Do
1670             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
1671         Case Is = 5
1672             Do
1673                count = count + 1
1674                dc4 = Int(Rnd * 8 + 1)
1675                dc5 = Int(Rnd * 8 + 1)
1676                fb3x = dc4:fb3y = dc5
1677                b3 = board(dc5, dc4)
1678                 If count > 8000 Then Exit Do
1679             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
1680         Case Is = 6
1681             Do
1682                count = count + 1
1683                dc4 = Int(Rnd * 8 + 1)
1684                dc5 = Int(Rnd * 8 + 1)
1685                b3 = board(dc5, dc4)
1686                 If count > 8000 Then Exit Do
1687             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2 Or dc5 = 1 Or dc5 = 8
1688     End Select
1689
1690    w3 = board(dc2, dc1):b3 = board(dc5, dc4)
1691    fw3x = dc1:fw3y = dc2:fb3x = dc4:fb3y = dc5
1692    fw3 = dc3:fb3 = dc6
1693
1694    x = 20:y = 160:cf = 15
1695     If dc3 = 1 Then  king ()
1696     If dc3 = 2 Then  queen ()
1697     If dc3 = 3 Then  bishop ()
1698     If dc3 = 4 Then  knight ()
1699     If dc3 = 5 Then  rook ()
1700     If dc3 = 6 Then  pawn ()
1701    x = 580:y = 160:cf = 0
1702     If dc6 = 1 Then  king ()
1703     If dc6 = 2 Then  queen ()
1704     If dc6 = 3 Then  bishop ()
1705     If dc6 = 4 Then  knight ()
1706     If dc6 = 5 Then  rook ()
1707     If dc6 = 6 Then  pawn ()
1708    x = 20:y = 220
1709     If dc1 = 1 Then  letterA ()
1710     If dc1 = 2 Then  letterB ()
1711     If dc1 = 3 Then  letterC ()
1712     If dc1 = 4 Then  letterD ()
1713     If dc1 = 5 Then  letterE ()
1714     If dc1 = 6 Then  letterF ()
1715     If dc1 = 7 Then  letterG ()
1716     If dc1 = 8 Then  letterH ()
1717    x = 20:y = 280
1718     If dc2 = 1 Then  letter1 ()
1719     If dc2 = 2 Then  letter2 ()
1720     If dc2 = 3 Then  letter3 ()
1721     If dc2 = 4 Then  letter4 ()
1722     If dc2 = 5 Then  letter5 ()
1723     If dc2 = 6 Then  letter6 ()
1724     If dc2 = 7 Then  letter7 ()
1725     If dc2 = 8 Then  letter8 ()
1726    x = 580:y = 220
1727     If dc4 = 1 Then  letterA ()
1728     If dc4 = 2 Then  letterB ()
1729     If dc4 = 3 Then  letterC ()
1730     If dc4 = 4 Then  letterD ()
1731     If dc4 = 5 Then  letterE ()
1732     If dc4 = 6 Then  letterF ()
1733     If dc4 = 7 Then  letterG ()
1734     If dc4 = 8 Then  letterH ()
1735    x = 580:y = 280
1736     If dc5 = 1 Then  letter1 ()
1737     If dc5 = 2 Then  letter2 ()
1738     If dc5 = 3 Then  letter3 ()
1739     If dc5 = 4 Then  letter4 ()
1740     If dc5 = 5 Then  letter5 ()
1741     If dc5 = 6 Then  letter6 ()
1742     If dc5 = 7 Then  letter7 ()
1743     If dc5 = 8 Then  letter8 ()
1744    x = (dc1 * 40) + 120:y = Abs((dc2 * 40) - 480) - 80
1745    cf = 15
1746     If dc3 = 1 Then  king ()
1747     If dc3 = 2 Then  queen ()
1748     If dc3 = 3 Then  bishop ()
1749     If dc3 = 4 Then  knight ()
1750     If dc3 = 5 Then  rook ()
1751     If dc3 = 6 Then  pawn ()
1752    x = (dc4 * 40) + 120:y = Abs((dc5 * 40) - 480) - 80
1753    cf = 0
1754     If dc6 = 1 Then  king ()
1755     If dc6 = 2 Then  queen ()
1756     If dc6 = 3 Then  bishop ()
1757     If dc6 = 4 Then  knight ()
1758     If dc6 = 5 Then  rook ()
1759     If dc6 = 6 Then  pawn ()
1760
1761     Do
1762         Select Case InKey$
1763             Case Is = Chr$(32)
1764                 Exit Do
1765             Case Is = Chr$(13)
1766                  chessfen ()
1767             Case Is = Chr$(27)
1768                 End
1769         End Select
1770     Loop
1771
1772      dices ()
1773
1774     Rem 4th roll
1775    count = 0:index = 0
1776    dc1 = Int(Rnd * 8 + 1)
1777    dc2 = Int(Rnd * 8 + 1)
1778    dc3 = Int(Rnd * 5 + 2)
1779    dc4 = Int(Rnd * 8 + 1)
1780    dc5 = Int(Rnd * 8 + 1)
1781    dc6 = Int(Rnd * 5 + 2)
1782    w4 = board(dc2, dc1):b4 = board(dc5, dc4)
1783
1784     Select Case dc3
1785         Case Is = 1
1786             ''Exit Case
1787         Case Is = 2
1788             Do
1789                count = count + 1
1790                dc1 = Int(Rnd * 8 + 1)
1791                dc2 = Int(Rnd * 8 + 1)
1792                fw4x = dc1:fw4y = dc2
1793                w4 = board(dc2, dc1)
1794                 If count > 8000 Then Exit Do
1795             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
1796         Case Is = 3
1797             Do
1798                count = count + 1
1799                dc1 = Int(Rnd * 8 + 1)
1800                dc2 = Int(Rnd * 8 + 1)
1801                w4 = board(dc2, dc1)
1802                 If count > 8000 Then Exit Do
1803             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
1804         Case Is = 4
1805             Do
1806                count = count + 1
1807                dc1 = Int(Rnd * 8 + 1)
1808                dc2 = Int(Rnd * 8 + 1)
1809                w4 = board(dc2, dc1)
1810                 If count > 8000 Then Exit Do
1811             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
1812         Case Is = 5
1813             Do
1814                count = count + 1
1815                dc1 = Int(Rnd * 8 + 1)
1816                dc2 = Int(Rnd * 8 + 1)
1817                fw4x = dc1:fw4y = dc2
1818                w4 = board(dc2, dc1)
1819                 If count > 8000 Then Exit Do
1820             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
1821         Case Is = 6
1822             Do
1823                count = count + 1
1824                dc1 = Int(Rnd * 8 + 1)
1825                dc2 = Int(Rnd * 8 + 1)
1826                w4 = board(dc2, dc1)
1827                 If count > 8000 Then Exit Do
1828             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3 Or dc2 = 1 Or dc2 = 8
1829     End Select
1830     Select Case dc6
1831         Case Is = 1
1832             ''Exit Case
1833         Case Is = 2
1834             Do
1835                count = count + 1
1836                dc4 = Int(Rnd * 8 + 1)
1837                dc5 = Int(Rnd * 8 + 1)
1838                fb4x = dc4:fb4y = dc5
1839                b4 = board(dc5, dc4)
1840                 If count > 8000 Then Exit Do
1841             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
1842         Case Is = 3
1843             Do
1844                count = count + 1
1845                dc4 = Int(Rnd * 8 + 1)
1846                dc5 = Int(Rnd * 8 + 1)
1847                b4 = board(dc5, dc4)
1848                 If count > 8000 Then Exit Do
1849             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
1850         Case Is = 4
1851             Do
1852                count = count + 1
1853                dc4 = Int(Rnd * 8 + 1)
1854                dc5 = Int(Rnd * 8 + 1)
1855                b4 = board(dc5, dc4)
1856                 If count > 8000 Then Exit Do
1857             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
1858         Case Is = 5
1859             Do
1860                count = count + 1
1861                dc4 = Int(Rnd * 8 + 1)
1862                dc5 = Int(Rnd * 8 + 1)
1863                fb4x = dc4:fb4y = dc5
1864                b4 = board(dc5, dc4)
1865                 If count > 8000 Then Exit Do
1866             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
1867         Case Is = 6
1868             Do
1869                count = count + 1
1870                dc4 = Int(Rnd * 8 + 1)
1871                dc5 = Int(Rnd * 8 + 1)
1872                b4 = board(dc5, dc4)
1873                 If count > 8000 Then Exit Do
1874             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3 Or dc5 = 1 Or dc5 = 8
1875     End Select
1876
1877    w4 = board(dc2, dc1):b4 = board(dc5, dc4)
1878    fw4x = dc1:fw4y = dc2:fb4x = dc4:fb4y = dc5
1879    fw4 = dc3:fb4 = dc6
1880
1881    x = 20:y = 160:cf = 15
1882     If dc3 = 1 Then  king ()
1883     If dc3 = 2 Then  queen ()
1884     If dc3 = 3 Then  bishop ()
1885     If dc3 = 4 Then  knight ()
1886     If dc3 = 5 Then  rook ()
1887     If dc3 = 6 Then  pawn ()
1888    x = 580:y = 160:cf = 0
1889     If dc6 = 1 Then  king ()
1890     If dc6 = 2 Then  queen ()
1891     If dc6 = 3 Then  bishop ()
1892     If dc6 = 4 Then  knight ()
1893     If dc6 = 5 Then  rook ()
1894     If dc6 = 6 Then  pawn ()
1895    x = 20:y = 220
1896     If dc1 = 1 Then  letterA ()
1897     If dc1 = 2 Then  letterB ()
1898     If dc1 = 3 Then  letterC ()
1899     If dc1 = 4 Then  letterD ()
1900     If dc1 = 5 Then  letterE ()
1901     If dc1 = 6 Then  letterF ()
1902     If dc1 = 7 Then  letterG ()
1903     If dc1 = 8 Then  letterH ()
1904    x = 20:y = 280
1905     If dc2 = 1 Then  letter1 ()
1906     If dc2 = 2 Then  letter2 ()
1907     If dc2 = 3 Then  letter3 ()
1908     If dc2 = 4 Then  letter4 ()
1909     If dc2 = 5 Then  letter5 ()
1910     If dc2 = 6 Then  letter6 ()
1911     If dc2 = 7 Then  letter7 ()
1912     If dc2 = 8 Then  letter8 ()
1913    x = 580:y = 220
1914     If dc4 = 1 Then  letterA ()
1915     If dc4 = 2 Then  letterB ()
1916     If dc4 = 3 Then  letterC ()
1917     If dc4 = 4 Then  letterD ()
1918     If dc4 = 5 Then  letterE ()
1919     If dc4 = 6 Then  letterF ()
1920     If dc4 = 7 Then  letterG ()
1921     If dc4 = 8 Then  letterH ()
1922    x = 580:y = 280
1923     If dc5 = 1 Then  letter1 ()
1924     If dc5 = 2 Then  letter2 ()
1925     If dc5 = 3 Then  letter3 ()
1926     If dc5 = 4 Then  letter4 ()
1927     If dc5 = 5 Then  letter5 ()
1928     If dc5 = 6 Then  letter6 ()
1929     If dc5 = 7 Then  letter7 ()
1930     If dc5 = 8 Then  letter8 ()
1931    x = (dc1 * 40) + 120:y = Abs((dc2 * 40) - 480) - 80
1932    cf = 15
1933     If dc3 = 1 Then  king ()
1934     If dc3 = 2 Then  queen ()
1935     If dc3 = 3 Then  bishop ()
1936     If dc3 = 4 Then  knight ()
1937     If dc3 = 5 Then  rook ()
1938     If dc3 = 6 Then  pawn ()
1939    x = (dc4 * 40) + 120:y = Abs((dc5 * 40) - 480) - 80
1940    cf = 0
1941     If dc6 = 1 Then  king ()
1942     If dc6 = 2 Then  queen ()
1943     If dc6 = 3 Then  bishop ()
1944     If dc6 = 4 Then  knight ()
1945     If dc6 = 5 Then  rook ()
1946     If dc6 = 6 Then  pawn ()
1947
1948     Do
1949         Select Case InKey$
1950             Case Is = Chr$(32)
1951                 ''Exit Case
1952             Case Is = Chr$(13)
1953                  chessfen ()
1954             Case Is = Chr$(27)
1955                 End
1956         End Select
1957     Loop
1958 End Sub
1959
1960 Sub makruk ()
1961
1962     Rem 1st roll
1963    count = 0:index = 0
1964    dc1 = Int(Rnd * 8 + 1)
1965    dc2 = Int(Rnd * 8 + 1)
1966    dc3 = 1
1967    dc4 = Int(Rnd * 8 + 1)
1968    dc5 = Int(Rnd * 8 + 1)
1969    dc6 = 1
1970    w1 = board(dc2, dc1):b1 = board(dc5, dc4)
1971
1972     Do
1973        count = count + 1
1974        dc1 = Int(Rnd * 8 + 1)
1975        dc2 = Int(Rnd * 8 + 1)
1976        dc4 = Int(Rnd * 8 + 1)
1977        dc5 = Int(Rnd * 8 + 1)
1978        w1 = board(dc2, dc1):b1 = board(dc5, dc4)
1979         If count > 8000 Then Exit Do
1980     Loop While Abs(w1 - b1) < 10
1981
1982    w1 = board(dc2, dc1):b1 = board(dc5, dc4)
1983    fw1x = dc1:fw1y = dc2:fb1x = dc4:fb1y = dc5
1984    fw1 = dc3:fb1 = dc6
1985
1986    x = 20:y = 160:cf = 15
1987     If dc3 = 1 Then  king ()
1988     If dc3 = 2 Then  queen ()
1989     If dc3 = 3 Then  bishop ()
1990     If dc3 = 4 Then  knight ()
1991     If dc3 = 5 Then  rook ()
1992     If dc3 = 6 Then  checker ()
1993    x = 580:y = 160:cf = 0
1994     If dc6 = 1 Then  king ()
1995     If dc6 = 2 Then  queen ()
1996     If dc6 = 3 Then  bishop ()
1997     If dc6 = 4 Then  knight ()
1998     If dc6 = 5 Then  rook ()
1999     If dc6 = 6 Then  checker ()
2000    x = 20:y = 220
2001     If dc1 = 1 Then  letterA ()
2002     If dc1 = 2 Then  letterB ()
2003     If dc1 = 3 Then  letterC ()
2004     If dc1 = 4 Then  letterD ()
2005     If dc1 = 5 Then  letterE ()
2006     If dc1 = 6 Then  letterF ()
2007     If dc1 = 7 Then  letterG ()
2008     If dc1 = 8 Then  letterH ()
2009    x = 20:y = 280
2010     If dc2 = 1 Then  letter1 ()
2011     If dc2 = 2 Then  letter2 ()
2012     If dc2 = 3 Then  letter3 ()
2013     If dc2 = 4 Then  letter4 ()
2014     If dc2 = 5 Then  letter5 ()
2015     If dc2 = 6 Then  letter6 ()
2016     If dc2 = 7 Then  letter7 ()
2017     If dc2 = 8 Then  letter8 ()
2018    x = 580:y = 220
2019     If dc4 = 1 Then  letterA ()
2020     If dc4 = 2 Then  letterB ()
2021     If dc4 = 3 Then  letterC ()
2022     If dc4 = 4 Then  letterD ()
2023     If dc4 = 5 Then  letterE ()
2024     If dc4 = 6 Then  letterF ()
2025     If dc4 = 7 Then  letterG ()
2026     If dc4 = 8 Then  letterH ()
2027    x = 580:y = 280
2028     If dc5 = 1 Then  letter1 ()
2029     If dc5 = 2 Then  letter2 ()
2030     If dc5 = 3 Then  letter3 ()
2031     If dc5 = 4 Then  letter4 ()
2032     If dc5 = 5 Then  letter5 ()
2033     If dc5 = 6 Then  letter6 ()
2034     If dc5 = 7 Then  letter7 ()
2035     If dc5 = 8 Then  letter8 ()
2036    x = (dc1 * 40) + 120:y = Abs((dc2 * 40) - 480) - 80
2037    cf = 15:  king
2038    x = (dc4 * 40) + 120:y = Abs((dc5 * 40) - 480) - 80
2039    cf = 0:  king
2040
2041     Do
2042         Select Case InKey$
2043             Case Is = Chr$(32)
2044                 Exit Do
2045             Case Is = Chr$(13)
2046                  makrukfen ()
2047             Case Is = Chr$(27)
2048                 End
2049         End Select
2050     Loop
2051
2052      dices ()
2053
2054     Rem 2nd roll
2055    count = 0:index = 0
2056    dc1 = Int(Rnd * 8 + 1)
2057    dc2 = Int(Rnd * 8 + 1)
2058    dc3 = Int(Rnd * 5 + 2)
2059    dc4 = Int(Rnd * 8 + 1)
2060    dc5 = Int(Rnd * 8 + 1)
2061    dc6 = Int(Rnd * 5 + 2)
2062    w2 = board(dc2, dc1):b2 = board(dc5, dc4)
2063
2064     Select Case dc3
2065         Case Is = 1
2066             ''Exit Case
2067         Case Is = 2
2068             Do
2069                count = count + 1
2070                dc1 = Int(Rnd * 8 + 1)
2071                dc2 = Int(Rnd * 8 + 1)
2072                w2 = board(dc2, dc1)
2073                 If count > 8000 Then Exit Do
2074             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
2075         Case Is = 3
2076            indexw3 = 1
2077             Do
2078                count = count + 1
2079                dc1 = Int(Rnd * 8 + 1)
2080                dc2 = Int(Rnd * 8 + 1)
2081                w2 = board(dc2, dc1)
2082                 If count > 8000 Then Exit Do
2083             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
2084         Case Is = 4
2085            indexw4 = 1
2086             Do
2087                count = count + 1
2088                dc1 = Int(Rnd * 8 + 1)
2089                dc2 = Int(Rnd * 8 + 1)
2090                w2 = board(dc2, dc1)
2091                 If count > 8000 Then Exit Do
2092             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
2093         Case Is = 5
2094            indexw5 = 1
2095             Do
2096                count = count + 1
2097                dc1 = Int(Rnd * 8 + 1)
2098                dc2 = Int(Rnd * 8 + 1)
2099                fw2x = dc1:fw2y = dc2
2100                w2 = board(dc2, dc1)
2101                 If count > 8000 Then Exit Do
2102             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
2103         Case Is = 6
2104             Do
2105                count = count + 1
2106                dc1 = Int(Rnd * 8 + 1)
2107                dc2 = Int(Rnd * 8 + 1)
2108                w2 = board(dc2, dc1)
2109                 If count > 8000 Then Exit Do
2110             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1 Or dc2 < 3 Or dc2 > 5
2111     End Select
2112     Select Case dc6
2113         Case Is = 1
2114             ''Exit Case
2115         Case Is = 2
2116             Do
2117                count = count + 1
2118                dc4 = Int(Rnd * 8 + 1)
2119                dc5 = Int(Rnd * 8 + 1)
2120                b2 = board(dc5, dc4)
2121                 If count > 8000 Then Exit Do
2122             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
2123         Case Is = 3
2124            indexb3 = 1
2125             Do
2126                count = count + 1
2127                dc4 = Int(Rnd * 8 + 1)
2128                dc5 = Int(Rnd * 8 + 1)
2129                b2 = board(dc5, dc4)
2130                 If count > 8000 Then Exit Do
2131             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
2132         Case Is = 4
2133            indexb4 = 1
2134             Do
2135                count = count + 1
2136                dc4 = Int(Rnd * 8 + 1)
2137                dc5 = Int(Rnd * 8 + 1)
2138                b2 = board(dc5, dc4)
2139                 If count > 8000 Then Exit Do
2140             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
2141         Case Is = 5
2142            indexb5 = 1
2143             Do
2144                count = count + 1
2145                dc4 = Int(Rnd * 8 + 1)
2146                dc5 = Int(Rnd * 8 + 1)
2147                fb2x = dc4:fb2y = dc5
2148                b2 = board(dc5, dc4)
2149                 If count > 8000 Then Exit Do
2150             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
2151         Case Is = 6
2152             Do
2153                count = count + 1
2154                dc4 = Int(Rnd * 8 + 1)
2155                dc5 = Int(Rnd * 8 + 1)
2156                b2 = board(dc5, dc4)
2157                 If count > 8000 Then Exit Do
2158             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1 Or dc5 < 4 Or dc5 > 6
2159     End Select
2160
2161    w2 = board(dc2, dc1):b2 = board(dc5, dc4)
2162    fw2x = dc1:fw2y = dc2:fb2x = dc4:fb2y = dc5
2163    fw2 = dc3:fb2 = dc6
2164
2165    x = 20:y = 160:cf = 15
2166     If dc3 = 1 Then  king ()
2167     If dc3 = 2 Then  queen ()
2168     If dc3 = 3 Then  bishop ()
2169     If dc3 = 4 Then  knight ()
2170     If dc3 = 5 Then  rook ()
2171     If dc3 = 6 Then  checker ()
2172    x = 580:y = 160:cf = 0
2173     If dc6 = 1 Then  king ()
2174     If dc6 = 2 Then  queen ()
2175     If dc6 = 3 Then  bishop ()
2176     If dc6 = 4 Then  knight ()
2177     If dc6 = 5 Then  rook ()
2178     If dc6 = 6 Then  checker ()
2179    x = 20:y = 220
2180     If dc1 = 1 Then  letterA ()
2181     If dc1 = 2 Then  letterB ()
2182     If dc1 = 3 Then  letterC ()
2183     If dc1 = 4 Then  letterD ()
2184     If dc1 = 5 Then  letterE ()
2185     If dc1 = 6 Then  letterF ()
2186     If dc1 = 7 Then  letterG ()
2187     If dc1 = 8 Then  letterH ()
2188    x = 20:y = 280
2189     If dc2 = 1 Then  letter1 ()
2190     If dc2 = 2 Then  letter2 ()
2191     If dc2 = 3 Then  letter3 ()
2192     If dc2 = 4 Then  letter4 ()
2193     If dc2 = 5 Then  letter5 ()
2194     If dc2 = 6 Then  letter6 ()
2195     If dc2 = 7 Then  letter7 ()
2196     If dc2 = 8 Then  letter8 ()
2197    x = 580:y = 220
2198     If dc4 = 1 Then  letterA ()
2199     If dc4 = 2 Then  letterB ()
2200     If dc4 = 3 Then  letterC ()
2201     If dc4 = 4 Then  letterD ()
2202     If dc4 = 5 Then  letterE ()
2203     If dc4 = 6 Then  letterF ()
2204     If dc4 = 7 Then  letterG ()
2205     If dc4 = 8 Then  letterH ()
2206    x = 580:y = 280
2207     If dc5 = 1 Then  letter1 ()
2208     If dc5 = 2 Then  letter2 ()
2209     If dc5 = 3 Then  letter3 ()
2210     If dc5 = 4 Then  letter4 ()
2211     If dc5 = 5 Then  letter5 ()
2212     If dc5 = 6 Then  letter6 ()
2213     If dc5 = 7 Then  letter7 ()
2214     If dc5 = 8 Then  letter8 ()
2215    x = (dc1 * 40) + 120:y = Abs((dc2 * 40) - 480) - 80
2216    cf = 15
2217     If dc3 = 1 Then  king ()
2218     If dc3 = 2 Then  queen ()
2219     If dc3 = 3 Then  bishop ()
2220     If dc3 = 4 Then  knight ()
2221     If dc3 = 5 Then  rook ()
2222     If dc3 = 6 Then  checker ()
2223    x = (dc4 * 40) + 120:y = Abs((dc5 * 40) - 480) - 80
2224    cf = 0
2225     If dc6 = 1 Then  king ()
2226     If dc6 = 2 Then  queen ()
2227     If dc6 = 3 Then  bishop ()
2228     If dc6 = 4 Then  knight ()
2229     If dc6 = 5 Then  rook ()
2230     If dc6 = 6 Then  checker ()
2231
2232     Do
2233         Select Case InKey$
2234             Case Is = Chr$(32)
2235                 Exit Do
2236             Case Is = Chr$(13)
2237                  makrukfen ()
2238             Case Is = Chr$(27)
2239                 End
2240         End Select
2241     Loop
2242
2243      dices ()
2244
2245     Rem 3rd roll
2246    count = 0:index = 0
2247    dc1 = Int(Rnd * 8 + 1)
2248    dc2 = Int(Rnd * 8 + 1)
2249    dc3 = Int(Rnd * 5 + 2)
2250    dc4 = Int(Rnd * 8 + 1)
2251    dc5 = Int(Rnd * 8 + 1)
2252    dc6 = Int(Rnd * 5 + 2)
2253    w3 = board(dc2, dc1):b3 = board(dc5, dc4)
2254
2255     Select Case dc3
2256         Case Is = 1
2257             ''Exit Case
2258         Case Is = 2
2259             Do
2260                count = count + 1
2261                dc1 = Int(Rnd * 8 + 1)
2262                dc2 = Int(Rnd * 8 + 1)
2263                w3 = board(dc2, dc1)
2264                 If count > 8000 Then Exit Do
2265             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
2266         Case Is = 3
2267            indexw3 = indexw3 + 1
2268             Do
2269                count = count + 1
2270                dc1 = Int(Rnd * 8 + 1)
2271                dc2 = Int(Rnd * 8 + 1)
2272                w3 = board(dc2, dc1)
2273                 If count > 8000 Then Exit Do
2274             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
2275         Case Is = 4
2276            indexw4 = indexw4 + 1
2277             Do
2278                count = count + 1
2279                dc1 = Int(Rnd * 8 + 1)
2280                dc2 = Int(Rnd * 8 + 1)
2281                w3 = board(dc2, dc1)
2282                 If count > 8000 Then Exit Do
2283             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
2284         Case Is = 5
2285            indexw5 = indexw5 + 1
2286             Do
2287                count = count + 1
2288                dc1 = Int(Rnd * 8 + 1)
2289                dc2 = Int(Rnd * 8 + 1)
2290                fw3x = dc1:fw3y = dc2
2291                w3 = board(dc2, dc1)
2292                 If count > 8000 Then Exit Do
2293             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
2294         Case Is = 6
2295             Do
2296                count = count + 1
2297                dc1 = Int(Rnd * 8 + 1)
2298                dc2 = Int(Rnd * 8 + 1)
2299                w3 = board(dc2, dc1)
2300                 If count > 8000 Then Exit Do
2301             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2 Or dc2 < 3 Or dc2 > 5
2302     End Select
2303     Select Case dc6
2304         Case Is = 1
2305             'Exit Case
2306         Case Is = 2
2307             Do
2308                count = count + 1
2309                dc4 = Int(Rnd * 8 + 1)
2310                dc5 = Int(Rnd * 8 + 1)
2311                b3 = board(dc5, dc4)
2312                 If count > 8000 Then Exit Do
2313             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
2314         Case Is = 3
2315            indexb3 = indexb3 + 1
2316             Do
2317                count = count + 1
2318                dc4 = Int(Rnd * 8 + 1)
2319                dc5 = Int(Rnd * 8 + 1)
2320                b3 = board(dc5, dc4)
2321                 If count > 8000 Then Exit Do
2322             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
2323         Case Is = 4
2324            indexb4 = indexb4 + 1
2325             Do
2326                count = count + 1
2327                dc4 = Int(Rnd * 8 + 1)
2328                dc5 = Int(Rnd * 8 + 1)
2329                b3 = board(dc5, dc4)
2330                 If count > 8000 Then Exit Do
2331             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
2332         Case Is = 5
2333            indexb5 = indexb5 + 1
2334             Do
2335                count = count + 1
2336                dc4 = Int(Rnd * 8 + 1)
2337                dc5 = Int(Rnd * 8 + 1)
2338                fb3x = dc4:fb3y = dc5
2339                b3 = board(dc5, dc4)
2340                 If count > 8000 Then Exit Do
2341             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
2342         Case Is = 6
2343             Do
2344                count = count + 1
2345                dc4 = Int(Rnd * 8 + 1)
2346                dc5 = Int(Rnd * 8 + 1)
2347                b3 = board(dc5, dc4)
2348                 If count > 8000 Then Exit Do
2349             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2 Or dc5 < 4 Or dc5 > 6
2350     End Select
2351
2352    w3 = board(dc2, dc1):b3 = board(dc5, dc4)
2353    fw3x = dc1:fw3y = dc2:fb3x = dc4:fb3y = dc5
2354    fw3 = dc3:fb3 = dc6
2355
2356    x = 20:y = 160:cf = 15
2357     If dc3 = 1 Then  king ()
2358     If dc3 = 2 Then  queen ()
2359     If dc3 = 3 Then  bishop ()
2360     If dc3 = 4 Then  knight ()
2361     If dc3 = 5 Then  rook ()
2362     If dc3 = 6 Then  checker ()
2363    x = 580:y = 160:cf = 0
2364     If dc6 = 1 Then  king ()
2365     If dc6 = 2 Then  queen ()
2366     If dc6 = 3 Then  bishop ()
2367     If dc6 = 4 Then  knight ()
2368     If dc6 = 5 Then  rook ()
2369     If dc6 = 6 Then  checker ()
2370    x = 20:y = 220
2371     If dc1 = 1 Then  letterA ()
2372     If dc1 = 2 Then  letterB ()
2373     If dc1 = 3 Then  letterC ()
2374     If dc1 = 4 Then  letterD ()
2375     If dc1 = 5 Then  letterE ()
2376     If dc1 = 6 Then  letterF ()
2377     If dc1 = 7 Then  letterG ()
2378     If dc1 = 8 Then  letterH ()
2379    x = 20:y = 280
2380     If dc2 = 1 Then  letter1 ()
2381     If dc2 = 2 Then  letter2 ()
2382     If dc2 = 3 Then  letter3 ()
2383     If dc2 = 4 Then  letter4 ()
2384     If dc2 = 5 Then  letter5 ()
2385     If dc2 = 6 Then  letter6 ()
2386     If dc2 = 7 Then  letter7 ()
2387     If dc2 = 8 Then  letter8 ()
2388    x = 580:y = 220
2389     If dc4 = 1 Then  letterA ()
2390     If dc4 = 2 Then  letterB ()
2391     If dc4 = 3 Then  letterC ()
2392     If dc4 = 4 Then  letterD ()
2393     If dc4 = 5 Then  letterE ()
2394     If dc4 = 6 Then  letterF ()
2395     If dc4 = 7 Then  letterG ()
2396     If dc4 = 8 Then  letterH ()
2397    x = 580:y = 280
2398     If dc5 = 1 Then  letter1 ()
2399     If dc5 = 2 Then  letter2 ()
2400     If dc5 = 3 Then  letter3 ()
2401     If dc5 = 4 Then  letter4 ()
2402     If dc5 = 5 Then  letter5 ()
2403     If dc5 = 6 Then  letter6 ()
2404     If dc5 = 7 Then  letter7 ()
2405     If dc5 = 8 Then  letter8 ()
2406    x = (dc1 * 40) + 120:y = Abs((dc2 * 40) - 480) - 80
2407    cf = 15
2408     If dc3 = 1 Then  king ()
2409     If dc3 = 2 Then  queen ()
2410     If dc3 = 3 Then  bishop ()
2411     If dc3 = 4 Then  knight ()
2412     If dc3 = 5 Then  rook ()
2413     If dc3 = 6 Then  checker ()
2414    x = (dc4 * 40) + 120:y = Abs((dc5 * 40) - 480) - 80
2415    cf = 0
2416     If dc6 = 1 Then  king ()
2417     If dc6 = 2 Then  queen ()
2418     If dc6 = 3 Then  bishop ()
2419     If dc6 = 4 Then  knight ()
2420     If dc6 = 5 Then  rook ()
2421     If dc6 = 6 Then  checker ()
2422
2423     Do
2424         Select Case InKey$
2425             Case Is = Chr$(32)
2426                 Exit Do
2427             Case Is = Chr$(13)
2428                  makrukfen ()
2429             Case Is = Chr$(27)
2430                 End
2431         End Select
2432     Loop
2433
2434      dices ()
2435
2436     Rem 4th roll
2437    count = 0:index = 0
2438    dc1 = Int(Rnd * 8 + 1)
2439    dc2 = Int(Rnd * 8 + 1)
2440    dc3 = Int(Rnd * 5 + 2)
2441    dc4 = Int(Rnd * 8 + 1)
2442    dc5 = Int(Rnd * 8 + 1)
2443    dc6 = Int(Rnd * 5 + 2)
2444    w4 = board(dc2, dc1):b4 = board(dc5, dc4)
2445     If indexw3 > 2 Or indexw4 > 2 Or indexw5 > 2 Then dc3 = 6
2446     If indexb3 > 2 Or indexb4 > 2 Or indexb5 > 2 Then dc6 = 6
2447
2448     Select Case dc3
2449         Case Is = 1
2450             'Exit Case
2451         Case Is = 2
2452             Do
2453                count = count + 1
2454                dc1 = Int(Rnd * 8 + 1)
2455                dc2 = Int(Rnd * 8 + 1)
2456                w4 = board(dc2, dc1)
2457                 If count > 8000 Then Exit Do
2458             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
2459         Case Is = 3
2460             Do
2461                count = count + 1
2462                dc1 = Int(Rnd * 8 + 1)
2463                dc2 = Int(Rnd * 8 + 1)
2464                w4 = board(dc2, dc1)
2465                 If count > 8000 Then Exit Do
2466             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
2467         Case Is = 4
2468             Do
2469                count = count + 1
2470                dc1 = Int(Rnd * 8 + 1)
2471                dc2 = Int(Rnd * 8 + 1)
2472                w4 = board(dc2, dc1)
2473                 If count > 8000 Then Exit Do
2474             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
2475         Case Is = 5
2476             Do
2477                count = count + 1
2478                dc1 = Int(Rnd * 8 + 1)
2479                dc2 = Int(Rnd * 8 + 1)
2480                fw4x = dc1:fw4y = dc2
2481                w4 = board(dc2, dc1)
2482                 If count > 8000 Then Exit Do
2483             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
2484         Case Is = 6
2485             Do
2486                count = count + 1
2487                dc1 = Int(Rnd * 8 + 1)
2488                dc2 = Int(Rnd * 8 + 1)
2489                w4 = board(dc2, dc1)
2490                 If count > 8000 Then Exit Do
2491             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3 Or dc2 < 3 Or dc2 > 5
2492     End Select
2493     Select Case dc6
2494         Case Is = 1
2495             'Exit Case
2496         Case Is = 2
2497             Do
2498                count = count + 1
2499                dc4 = Int(Rnd * 8 + 1)
2500                dc5 = Int(Rnd * 8 + 1)
2501                b4 = board(dc5, dc4)
2502                 If count > 8000 Then Exit Do
2503             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
2504         Case Is = 3
2505             Do
2506                count = count + 1
2507                dc4 = Int(Rnd * 8 + 1)
2508                dc5 = Int(Rnd * 8 + 1)
2509                b4 = board(dc5, dc4)
2510                 If count > 8000 Then Exit Do
2511             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
2512         Case Is = 4
2513             Do
2514                count = count + 1
2515                dc4 = Int(Rnd * 8 + 1)
2516                dc5 = Int(Rnd * 8 + 1)
2517                b4 = board(dc5, dc4)
2518                 If count > 8000 Then Exit Do
2519             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
2520         Case Is = 5
2521             Do
2522                count = count + 1
2523                dc4 = Int(Rnd * 8 + 1)
2524                dc5 = Int(Rnd * 8 + 1)
2525                fb4x = dc4:fb4y = dc5
2526                b4 = board(dc5, dc4)
2527                 If count > 8000 Then Exit Do
2528             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
2529         Case Is = 6
2530             Do
2531                count = count + 1
2532                dc4 = Int(Rnd * 8 + 1)
2533                dc5 = Int(Rnd * 8 + 1)
2534                b4 = board(dc5, dc4)
2535                 If count > 8000 Then Exit Do
2536             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3 Or dc5 <= 4 Or dc5 >= 6
2537     End Select
2538
2539    w4 = board(dc2, dc1):b4 = board(dc5, dc4)
2540    fw4x = dc1:fw4y = dc2:fb4x = dc4:fb4y = dc5
2541    fw4 = dc3:fb4 = dc6
2542
2543    x = 20:y = 160:cf = 15
2544     If dc3 = 1 Then  king ()
2545     If dc3 = 2 Then  queen ()
2546     If dc3 = 3 Then  bishop ()
2547     If dc3 = 4 Then  knight ()
2548     If dc3 = 5 Then  rook ()
2549     If dc3 = 6 Then  checker ()
2550    x = 580:y = 160:cf = 0
2551     If dc6 = 1 Then  king ()
2552     If dc6 = 2 Then  queen ()
2553     If dc6 = 3 Then  bishop ()
2554     If dc6 = 4 Then  knight ()
2555     If dc6 = 5 Then  rook ()
2556     If dc6 = 6 Then  checker ()
2557    x = 20:y = 220
2558     If dc1 = 1 Then  letterA ()
2559     If dc1 = 2 Then  letterB ()
2560     If dc1 = 3 Then  letterC ()
2561     If dc1 = 4 Then  letterD ()
2562     If dc1 = 5 Then  letterE ()
2563     If dc1 = 6 Then  letterF ()
2564     If dc1 = 7 Then  letterG ()
2565     If dc1 = 8 Then  letterH ()
2566    x = 20:y = 280
2567     If dc2 = 1 Then  letter1 ()
2568     If dc2 = 2 Then  letter2 ()
2569     If dc2 = 3 Then  letter3 ()
2570     If dc2 = 4 Then  letter4 ()
2571     If dc2 = 5 Then  letter5 ()
2572     If dc2 = 6 Then  letter6 ()
2573     If dc2 = 7 Then  letter7 ()
2574     If dc2 = 8 Then  letter8 ()
2575    x = 580:y = 220
2576     If dc4 = 1 Then  letterA ()
2577     If dc4 = 2 Then  letterB ()
2578     If dc4 = 3 Then  letterC ()
2579     If dc4 = 4 Then  letterD ()
2580     If dc4 = 5 Then  letterE ()
2581     If dc4 = 6 Then  letterF ()
2582     If dc4 = 7 Then  letterG ()
2583     If dc4 = 8 Then  letterH ()
2584    x = 580:y = 280
2585     If dc5 = 1 Then  letter1 ()
2586     If dc5 = 2 Then  letter2 ()
2587     If dc5 = 3 Then  letter3 ()
2588     If dc5 = 4 Then  letter4 ()
2589     If dc5 = 5 Then  letter5 ()
2590     If dc5 = 6 Then  letter6 ()
2591     If dc5 = 7 Then  letter7 ()
2592     If dc5 = 8 Then  letter8 ()
2593    x = (dc1 * 40) + 120:y = Abs((dc2 * 40) - 480) - 80
2594    cf = 15
2595     If dc3 = 1 Then  king ()
2596     If dc3 = 2 Then  queen ()
2597     If dc3 = 3 Then  bishop ()
2598     If dc3 = 4 Then  knight ()
2599     If dc3 = 5 Then  rook ()
2600     If dc3 = 6 Then  checker ()
2601    x = (dc4 * 40) + 120:y = Abs((dc5 * 40) - 480) - 80
2602    cf = 0
2603     If dc6 = 1 Then  king ()
2604     If dc6 = 2 Then  queen ()
2605     If dc6 = 3 Then  bishop ()
2606     If dc6 = 4 Then  knight ()
2607     If dc6 = 5 Then  rook ()
2608     If dc6 = 6 Then  checker ()
2609
2610     Do
2611         Select Case InKey$
2612             Case Is = Chr$(32)
2613                 'Exit Case
2614             Case Is = Chr$(13)
2615                  makrukfen ()
2616             Case Is = Chr$(27)
2617                 End
2618         End Select
2619     Loop
2620
2621 End Sub
2622
2623 Sub xiangqi ()
2624
2625     Rem 1st roll
2626    count = 0:index = 0
2627    dc1 = Int(Rnd * 3 + 4)
2628    dc2 = Int(Rnd * 3 + 1)
2629    dc3 = 1
2630    dc4 = Int(Rnd * 3 + 4)
2631    dc5 = Int(Rnd * 3 + 8)
2632    dc6 = 1
2633    w1 = xiabo(dc2, dc1):b1 = xiabo(dc5, dc4)
2634
2635     Do
2636        count = count + 1
2637        dc1 = Int(Rnd * 3 + 4)
2638        dc2 = Int(Rnd * 3 + 1)
2639        dc4 = Int(Rnd * 3 + 4)
2640        dc5 = Int(Rnd * 3 + 8)
2641        w1 = xiabo(dc2, dc1):b1 = xiabo(dc5, dc4)
2642         If count > 8000 Then Exit Do
2643     Loop While w1 = b1
2644
2645    w1 = xiabo(dc2, dc1):b1 = xiabo(dc5, dc4)
2646    fw1x = dc1:fw1y = dc2:fb1x = dc4:fb1y = dc5
2647    fw1 = dc3:fb1 = dc6
2648
2649    x = 20:y = 160:cf = 15
2650     If dc3 = 1 Then  king ()
2651     If dc3 = 2 Then  queen ()
2652     If dc3 = 3 Then  bishop ()
2653     If dc3 = 4 Then  knight ()
2654     If dc3 = 5 Then  rook ()
2655     If dc3 = 6 Then  cannon ()
2656     If dc3 = 7 Then  pawn ()
2657    x = 580:y = 160:cf = 0
2658     If dc6 = 1 Then  king ()
2659     If dc6 = 2 Then  queen ()
2660     If dc6 = 3 Then  bishop ()
2661     If dc6 = 4 Then  knight ()
2662     If dc6 = 5 Then  rook ()
2663     If dc6 = 6 Then  cannon ()
2664     If dc6 = 7 Then  pawn ()
2665    x = 20:y = 220
2666     If dc1 = 1 Then  letterA ()
2667     If dc1 = 2 Then  letterB ()
2668     If dc1 = 3 Then  letterC ()
2669     If dc1 = 4 Then  letterD ()
2670     If dc1 = 5 Then  letterE ()
2671     If dc1 = 6 Then  letterF ()
2672     If dc1 = 7 Then  letterG ()
2673     If dc1 = 8 Then  letterH ()
2674     If dc1 = 9 Then  letterI ()
2675    x = 20:y = 280
2676     If dc2 = 1 Then  letter1 ()
2677     If dc2 = 2 Then  letter2 ()
2678     If dc2 = 3 Then  letter3 ()
2679     If dc2 = 4 Then  letter4 ()
2680     If dc2 = 5 Then  letter5 ()
2681     If dc2 = 6 Then  letter6 ()
2682     If dc2 = 7 Then  letter7 ()
2683     If dc2 = 8 Then  letter8 ()
2684     If dc2 = 9 Then  letter9 ()
2685     If dc2 = 10 Then  letter0 ()
2686    x = 580:y = 220
2687     If dc4 = 1 Then  letterA ()
2688     If dc4 = 2 Then  letterB ()
2689     If dc4 = 3 Then  letterC ()
2690     If dc4 = 4 Then  letterD ()
2691     If dc4 = 5 Then  letterE ()
2692     If dc4 = 6 Then  letterF ()
2693     If dc4 = 7 Then  letterG ()
2694     If dc4 = 8 Then  letterH ()
2695     If dc4 = 9 Then  letterI ()
2696    x = 580:y = 280
2697     If dc5 = 1 Then  letter1 ()
2698     If dc5 = 2 Then  letter2 ()
2699     If dc5 = 3 Then  letter3 ()
2700     If dc5 = 4 Then  letter4 ()
2701     If dc5 = 5 Then  letter5 ()
2702     If dc5 = 6 Then  letter6 ()
2703     If dc5 = 7 Then  letter7 ()
2704     If dc5 = 8 Then  letter8 ()
2705     If dc5 = 9 Then  letter9 ()
2706     If dc5 = 10 Then  letter0 ()
2707    x = (dc1 * 40) + 100:y = Abs((dc2 * 40) - 480) - 40
2708    cf = 15:  king ()
2709    x = (dc4 * 40) + 100:y = Abs((dc5 * 40) - 480) - 40
2710    cf = 0:  king ()
2711
2712     Do
2713         Select Case InKey$
2714             Case Is = Chr$(32)
2715                 Exit Do
2716             Case Is = Chr$(13)
2717                  xiangqifen ()
2718             Case Is = Chr$(27)
2719                 End
2720         End Select
2721     Loop
2722
2723      dices ()
2724
2725     Rem 2nd roll
2726    count = 0:index = 0
2727    dc1 = Int(Rnd * 9 + 1)
2728    dc2 = Int(Rnd * 10 + 1)
2729    dc3 = Int(Rnd * 6 + 2)
2730    dc4 = Int(Rnd * 9 + 1)
2731    dc5 = Int(Rnd * 10 + 1)
2732    dc6 = Int(Rnd * 6 + 2)
2733    w2 = xiabo(dc2, dc1):b2 = xiabo(dc5, dc4)
2734
2735     Select Case dc3
2736         Case Is = 1
2737             'Exit Case
2738         Case Is = 2
2739            indexw2 = 1
2740            dc1 = Int(Rnd * 3 + 4)
2741            dc2 = Int(Rnd * 3 + 1)
2742             Do
2743                count = count + 1
2744                index = Int(Rnd * 5 + 1)
2745                 If index = 1 Then
2746                    dc1 = 4
2747                    dc2 = 1
2748                 End If
2749                 If index = 2 Then
2750                    dc1 = 6
2751                    dc2 = 1
2752                 End If
2753                 If index = 3 Then
2754                    dc1 = 5
2755                    dc2 = 2
2756                 End If
2757                 If index = 4 Then
2758                    dc1 = 4
2759                    dc2 = 3
2760                 End If
2761                 If index = 5 Then
2762                    dc1 = 6
2763                    dc2 = 3
2764                 End If
2765                w2 = xiabo(dc2, dc1)
2766                 If count > 8000 Then Exit Do
2767             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1 Or w2 Mod 2 <> 0
2768         Case Is = 3
2769            indexw3 = 1
2770            dc1 = Int(Rnd * 9 + 1)
2771            dc2 = Int(Rnd * 5 + 1)
2772             Do
2773                count = count + 1
2774                index = Int(Rnd * 7 + 1)
2775                 If index = 1 Then
2776                    dc1 = 3
2777                    dc2 = 1
2778                 End If
2779                 If index = 2 Then
2780                    dc1 = 7
2781                    dc2 = 1
2782                 End If
2783                 If index = 3 Then
2784                    dc1 = 1
2785                    dc2 = 3
2786                 End If
2787                 If index = 4 Then
2788                    dc1 = 5
2789                    dc2 = 3
2790                 End If
2791                 If index = 5 Then
2792                    dc1 = 9
2793                    dc2 = 3
2794                 End If
2795                 If index = 6 Then
2796                    dc1 = 3
2797                    dc2 = 5
2798                 End If
2799                 If index = 7 Then
2800                    dc1 = 7
2801                    dc2 = 5
2802                 End If
2803                w2 = xiabo(dc2, dc1)
2804                 If count > 8000 Then Exit Do
2805             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
2806         Case Is = 4
2807            indexw4 = 1
2808             Do
2809                count = count + 1
2810                dc1 = Int(Rnd * 9 + 1)
2811                dc2 = Int(Rnd * 10 + 1)
2812                w2 = xiabo(dc2, dc1)
2813                 If count > 8000 Then Exit Do
2814             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
2815         Case Is = 5
2816            indexw5 = 1
2817             Do
2818                count = count + 1
2819                dc1 = Int(Rnd * 9 + 1)
2820                dc2 = Int(Rnd * 10 + 1)
2821                fw2x = dc1:fw2y = dc2
2822                w2 = xiabo(dc2, dc1)
2823                 If count > 8000 Then Exit Do
2824             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
2825         Case Is = 6
2826            indexw6 = 1
2827             Do
2828                count = count + 1
2829                dc1 = Int(Rnd * 9 + 1)
2830                dc2 = Int(Rnd * 10 + 1)
2831                fw2x = dc1:fw2y = dc2
2832                w2 = xiabo(dc2, dc1)
2833                 If count > 8000 Then Exit Do
2834             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
2835         Case Is = 7
2836             Do
2837                count = count + 1
2838                dc1 = Int(Rnd * 9 + 1)
2839                dc2 = Int(Rnd * 10 + 1)
2840                w2 = xiabo(dc2, dc1)
2841                 If count > 8000 Then Exit Do
2842             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1 Or dc2 < 4 Or dc2 > 7
2843     End Select
2844     Select Case dc6
2845         Case Is = 1
2846             'Exit Case
2847         Case Is = 2
2848            indexb2 = 1
2849            dc4 = Int(Rnd * 3 + 4)
2850            dc5 = Int(Rnd * 3 + 8)
2851             Do
2852                count = count + 1
2853                index = Int(Rnd * 5 + 1)
2854                 If index = 1 Then
2855                    dc4 = 4
2856                    dc5 = 10
2857                 End If
2858                 If index = 2 Then
2859                    dc4 = 6
2860                    dc5 = 10
2861                 End If
2862                 If index = 3 Then
2863                    dc4 = 5
2864                    dc5 = 9
2865                 End If
2866                 If index = 4 Then
2867                    dc4 = 4
2868                    dc5 = 8
2869                 End If
2870                 If index = 5 Then
2871                    dc4 = 6
2872                    dc5 = 8
2873                 End If
2874                b2 = xiabo(dc5, dc4)
2875                 If count > 8000 Then Exit Do
2876             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1 Or b2 Mod 2 = 0
2877         Case Is = 3
2878            indexb3 = 1
2879            dc4 = Int(Rnd * 9 + 1)
2880            dc5 = Int(Rnd * 5 + 6)
2881             Do
2882                count = count + 1
2883                index = Int(Rnd * 7 + 1)
2884                 If index = 1 Then
2885                    dc4 = 3
2886                    dc5 = 10
2887                 End If
2888                 If index = 2 Then
2889                    dc4 = 7
2890                    dc5 = 10
2891                 End If
2892                 If index = 3 Then
2893                    dc4 = 1
2894                    dc5 = 8
2895                 End If
2896                 If index = 4 Then
2897                    dc4 = 5
2898                    dc5 = 8
2899                 End If
2900                 If index = 5 Then
2901                    dc4 = 9
2902                    dc5 = 8
2903                 End If
2904                 If index = 6 Then
2905                    dc4 = 3
2906                    dc5 = 6
2907                 End If
2908                 If index = 7 Then
2909                    dc4 = 7
2910                    dc5 = 6
2911                 End If
2912                b2 = xiabo(dc5, dc4)
2913                 If count > 8000 Then Exit Do
2914             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1 Or b2
2915         Case Is = 4
2916            indexb4 = 1
2917             Do
2918                count = count + 1
2919                dc4 = Int(Rnd * 9 + 1)
2920                dc5 = Int(Rnd * 10 + 1)
2921                b2 = xiabo(dc5, dc4)
2922                 If count > 8000 Then Exit Do
2923             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
2924         Case Is = 5
2925            indexb5 = 1
2926             Do
2927                count = count + 1
2928                dc4 = Int(Rnd * 9 + 1)
2929                dc5 = Int(Rnd * 10 + 1)
2930                fb2x = dc4:fb2y = dc5
2931                b2 = xiabo(dc5, dc4)
2932                 If count > 8000 Then Exit Do
2933             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
2934         Case Is = 6
2935            indexb6 = 1
2936             Do
2937                count = count + 1
2938                dc4 = Int(Rnd * 9 + 1)
2939                dc5 = Int(Rnd * 10 + 1)
2940                fb2x = dc4:fb2y = dc5
2941                b2 = xiabo(dc5, dc4)
2942                 If count > 8000 Then Exit Do
2943             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
2944         Case Is = 7
2945             Do
2946                count = count + 1
2947                dc4 = Int(Rnd * 9 + 1)
2948                dc5 = Int(Rnd * 10 + 1)
2949                b2 = xiabo(dc5, dc4)
2950                 If count > 8000 Then Exit Do
2951             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1 Or dc5 < 3 Or dc5 > 8
2952     End Select
2953
2954    w2 = xiabo(dc2, dc1):b2 = xiabo(dc5, dc4)
2955    fw2x = dc1:fw2y = dc2:fb2x = dc4:fb2y = dc5
2956    fw2 = dc3:fb2 = dc6
2957
2958    x = 20:y = 160:cf = 15
2959     If dc3 = 1 Then  king ()
2960     If dc3 = 2 Then  queen ()
2961     If dc3 = 3 Then  bishop ()
2962     If dc3 = 4 Then  knight ()
2963     If dc3 = 5 Then  rook ()
2964     If dc3 = 6 Then  cannon ()
2965     If dc3 = 7 Then  pawn ()
2966    x = 580:y = 160:cf = 0
2967     If dc6 = 1 Then  king ()
2968     If dc6 = 2 Then  queen ()
2969     If dc6 = 3 Then  bishop ()
2970     If dc6 = 4 Then  knight ()
2971     If dc6 = 5 Then  rook ()
2972     If dc6 = 6 Then  cannon ()
2973     If dc6 = 7 Then  pawn ()
2974    x = 20:y = 220
2975     If dc1 = 1 Then  letterA ()
2976     If dc1 = 2 Then  letterB ()
2977     If dc1 = 3 Then  letterC ()
2978     If dc1 = 4 Then  letterD ()
2979     If dc1 = 5 Then  letterE ()
2980     If dc1 = 6 Then  letterF ()
2981     If dc1 = 7 Then  letterG ()
2982     If dc1 = 8 Then  letterH ()
2983     If dc1 = 9 Then  letterI ()
2984    x = 20:y = 280
2985     If dc2 = 1 Then  letter1 ()
2986     If dc2 = 2 Then  letter2 ()
2987     If dc2 = 3 Then  letter3 ()
2988     If dc2 = 4 Then  letter4 ()
2989     If dc2 = 5 Then  letter5 ()
2990     If dc2 = 6 Then  letter6 ()
2991     If dc2 = 7 Then  letter7 ()
2992     If dc2 = 8 Then  letter8 ()
2993     If dc2 = 9 Then  letter9 ()
2994     If dc2 = 10 Then  letter0 ()
2995    x = 580:y = 220
2996     If dc4 = 1 Then  letterA ()
2997     If dc4 = 2 Then  letterB ()
2998     If dc4 = 3 Then  letterC ()
2999     If dc4 = 4 Then  letterD ()
3000     If dc4 = 5 Then  letterE ()
3001     If dc4 = 6 Then  letterF ()
3002     If dc4 = 7 Then  letterG ()
3003     If dc4 = 8 Then  letterH ()
3004     If dc4 = 9 Then  letterI ()
3005    x = 580:y = 280
3006     If dc5 = 1 Then  letter1 ()
3007     If dc5 = 2 Then  letter2 ()
3008     If dc5 = 3 Then  letter3 ()
3009     If dc5 = 4 Then  letter4 ()
3010     If dc5 = 5 Then  letter5 ()
3011     If dc5 = 6 Then  letter6 ()
3012     If dc5 = 7 Then  letter7 ()
3013     If dc5 = 8 Then  letter8 ()
3014     If dc5 = 9 Then  letter9 ()
3015     If dc5 = 10 Then  letter0 ()
3016    x = (dc1 * 40) + 100:y = Abs((dc2 * 40) - 480) - 40
3017    cf = 15
3018     If dc3 = 1 Then  king ()
3019     If dc3 = 2 Then  queen ()
3020     If dc3 = 3 Then  bishop ()
3021     If dc3 = 4 Then  knight ()
3022     If dc3 = 5 Then  rook ()
3023     If dc3 = 6 Then  cannon ()
3024     If dc3 = 7 Then  pawn ()
3025    x = (dc4 * 40) + 100:y = Abs((dc5 * 40) - 480) - 40
3026    cf = 0
3027     If dc6 = 1 Then  king ()
3028     If dc6 = 2 Then  queen ()
3029     If dc6 = 3 Then  bishop ()
3030     If dc6 = 4 Then  knight ()
3031     If dc6 = 5 Then  rook ()
3032     If dc6 = 6 Then  cannon ()
3033     If dc6 = 7 Then  pawn ()
3034
3035     Do
3036         Select Case InKey$
3037             Case Is = Chr$(32)
3038                 Exit Do
3039             Case Is = Chr$(13)
3040                  xiangqifen ()
3041             Case Is = Chr$(27)
3042                 End
3043         End Select
3044     Loop
3045
3046      dices ()
3047
3048     Rem 3rd roll
3049    count = 0:index = 0
3050    dc1 = Int(Rnd * 9 + 1)
3051    dc2 = Int(Rnd * 10 + 1)
3052    dc3 = Int(Rnd * 6 + 2)
3053    dc4 = Int(Rnd * 9 + 1)
3054    dc5 = Int(Rnd * 10 + 1)
3055    dc6 = Int(Rnd * 6 + 2)
3056    w3 = xiabo(dc2, dc1):b3 = xiabo(dc5, dc4)
3057
3058     Select Case dc3
3059         Case Is = 1
3060             'Exit Case
3061         Case Is = 2
3062            indexw2 = indexw2 + 1
3063            dc1 = Int(Rnd * 3 + 4)
3064            dc2 = Int(Rnd * 3 + 1)
3065             Do
3066                count = count + 1
3067                index = Int(Rnd * 5 + 1)
3068                 If index = 1 Then
3069                    dc1 = 4
3070                    dc2 = 1
3071                 End If
3072                 If index = 2 Then
3073                    dc1 = 6
3074                    dc2 = 1
3075                 End If
3076                 If index = 3 Then
3077                    dc1 = 5
3078                    dc2 = 2
3079                 End If
3080                 If index = 4 Then
3081                    dc1 = 4
3082                    dc2 = 3
3083                 End If
3084                 If index = 5 Then
3085                    dc1 = 6
3086                    dc2 = 3
3087                 End If
3088                w3 = xiabo(dc2, dc1)
3089                 If count > 8000 Then Exit Do
3090             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2 Or w3 Mod 2 <> 0
3091         Case Is = 3
3092            indexw3 = indexw3 + 1
3093            dc1 = Int(Rnd * 9 + 1)
3094            dc2 = Int(Rnd * 5 + 1)
3095             Do
3096                count = count + 1
3097                index = Int(Rnd * 7 + 1)
3098                 If index = 1 Then
3099                    dc1 = 3
3100                    dc2 = 1
3101                 End If
3102                 If index = 2 Then
3103                    dc1 = 7
3104                    dc2 = 1
3105                 End If
3106                 If index = 3 Then
3107                    dc1 = 1
3108                    dc2 = 3
3109                 End If
3110                 If index = 4 Then
3111                    dc1 = 5
3112                    dc2 = 3
3113                 End If
3114                 If index = 5 Then
3115                    dc1 = 9
3116                    dc2 = 3
3117                 End If
3118                 If index = 6 Then
3119                    dc1 = 3
3120                    dc2 = 5
3121                 End If
3122                 If index = 7 Then
3123                    dc1 = 7
3124                    dc2 = 5
3125                 End If
3126                w3 = xiabo(dc2, dc1)
3127                 If count > 8000 Then Exit Do
3128             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
3129         Case Is = 4
3130            indexw4 = indexw4 + 1
3131             Do
3132                count = count + 1
3133                dc1 = Int(Rnd * 9 + 1)
3134                dc2 = Int(Rnd * 10 + 1)
3135                w3 = xiabo(dc2, dc1)
3136                 If count > 8000 Then Exit Do
3137             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
3138         Case Is = 5
3139            indexw5 = indexw5 + 1
3140             Do
3141                count = count + 1
3142                dc1 = Int(Rnd * 9 + 1)
3143                dc2 = Int(Rnd * 10 + 1)
3144                fw3x = dc1:fw3y = dc2
3145                w3 = xiabo(dc2, dc1)
3146                 If count > 8000 Then Exit Do
3147             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
3148         Case Is = 6
3149            indexw6 = indexw6 + 1
3150             Do
3151                count = count + 1
3152                dc1 = Int(Rnd * 9 + 1)
3153                dc2 = Int(Rnd * 10 + 1)
3154                fw3x = dc1:fw3y = dc2
3155                w3 = xiabo(dc2, dc1)
3156                 If count > 8000 Then Exit Do
3157             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
3158         Case Is = 7
3159             Do
3160                count = count + 1
3161                dc1 = Int(Rnd * 9 + 1)
3162                dc2 = Int(Rnd * 10 + 1)
3163                w3 = xiabo(dc2, dc1)
3164                 If count > 8000 Then Exit Do
3165             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2 Or dc2 < 4 Or dc2 > 7
3166     End Select
3167     Select Case dc6
3168         Case Is = 1
3169             'Exit Case
3170         Case Is = 2
3171            indexb2 = indexb2 + 1
3172            dc4 = Int(Rnd * 3 + 4)
3173            dc5 = Int(Rnd * 3 + 8)
3174             Do
3175                count = count + 1
3176                index = Int(Rnd * 5 + 1)
3177                 If index = 1 Then
3178                    dc4 = 4
3179                    dc5 = 10
3180                 End If
3181                 If index = 2 Then
3182                    dc4 = 6
3183                    dc5 = 10
3184                 End If
3185                 If index = 3 Then
3186                    dc4 = 5
3187                    dc5 = 9
3188                 End If
3189                 If index = 4 Then
3190                    dc4 = 4
3191                    dc5 = 8
3192                 End If
3193                 If index = 5 Then
3194                    dc4 = 6
3195                    dc5 = 8
3196                 End If
3197                b3 = xiabo(dc5, dc4)
3198                 If count > 8000 Then Exit Do
3199             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2 Or b3 Mod 2 = 0
3200         Case Is = 3
3201            indexb3 = indexb3 + 1
3202            dc4 = Int(Rnd * 9 + 1)
3203            dc5 = Int(Rnd * 5 + 6)
3204             Do
3205                count = count + 1
3206                index = Int(Rnd * 7 + 1)
3207                 If index = 1 Then
3208                    dc4 = 3
3209                    dc5 = 10
3210                 End If
3211                 If index = 2 Then
3212                    dc4 = 7
3213                    dc5 = 10
3214                 End If
3215                 If index = 3 Then
3216                    dc4 = 1
3217                    dc5 = 8
3218                 End If
3219                 If index = 4 Then
3220                    dc4 = 5
3221                    dc5 = 8
3222                 End If
3223                 If index = 5 Then
3224                    dc4 = 9
3225                    dc5 = 8
3226                 End If
3227                 If index = 6 Then
3228                    dc4 = 3
3229                    dc5 = 6
3230                 End If
3231                 If index = 7 Then
3232                    dc4 = 7
3233                    dc5 = 6
3234                 End If
3235                b3 = xiabo(dc5, dc4)
3236                 If count > 8000 Then Exit Do
3237             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
3238         Case Is = 4
3239            indexb4 = indexb4 + 1
3240             Do
3241                count = count + 1
3242                dc4 = Int(Rnd * 9 + 1)
3243                dc5 = Int(Rnd * 10 + 1)
3244                b3 = xiabo(dc5, dc4)
3245                 If count > 8000 Then Exit Do
3246             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
3247         Case Is = 5
3248            indexb5 = indexb5 + 1
3249             Do
3250                count = count + 1
3251                dc4 = Int(Rnd * 9 + 1)
3252                dc5 = Int(Rnd * 10 + 1)
3253                fb3x = dc4:fb3y = dc5
3254                b3 = xiabo(dc5, dc4)
3255                 If count > 8000 Then Exit Do
3256             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
3257         Case Is = 6
3258            indexb6 = indexb6 + 1
3259             Do
3260                count = count + 1
3261                dc4 = Int(Rnd * 9 + 1)
3262                dc5 = Int(Rnd * 10 + 1)
3263                fb3x = dc4:fb3y = dc5
3264                b3 = xiabo(dc5, dc4)
3265                 If count > 8000 Then Exit Do
3266             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
3267         Case Is = 7
3268             Do
3269                count = count + 1
3270                dc4 = Int(Rnd * 9 + 1)
3271                dc5 = Int(Rnd * 10 + 1)
3272                b3 = xiabo(dc5, dc4)
3273                 If count > 8000 Then Exit Do
3274             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2 Or dc5 < 3 Or dc5 > 8
3275     End Select
3276
3277    w3 = xiabo(dc2, dc1):b3 = xiabo(dc5, dc4)
3278    fw3x = dc1:fw3y = dc2:fb3x = dc4:fb3y = dc5
3279    fw3 = dc3:fb3 = dc6
3280
3281    x = 20:y = 160:cf = 15
3282     If dc3 = 1 Then  king ()
3283     If dc3 = 2 Then  queen ()
3284     If dc3 = 3 Then  bishop ()
3285     If dc3 = 4 Then  knight ()
3286     If dc3 = 5 Then  rook ()
3287     If dc3 = 6 Then  cannon ()
3288     If dc3 = 7 Then  pawn ()
3289    x = 580:y = 160:cf = 0
3290     If dc6 = 1 Then  king ()
3291     If dc6 = 2 Then  queen ()
3292     If dc6 = 3 Then  bishop ()
3293     If dc6 = 4 Then  knight ()
3294     If dc6 = 5 Then  rook ()
3295     If dc6 = 6 Then  cannon ()
3296     If dc6 = 7 Then  pawn ()
3297    x = 20:y = 220
3298     If dc1 = 1 Then  letterA ()
3299     If dc1 = 2 Then  letterB ()
3300     If dc1 = 3 Then  letterC ()
3301     If dc1 = 4 Then  letterD ()
3302     If dc1 = 5 Then  letterE ()
3303     If dc1 = 6 Then  letterF ()
3304     If dc1 = 7 Then  letterG ()
3305     If dc1 = 8 Then  letterH ()
3306     If dc1 = 9 Then  letterI ()
3307    x = 20:y = 280
3308     If dc2 = 1 Then  letter1 ()
3309     If dc2 = 2 Then  letter2 ()
3310     If dc2 = 3 Then  letter3 ()
3311     If dc2 = 4 Then  letter4 ()
3312     If dc2 = 5 Then  letter5 ()
3313     If dc2 = 6 Then  letter6 ()
3314     If dc2 = 7 Then  letter7 ()
3315     If dc2 = 8 Then  letter8 ()
3316     If dc2 = 9 Then  letter9 ()
3317     If dc2 = 10 Then  letter0 ()
3318    x = 580:y = 220
3319     If dc4 = 1 Then  letterA ()
3320     If dc4 = 2 Then  letterB ()
3321     If dc4 = 3 Then  letterC ()
3322     If dc4 = 4 Then  letterD ()
3323     If dc4 = 5 Then  letterE ()
3324     If dc4 = 6 Then  letterF ()
3325     If dc4 = 7 Then  letterG ()
3326     If dc4 = 8 Then  letterH ()
3327     If dc4 = 9 Then  letterI ()
3328    x = 580:y = 280
3329     If dc5 = 1 Then  letter1 ()
3330     If dc5 = 2 Then  letter2 ()
3331     If dc5 = 3 Then  letter3 ()
3332     If dc5 = 4 Then  letter4 ()
3333     If dc5 = 5 Then  letter5 ()
3334     If dc5 = 6 Then  letter6 ()
3335     If dc5 = 7 Then  letter7 ()
3336     If dc5 = 8 Then  letter8 ()
3337     If dc5 = 9 Then  letter9 ()
3338     If dc5 = 10 Then  letter0 ()
3339    x = (dc1 * 40) + 100:y = Abs((dc2 * 40) - 480) - 40
3340    cf = 15
3341     If dc3 = 1 Then  king ()
3342     If dc3 = 2 Then  queen ()
3343     If dc3 = 3 Then  bishop ()
3344     If dc3 = 4 Then  knight ()
3345     If dc3 = 5 Then  rook ()
3346     If dc3 = 6 Then  cannon ()
3347     If dc3 = 7 Then  pawn ()
3348    x = (dc4 * 40) + 100:y = Abs((dc5 * 40) - 480) - 40
3349    cf = 0
3350     If dc6 = 1 Then  king ()
3351     If dc6 = 2 Then  queen ()
3352     If dc6 = 3 Then  bishop ()
3353     If dc6 = 4 Then  knight ()
3354     If dc6 = 5 Then  rook ()
3355     If dc6 = 6 Then  cannon ()
3356     If dc6 = 7 Then  pawn ()
3357
3358     Do
3359         Select Case InKey$
3360             Case Is = Chr$(32)
3361                 Exit Do
3362             Case Is = Chr$(13)
3363                  xiangqifen ()
3364             Case Is = Chr$(27)
3365                 End
3366         End Select
3367     Loop
3368
3369      dices ()
3370
3371     Rem 4th roll
3372    count = 0:index = 0
3373    dc1 = Int(Rnd * 9 + 1)
3374    dc2 = Int(Rnd * 10 + 1)
3375    dc3 = Int(Rnd * 6 + 2)
3376    dc4 = Int(Rnd * 9 + 1)
3377    dc5 = Int(Rnd * 10 + 1)
3378    dc6 = Int(Rnd * 6 + 2)
3379    w4 = xiabo(dc2, dc1):b2 = xiabo(dc5, dc4)
3380     If indexw2 > 2 Or indexw3 > 2 Or indexw4 > 2 Or indexw5 > 2 Or indexw6 > 2 Then dc3 = 7
3381     If indexb2 > 2 Or indexb3 > 2 Or indexb4 > 2 Or indexb5 > 2 Or indexb6 > 2 Then dc6 = 7
3382
3383     Select Case dc3
3384         Case Is = 1
3385             'Exit Case
3386         Case Is = 2
3387            dc1 = Int(Rnd * 3 + 4)
3388            dc2 = Int(Rnd * 3 + 1)
3389             Do
3390                count = count + 1
3391                index = Int(Rnd * 5 + 1)
3392                 If index = 1 Then
3393                    dc1 = 4
3394                    dc2 = 1
3395                 End If
3396                 If index = 2 Then
3397                    dc1 = 6
3398                    dc2 = 1
3399                 End If
3400                 If index = 3 Then
3401                    dc1 = 5
3402                    dc2 = 2
3403                 End If
3404                 If index = 4 Then
3405                    dc1 = 4
3406                    dc2 = 3
3407                 End If
3408                 If index = 5 Then
3409                    dc1 = 6
3410                    dc2 = 3
3411                 End If
3412                w4 = xiabo(dc2, dc1)
3413                 If count > 8000 Then Exit Do
3414             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3 Or w4 Mod 2 <> 0
3415         Case Is = 3
3416            dc1 = Int(Rnd * 9 + 1)
3417            dc2 = Int(Rnd * 5 + 1)
3418             Do
3419                count = count + 1
3420                index = Int(Rnd * 7 + 1)
3421                 If index = 1 Then
3422                    dc1 = 3
3423                    dc2 = 1
3424                 End If
3425                 If index = 2 Then
3426                    dc1 = 7
3427                    dc2 = 1
3428                 End If
3429                 If index = 3 Then
3430                    dc1 = 1
3431                    dc2 = 3
3432                 End If
3433                 If index = 4 Then
3434                    dc1 = 5
3435                    dc2 = 3
3436                 End If
3437                 If index = 5 Then
3438                    dc1 = 9
3439                    dc2 = 3
3440                 End If
3441                 If index = 6 Then
3442                    dc1 = 3
3443                    dc2 = 5
3444                 End If
3445                 If index = 7 Then
3446                    dc1 = 7
3447                    dc2 = 5
3448                 End If
3449                w4 = xiabo(dc2, dc1)
3450                 If count > 8000 Then Exit Do
3451             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
3452         Case Is = 4
3453             Do
3454                count = count + 1
3455                dc1 = Int(Rnd * 9 + 1)
3456                dc2 = Int(Rnd * 10 + 1)
3457                w4 = xiabo(dc2, dc1)
3458                 If count > 8000 Then Exit Do
3459             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
3460         Case Is = 5
3461             Do
3462                count = count + 1
3463                dc1 = Int(Rnd * 9 + 1)
3464                dc2 = Int(Rnd * 10 + 1)
3465                fw4x = dc1:fw4y = dc2
3466                w4 = xiabo(dc2, dc1)
3467                 If count > 8000 Then Exit Do
3468             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
3469         Case Is = 6
3470             Do
3471                count = count + 1
3472                dc1 = Int(Rnd * 9 + 1)
3473                dc2 = Int(Rnd * 10 + 1)
3474                fw4x = dc1:fw4y = dc2
3475                w4 = xiabo(dc2, dc1)
3476                 If count > 8000 Then Exit Do
3477             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
3478         Case Is = 7
3479             Do
3480                count = count + 1
3481                dc1 = Int(Rnd * 9 + 1)
3482                dc2 = Int(Rnd * 10 + 1)
3483                w4 = xiabo(dc2, dc1)
3484                 If count > 8000 Then Exit Do
3485             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3 < 3 Or dc2 > 8
3486     End Select
3487     Select Case dc6
3488         Case Is = 1
3489             'Exit Case
3490         Case Is = 2
3491            dc4 = Int(Rnd * 3 + 4)
3492            dc5 = Int(Rnd * 3 + 8)
3493             Do
3494                count = count + 1
3495                index = Int(Rnd * 5 + 1)
3496                 If index = 1 Then
3497                    dc4 = 4
3498                    dc5 = 10
3499                 End If
3500                 If index = 2 Then
3501                    dc4 = 6
3502                    dc5 = 10
3503                 End If
3504                 If index = 3 Then
3505                    dc4 = 5
3506                    dc5 = 9
3507                 End If
3508                 If index = 4 Then
3509                    dc4 = 4
3510                    dc5 = 8
3511                 End If
3512                 If index = 5 Then
3513                    dc4 = 6
3514                    dc5 = 8
3515                 End If
3516                b4 = xiabo(dc5, dc4)
3517                 If count > 8000 Then Exit Do
3518             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3 Or b4 Mod 2 = 0
3519         Case Is = 3
3520            dc4 = Int(Rnd * 9 + 1)
3521            dc5 = Int(Rnd * 5 + 6)
3522             Do
3523                count = count + 1
3524                index = Int(Rnd * 7 + 1)
3525                 If index = 1 Then
3526                    dc4 = 3
3527                    dc5 = 10
3528                 End If
3529                 If index = 2 Then
3530                    dc4 = 7
3531                    dc5 = 10
3532                 End If
3533                 If index = 3 Then
3534                    dc4 = 1
3535                    dc5 = 8
3536                 End If
3537                 If index = 4 Then
3538                    dc4 = 5
3539                    dc5 = 8
3540                 End If
3541                 If index = 5 Then
3542                    dc4 = 9
3543                    dc5 = 8
3544                 End If
3545                 If index = 6 Then
3546                    dc4 = 3
3547                    dc5 = 6
3548                 End If
3549                 If index = 7 Then
3550                    dc4 = 7
3551                    dc5 = 6
3552                 End If
3553                b4 = xiabo(dc5, dc4)
3554                 If count > 8000 Then Exit Do
3555             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
3556         Case Is = 4
3557             Do
3558                count = count + 1
3559                dc4 = Int(Rnd * 9 + 1)
3560                dc5 = Int(Rnd * 10 + 1)
3561                b4 = xiabo(dc5, dc4)
3562                 If count > 8000 Then Exit Do
3563             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
3564         Case Is = 5
3565             Do
3566                count = count + 1
3567                dc4 = Int(Rnd * 9 + 1)
3568                dc5 = Int(Rnd * 10 + 1)
3569                fb4x = dc4:fb4y = dc5
3570                b4 = xiabo(dc5, dc4)
3571                 If count > 8000 Then Exit Do
3572             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
3573         Case Is = 6
3574             Do
3575                count = count + 1
3576                dc4 = Int(Rnd * 9 + 1)
3577                dc5 = Int(Rnd * 10 + 1)
3578                fb4x = dc4:fb4y = dc5
3579                b4 = xiabo(dc5, dc4)
3580                 If count > 8000 Then Exit Do
3581             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
3582         Case Is = 7
3583             Do
3584                count = count + 1
3585                dc4 = Int(Rnd * 9 + 1)
3586                dc5 = Int(Rnd * 10 + 1)
3587                b4 = xiabo(dc5, dc4)
3588                 If count > 8000 Then Exit Do
3589             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3 Or dc5 < 3 Or dc5 > 8
3590     End Select
3591
3592    w4 = xiabo(dc2, dc1):b4 = xiabo(dc5, dc4)
3593    fw4x = dc1:fw4y = dc2:fb4x = dc4:fb4y = dc5
3594    fw4 = dc3:fb4 = dc6
3595
3596    x = 20:y = 160:cf = 15
3597     If dc3 = 1 Then  king ()
3598     If dc3 = 2 Then  queen ()
3599     If dc3 = 3 Then  bishop ()
3600     If dc3 = 4 Then  knight ()
3601     If dc3 = 5 Then  rook ()
3602     If dc3 = 6 Then  cannon ()
3603     If dc3 = 7 Then  pawn ()
3604    x = 580:y = 160:cf = 0
3605     If dc6 = 1 Then  king ()
3606     If dc6 = 2 Then  queen ()
3607     If dc6 = 3 Then  bishop ()
3608     If dc6 = 4 Then  knight ()
3609     If dc6 = 5 Then  rook ()
3610     If dc6 = 6 Then  cannon ()
3611     If dc6 = 7 Then  pawn ()
3612    x = 20:y = 220
3613     If dc1 = 1 Then  letterA ()
3614     If dc1 = 2 Then  letterB ()
3615     If dc1 = 3 Then  letterC ()
3616     If dc1 = 4 Then  letterD ()
3617     If dc1 = 5 Then  letterE ()
3618     If dc1 = 6 Then  letterF ()
3619     If dc1 = 7 Then  letterG ()
3620     If dc1 = 8 Then  letterH ()
3621     If dc1 = 9 Then  letterI ()
3622    x = 20:y = 280
3623     If dc2 = 1 Then  letter1 ()
3624     If dc2 = 2 Then  letter2 ()
3625     If dc2 = 3 Then  letter3 ()
3626     If dc2 = 4 Then  letter4 ()
3627     If dc2 = 5 Then  letter5 ()
3628     If dc2 = 6 Then  letter6 ()
3629     If dc2 = 7 Then  letter7 ()
3630     If dc2 = 8 Then  letter8 ()
3631     If dc2 = 9 Then  letter9 ()
3632     If dc2 = 10 Then  letter0 ()
3633    x = 580:y = 220
3634     If dc4 = 1 Then  letterA ()
3635     If dc4 = 2 Then  letterB ()
3636     If dc4 = 3 Then  letterC ()
3637     If dc4 = 4 Then  letterD ()
3638     If dc4 = 5 Then  letterE ()
3639     If dc4 = 6 Then  letterF ()
3640     If dc4 = 7 Then  letterG ()
3641     If dc4 = 8 Then  letterH ()
3642     If dc4 = 9 Then  letterI ()
3643    x = 580:y = 280
3644     If dc5 = 1 Then  letter1 ()
3645     If dc5 = 2 Then  letter2 ()
3646     If dc5 = 3 Then  letter3 ()
3647     If dc5 = 4 Then  letter4 ()
3648     If dc5 = 5 Then  letter5 ()
3649     If dc5 = 6 Then  letter6 ()
3650     If dc5 = 7 Then  letter7 ()
3651     If dc5 = 8 Then  letter8 ()
3652     If dc5 = 9 Then  letter9 ()
3653     If dc5 = 10 Then  letter0 ()
3654    x = (dc1 * 40) + 100:y = Abs((dc2 * 40) - 480) - 40
3655    cf = 15
3656     If dc3 = 1 Then  king ()
3657     If dc3 = 2 Then  queen ()
3658     If dc3 = 3 Then  bishop ()
3659     If dc3 = 4 Then  knight ()
3660     If dc3 = 5 Then  rook ()
3661     If dc3 = 6 Then  cannon ()
3662     If dc3 = 7 Then  pawn ()
3663    x = (dc4 * 40) + 100:y = Abs((dc5 * 40) - 480) - 40
3664    cf = 0
3665     If dc6 = 1 Then  king ()
3666     If dc6 = 2 Then  queen ()
3667     If dc6 = 3 Then  bishop ()
3668     If dc6 = 4 Then  knight ()
3669     If dc6 = 5 Then  rook ()
3670     If dc6 = 6 Then  cannon ()
3671     If dc6 = 7 Then  pawn ()
3672
3673     Do
3674         Select Case InKey$
3675             Case Is = Chr$(32)
3676                 'Exit Case
3677             Case Is = Chr$(13)
3678                  xiangqifen ()
3679             Case Is = Chr$(27)
3680                 End
3681         End Select
3682     Loop
3683
3684 End Sub
3685
3686 Sub shogi ()
3687
3688     Rem 1st roll
3689    count = 0:index = 0
3690    dc1 = Int(Rnd * 9 + 1)
3691    dc2 = Int(Rnd * 9 + 1)
3692    dc3 = 1
3693    dc4 = Int(Rnd * 9 + 1)
3694    dc5 = Int(Rnd * 9 + 1)
3695    dc6 = 1
3696    w1 = shobo(dc2, dc1):b1 = shobo(dc5, dc4)
3697
3698     Do
3699        count = count + 1
3700        dc1 = Int(Rnd * 9 + 1)
3701        dc2 = Int(Rnd * 9 + 1)
3702        dc4 = Int(Rnd * 9 + 1)
3703        dc5 = Int(Rnd * 9 + 1)
3704        w1 = shobo(dc2, dc1):b1 = shobo(dc5, dc4)
3705         If count > 8000 Then Exit Do
3706     Loop While Abs(w1 - b1) < 11
3707
3708    w1 = shobo(dc2, dc1):b1 = shobo(dc5, dc4)
3709    fw1x = dc1:fw1y = dc2:fb1x = dc4:fb1y = dc5
3710    fw1 = dc3:fb1 = dc6
3711
3712    x = 20:y = 160:cf = 15
3713     If dc3 = 1 Then  king ()
3714     If dc3 = 2 Then  queen ()
3715     If dc3 = 3 Then  general ()
3716     If dc3 = 4 Then  bishop ()
3717     If dc3 = 5 Then  knight ()
3718     If dc3 = 6 Then  rook ()
3719     If dc3 = 7 Then  lance ()
3720     If dc3 = 8 Then  pawn ()
3721     If dc3 = 9 Then  tokin ()
3722     If dc3 = 10 Then  dragon ()
3723     If dc3 = 11 Then  horse ()
3724    x = 580:y = 160:cf = 0
3725     If dc6 = 1 Then  king ()
3726     If dc6 = 2 Then  queen ()
3727     If dc6 = 3 Then  general ()
3728     If dc6 = 4 Then  bishop ()
3729     If dc6 = 5 Then  knight ()
3730     If dc6 = 6 Then  rook ()
3731     If dc6 = 7 Then  lance ()
3732     If dc6 = 8 Then  pawn ()
3733     If dc6 = 9 Then  tokin ()
3734     If dc6 = 10 Then  dragon ()
3735     If dc6 = 11 Then  horse ()
3736    x = 20:y = 220
3737     If dc1 = 1 Then  letterA ()
3738     If dc1 = 2 Then  letterB ()
3739     If dc1 = 3 Then  letterC ()
3740     If dc1 = 4 Then  letterD ()
3741     If dc1 = 5 Then  letterE ()
3742     If dc1 = 6 Then  letterF ()
3743     If dc1 = 7 Then  letterG ()
3744     If dc1 = 8 Then  letterH ()
3745     If dc1 = 9 Then  letterI ()
3746    x = 20:y = 280
3747     If dc2 = 1 Then  letter1 ()
3748     If dc2 = 2 Then  letter2 ()
3749     If dc2 = 3 Then  letter3 ()
3750     If dc2 = 4 Then  letter4 ()
3751     If dc2 = 5 Then  letter5 ()
3752     If dc2 = 6 Then  letter6 ()
3753     If dc2 = 7 Then  letter7 ()
3754     If dc2 = 8 Then  letter8 ()
3755     If dc2 = 9 Then  letter9 ()
3756     If dc2 = 10 Then  letter0 ()
3757    x = 580:y = 220
3758     If dc4 = 1 Then  letterA ()
3759     If dc4 = 2 Then  letterB ()
3760     If dc4 = 3 Then  letterC ()
3761     If dc4 = 4 Then  letterD ()
3762     If dc4 = 5 Then  letterE ()
3763     If dc4 = 6 Then  letterF ()
3764     If dc4 = 7 Then  letterG ()
3765     If dc4 = 8 Then  letterH ()
3766     If dc4 = 9 Then  letterI ()
3767    x = 580:y = 280
3768     If dc5 = 1 Then  letter1 ()
3769     If dc5 = 2 Then  letter2 ()
3770     If dc5 = 3 Then  letter3 ()
3771     If dc5 = 4 Then  letter4 ()
3772     If dc5 = 5 Then  letter5 ()
3773     If dc5 = 6 Then  letter6 ()
3774     If dc5 = 7 Then  letter7 ()
3775     If dc5 = 8 Then  letter8 ()
3776     If dc5 = 9 Then  letter9 ()
3777     If dc5 = 10 Then  letter0 ()
3778    x = (dc1 * 40) + 100:y = Abs((dc2 * 40) - 480) - 60
3779    cf = 15:  king ()
3780    x = (dc4 * 40) + 100:y = Abs((dc5 * 40) - 480) - 60
3781    cf = 0:  king ()
3782
3783     Do
3784         Select Case InKey$
3785             Case Is = Chr$(32)
3786                 Exit Do
3787             Case Is = Chr$(13)
3788                  shogifen ()
3789             Case Is = Chr$(27)
3790                 End
3791         End Select
3792     Loop
3793
3794      dices ()
3795
3796     Rem 2nd roll
3797    count = 0:index = 0
3798    dc1 = Int(Rnd * 9 + 1)
3799    dc2 = Int(Rnd * 9 + 1)
3800    dc3 = Int(Rnd * 10 + 2)
3801    dc4 = Int(Rnd * 9 + 1)
3802    dc5 = Int(Rnd * 9 + 1)
3803    dc6 = Int(Rnd * 10 + 2)
3804    w2 = shobo(dc2, dc1):b2 = shobo(dc5, dc4)
3805
3806     Select Case dc3
3807         Case Is = 1
3808             'Exit Case
3809         Case Is = 2
3810             Do
3811                count = count + 1
3812                dc1 = Int(Rnd * 9 + 1)
3813                dc2 = Int(Rnd * 9 + 1)
3814                w2 = shobo(dc2, dc1)
3815                 If count > 8000 Then Exit Do
3816             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
3817         Case Is = 3
3818            indexw3 = 1
3819             Do
3820                count = count + 1
3821                dc1 = Int(Rnd * 9 + 1)
3822                dc2 = Int(Rnd * 9 + 1)
3823                w2 = shobo(dc2, dc1)
3824                 If count > 8000 Then Exit Do
3825             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
3826         Case Is = 4
3827            indexw4 = 1
3828             Do
3829                count = count + 1
3830                dc1 = Int(Rnd * 9 + 1)
3831                dc2 = Int(Rnd * 9 + 1)
3832                w2 = shobo(dc2, dc1)
3833                 If count > 8000 Then Exit Do
3834             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
3835         Case Is = 5
3836            indexw5 = 1
3837             Do
3838                count = count + 1
3839                dc1 = Int(Rnd * 9 + 1)
3840                dc2 = Int(Rnd * 9 + 1)
3841                fw2x = dc1:fw2y = dc2
3842                w2 = shobo(dc2, dc1)
3843                 If count > 8000 Then Exit Do
3844             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
3845         Case Is = 6
3846             Do
3847                indexw6 = 1
3848                count = count + 1
3849                dc1 = Int(Rnd * 9 + 1)
3850                dc2 = Int(Rnd * 9 + 1)
3851                fw2x = dc1:fw2y = dc2
3852                w2 = shobo(dc2, dc1)
3853                 If count > 8000 Then Exit Do
3854             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
3855         Case Is = 7
3856            indexw7 = 1
3857            index = Int(Rnd * 2 + 1)
3858             If index = 1 Then dc1 = 1 Else dc1 = 9
3859             If dc1 = 1 Then indexw71 = 1 Else indexw72 = 1
3860             Do
3861                count = count + 1
3862                dc2 = Int(Rnd * 9 + 1)
3863                w2 = shobo(dc2, dc1)
3864                 If count > 8000 Then Exit Do
3865             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
3866         Case Is = 8
3867             Do
3868                count = count + 1
3869                dc1 = Int(Rnd * 9 + 1)
3870                dc2 = Int(Rnd * 9 + 1)
3871                w2 = shobo(dc2, dc1)
3872                 If count > 8000 Then Exit Do
3873             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1 Or dc2 < 3 Or dc2 > 7
3874         Case Is = 9
3875            indexw9 = 1
3876             Do
3877                count = count + 1
3878                dc1 = Int(Rnd * 9 + 1)
3879                dc2 = Int(Rnd * 9 + 1)
3880                w2 = shobo(dc2, dc1)
3881                 If count > 8000 Then Exit Do
3882             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
3883         Case Is = 10
3884            indexw10 = 1
3885             Do
3886                count = count + 1
3887                dc1 = Int(Rnd * 9 + 1)
3888                dc2 = Int(Rnd * 9 + 1)
3889                w2 = shobo(dc2, dc1)
3890                 If count > 8000 Then Exit Do
3891             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
3892         Case Is = 11
3893             Do
3894                count = count + 1
3895                dc1 = Int(Rnd * 9 + 1)
3896                dc2 = Int(Rnd * 9 + 1)
3897                w2 = shobo(dc2, dc1)
3898                 If count > 8000 Then Exit Do
3899             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
3900     End Select
3901     Select Case dc6
3902         Case Is = 1
3903             'Exit Case
3904         Case Is = 2
3905             Do
3906                count = count + 1
3907                dc4 = Int(Rnd * 9 + 1)
3908                dc5 = Int(Rnd * 9 + 1)
3909                b2 = shobo(dc5, dc4)
3910                 If count > 8000 Then Exit Do
3911             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
3912         Case Is = 3
3913            indexb3 = 1
3914             Do
3915                count = count + 1
3916                dc4 = Int(Rnd * 9 + 1)
3917                dc5 = Int(Rnd * 9 + 1)
3918                b2 = shobo(dc5, dc4)
3919                 If count > 8000 Then Exit Do
3920             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
3921         Case Is = 4
3922            indexb4 = 1
3923             Do
3924                count = count + 1
3925                dc4 = Int(Rnd * 9 + 1)
3926                dc5 = Int(Rnd * 9 + 1)
3927                b2 = shobo(dc5, dc4)
3928                 If count > 8000 Then Exit Do
3929             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
3930         Case Is = 5
3931            indexb5 = 1
3932             Do
3933                count = count + 1
3934                dc4 = Int(Rnd * 9 + 1)
3935                dc5 = Int(Rnd * 9 + 1)
3936                fb2x = dc4:fb2y = dc5
3937                b2 = shobo(dc5, dc4)
3938                 If count > 8000 Then Exit Do
3939             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
3940         Case Is = 6
3941             Do
3942                indexb6 = 1
3943                count = count + 1
3944                dc4 = Int(Rnd * 9 + 1)
3945                dc5 = Int(Rnd * 9 + 1)
3946                fb2x = dc4:fb2y = dc5
3947                b2 = shobo(dc5, dc4)
3948                 If count > 8000 Then Exit Do
3949             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
3950         Case Is = 7
3951            indexb7 = 1
3952            index = Int(Rnd * 2 + 1)
3953             If index = 1 Then dc4 = 1 Else dc4 = 9
3954             If dc4 = 1 Then indexb71 = 1 Else indexb72 = 1
3955             Do
3956                count = count + 1
3957                dc5 = Int(Rnd * 9 + 1)
3958                b2 = shobo(dc5, dc4)
3959                 If count > 8000 Then Exit Do
3960             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
3961         Case Is = 8
3962             Do
3963                count = count + 1
3964                dc4 = Int(Rnd * 9 + 1)
3965                dc5 = Int(Rnd * 9 + 1)
3966                b2 = shobo(dc5, dc4)
3967                 If count > 8000 Then Exit Do
3968             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1 Or dc5 < 3 Or dc5 > 7
3969         Case Is = 9
3970            indexb9 = 1
3971             Do
3972                count = count + 1
3973                dc4 = Int(Rnd * 9 + 1)
3974                dc5 = Int(Rnd * 9 + 1)
3975                b2 = shobo(dc5, dc4)
3976                 If count > 8000 Then Exit Do
3977             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
3978         Case Is = 10
3979            indexb10 = 1
3980             Do
3981                count = count + 1
3982                dc4 = Int(Rnd * 9 + 1)
3983                dc5 = Int(Rnd * 9 + 1)
3984                b2 = shobo(dc5, dc4)
3985                 If count > 8000 Then Exit Do
3986             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
3987         Case Is = 11
3988             Do
3989                count = count + 1
3990                dc4 = Int(Rnd * 9 + 1)
3991                dc5 = Int(Rnd * 9 + 1)
3992                b2 = shobo(dc5, dc4)
3993                 If count > 8000 Then Exit Do
3994             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
3995     End Select
3996
3997    w2 = shobo(dc2, dc1):b2 = shobo(dc5, dc4)
3998    fw2x = dc1:fw2y = dc2:fb2x = dc4:fb2y = dc5
3999    fw2 = dc3:fb2 = dc6
4000
4001    x = 20:y = 160:cf = 15
4002     If dc3 = 1 Then  king ()
4003     If dc3 = 2 Then  queen ()
4004     If dc3 = 3 Then  general ()
4005     If dc3 = 4 Then  bishop ()
4006     If dc3 = 5 Then  knight ()
4007     If dc3 = 6 Then  rook ()
4008     If dc3 = 7 Then  lance ()
4009     If dc3 = 8 Then  pawn ()
4010     If dc3 = 9 Then  horse ()
4011     If dc3 = 10 Then  dragon ()
4012     If dc3 = 11 Then  tokin ()
4013    x = 580:y = 160:cf = 0
4014     If dc6 = 1 Then  king ()
4015     If dc6 = 2 Then  queen ()
4016     If dc6 = 3 Then  general ()
4017     If dc6 = 4 Then  bishop ()
4018     If dc6 = 5 Then  knight ()
4019     If dc6 = 6 Then  rook ()
4020     If dc6 = 7 Then  lance ()
4021     If dc6 = 8 Then  pawn ()
4022     If dc6 = 9 Then  horse ()
4023     If dc6 = 10 Then  dragon ()
4024     If dc6 = 11 Then  tokin ()
4025    x = 20:y = 220
4026     If dc1 = 1 Then  letterA ()
4027     If dc1 = 2 Then  letterB ()
4028     If dc1 = 3 Then  letterC ()
4029     If dc1 = 4 Then  letterD ()
4030     If dc1 = 5 Then  letterE ()
4031     If dc1 = 6 Then  letterF ()
4032     If dc1 = 7 Then  letterG ()
4033     If dc1 = 8 Then  letterH ()
4034     If dc1 = 9 Then  letterI ()
4035    x = 20:y = 280
4036     If dc2 = 1 Then  letter1 ()
4037     If dc2 = 2 Then  letter2 ()
4038     If dc2 = 3 Then  letter3 ()
4039     If dc2 = 4 Then  letter4 ()
4040     If dc2 = 5 Then  letter5 ()
4041     If dc2 = 6 Then  letter6 ()
4042     If dc2 = 7 Then  letter7 ()
4043     If dc2 = 8 Then  letter8 ()
4044     If dc2 = 9 Then  letter9 ()
4045    x = 580:y = 220
4046     If dc4 = 1 Then  letterA ()
4047     If dc4 = 2 Then  letterB ()
4048     If dc4 = 3 Then  letterC ()
4049     If dc4 = 4 Then  letterD ()
4050     If dc4 = 5 Then  letterE ()
4051     If dc4 = 6 Then  letterF ()
4052     If dc4 = 7 Then  letterG ()
4053     If dc4 = 8 Then  letterH ()
4054     If dc4 = 9 Then  letterI ()
4055    x = 580:y = 280
4056     If dc5 = 1 Then  letter1 ()
4057     If dc5 = 2 Then  letter2 ()
4058     If dc5 = 3 Then  letter3 ()
4059     If dc5 = 4 Then  letter4 ()
4060     If dc5 = 5 Then  letter5 ()
4061     If dc5 = 6 Then  letter6 ()
4062     If dc5 = 7 Then  letter7 ()
4063     If dc5 = 8 Then  letter8 ()
4064     If dc5 = 9 Then  letter9 ()
4065    x = (dc1 * 40) + 100:y = Abs((dc2 * 40) - 480) - 60
4066    cf = 15
4067     If dc3 = 1 Then  king ()
4068     If dc3 = 2 Then  queen ()
4069     If dc3 = 3 Then  general ()
4070     If dc3 = 4 Then  bishop ()
4071     If dc3 = 5 Then  knight ()
4072     If dc3 = 6 Then  rook ()
4073     If dc3 = 7 Then  lance ()
4074     If dc3 = 8 Then  pawn ()
4075     If dc3 = 9 Then  horse ()
4076     If dc3 = 10 Then  dragon ()
4077     If dc3 = 11 Then  tokin ()
4078    x = (dc4 * 40) + 100:y = Abs((dc5 * 40) - 480) - 60
4079    cf = 0
4080     If dc6 = 1 Then  king ()
4081     If dc6 = 2 Then  queen ()
4082     If dc6 = 3 Then  general ()
4083     If dc6 = 4 Then  bishop ()
4084     If dc6 = 5 Then  knight ()
4085     If dc6 = 6 Then  rook ()
4086     If dc6 = 7 Then  lance ()
4087     If dc6 = 8 Then  pawn ()
4088     If dc6 = 9 Then  horse ()
4089     If dc6 = 10 Then  dragon ()
4090     If dc6 = 11 Then  tokin ()
4091
4092     Do
4093         Select Case InKey$
4094             Case Is = Chr$(32)
4095                 Exit Do
4096             Case Is = Chr$(13)
4097                  shogifen ()
4098             Case Is = Chr$(27)
4099                 End
4100         End Select
4101     Loop
4102
4103      dices ()
4104
4105     Rem 3rd roll
4106    count = 0:index = 0
4107    dc1 = Int(Rnd * 9 + 1)
4108    dc2 = Int(Rnd * 9 + 1)
4109    dc3 = Int(Rnd * 10 + 2)
4110    dc4 = Int(Rnd * 9 + 1)
4111    dc5 = Int(Rnd * 9 + 1)
4112    dc6 = Int(Rnd * 10 + 2)
4113    w3 = shobo(dc2, dc1):b3 = shobo(dc5, dc4)
4114     If dc3 = 4 Then indexw4 = indexw4 + 1
4115     If dc3 = 6 Then indexw6 = indexw6 + 1
4116     If dc3 = 9 Then indexw9 = indexw9 + 1
4117     If dc3 = 10 Then indexw10 = indexw10 + 1
4118     If indexw4 > 1 Then
4119        dc3 = 8
4120        indexw4 = indexw4 - 1
4121     End If
4122     If indexw6 > 1 Then
4123        dc3 = 8
4124        indexw6 = indexw4 - 1
4125     End If
4126     If indexw9 > 1 Then
4127        dc3 = 8
4128        indexw9 = indexw4 - 1
4129     End If
4130     If indexw10 > 1 Then
4131        dc3 = 8
4132        indexw10 = indexw4 - 1
4133     End If
4134     If indexb4 > 1 Then
4135        dc6 = 8
4136        indexb4 = indexb4 - 1
4137     End If
4138     If indexb6 > 1 Then
4139        dc6 = 8
4140        indexb6 = indexb4 - 1
4141     End If
4142     If indexb9 > 1 Then
4143        dc6 = 8
4144        indexb9 = indexb4 - 1
4145     End If
4146     If indexb10 > 1 Then
4147        dc6 = 8
4148        indexb10 = indexb4 - 1
4149     End If
4150
4151     Select Case dc3
4152         Case Is = 1
4153             'Exit Case
4154         Case Is = 2
4155             Do
4156                count = count + 1
4157                dc1 = Int(Rnd * 9 + 1)
4158                dc2 = Int(Rnd * 9 + 1)
4159                w3 = shobo(dc2, dc1)
4160                 If count > 8000 Then Exit Do
4161             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
4162         Case Is = 3
4163            indexw3 = indexw3 + 1
4164             Do
4165                count = count + 1
4166                dc1 = Int(Rnd * 9 + 1)
4167                dc2 = Int(Rnd * 9 + 1)
4168                w3 = shobo(dc2, dc1)
4169                 If count > 8000 Then Exit Do
4170             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
4171         Case Is = 4
4172            indexw4 = indexw4 + 1
4173             Do
4174                count = count + 1
4175                dc1 = Int(Rnd * 9 + 1)
4176                dc2 = Int(Rnd * 9 + 1)
4177                w3 = shobo(dc2, dc1)
4178                 If count > 8000 Then Exit Do
4179             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
4180         Case Is = 5
4181            indexw5 = indexw5 + 1
4182             Do
4183                count = count + 1
4184                dc1 = Int(Rnd * 9 + 1)
4185                dc2 = Int(Rnd * 9 + 1)
4186                fw2x = dc1:fw2y = dc2
4187                w3 = shobo(dc2, dc1)
4188                 If count > 8000 Then Exit Do
4189             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
4190         Case Is = 6
4191            indexw6 = indexw6 + 1
4192             Do
4193                count = count + 1
4194                dc1 = Int(Rnd * 9 + 1)
4195                dc2 = Int(Rnd * 9 + 1)
4196                fw2x = dc1:fw2y = dc2
4197                w3 = shobo(dc2, dc1)
4198                 If count > 8000 Then Exit Do
4199             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
4200         Case Is = 7
4201            indexw7 = indexw7 + 1
4202            index = Int(Rnd * 2 + 1)
4203             If index = 1 Then dc1 = 1 Else dc1 = 9
4204             If indexw71 = 1 Then dc1 = 9
4205             If indexw72 = 1 Then dc1 = 1
4206             Do
4207                count = count + 1
4208                dc2 = Int(Rnd * 9 + 1)
4209                w3 = shobo(dc2, dc1)
4210                 If count > 8000 Then Exit Do
4211             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
4212         Case Is = 8
4213             Do
4214                count = count + 1
4215                dc1 = Int(Rnd * 9 + 1)
4216                dc2 = Int(Rnd * 9 + 1)
4217                w3 = shobo(dc2, dc1)
4218                 If count > 8000 Then Exit Do
4219             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2 Or dc2 < 3 Or dc2 > 7
4220         Case Is = 9
4221            indexw9 = indexw9 + 1
4222             Do
4223                count = count + 1
4224                dc1 = Int(Rnd * 9 + 1)
4225                dc2 = Int(Rnd * 9 + 1)
4226                w3 = shobo(dc2, dc1)
4227                 If count > 8000 Then Exit Do
4228             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
4229         Case Is = 10
4230            indexw10 = indexw10 + 1
4231             Do
4232                count = count + 1
4233                dc1 = Int(Rnd * 9 + 1)
4234                dc2 = Int(Rnd * 9 + 1)
4235                w3 = shobo(dc2, dc1)
4236                 If count > 8000 Then Exit Do
4237             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
4238         Case Is = 11
4239             Do
4240                count = count + 1
4241                dc1 = Int(Rnd * 9 + 1)
4242                dc2 = Int(Rnd * 9 + 1)
4243                w3 = shobo(dc2, dc1)
4244                 If count > 8000 Then Exit Do
4245             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
4246     End Select
4247     Select Case dc6
4248         Case Is = 1
4249             'Exit Case
4250         Case Is = 2
4251             Do
4252                count = count + 1
4253                dc4 = Int(Rnd * 9 + 1)
4254                dc5 = Int(Rnd * 9 + 1)
4255                b3 = shobo(dc5, dc4)
4256                 If count > 8000 Then Exit Do
4257             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
4258         Case Is = 3
4259            indexb3 = indexb3 + 1
4260             Do
4261                count = count + 1
4262                dc4 = Int(Rnd * 9 + 1)
4263                dc5 = Int(Rnd * 9 + 1)
4264                b3 = shobo(dc5, dc4)
4265                 If count > 8000 Then Exit Do
4266             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
4267         Case Is = 4
4268            indexb4 = indexb4 + 1
4269             Do
4270                count = count + 1
4271                dc4 = Int(Rnd * 9 + 1)
4272                dc5 = Int(Rnd * 9 + 1)
4273                b3 = shobo(dc5, dc4)
4274                 If count > 8000 Then Exit Do
4275             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
4276         Case Is = 5
4277            indexb5 = indexb5 + 1
4278             Do
4279                count = count + 1
4280                dc4 = Int(Rnd * 9 + 1)
4281                dc5 = Int(Rnd * 9 + 1)
4282                fb2x = dc4:fb2y = dc5
4283                b3 = shobo(dc5, dc4)
4284                 If count > 8000 Then Exit Do
4285             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
4286         Case Is = 6
4287            indexb6 = indexb6 + 1
4288             Do
4289                count = count + 1
4290                dc4 = Int(Rnd * 9 + 1)
4291                dc5 = Int(Rnd * 9 + 1)
4292                fb2x = dc4:fb2y = dc5
4293                b3 = shobo(dc5, dc4)
4294                 If count > 8000 Then Exit Do
4295             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
4296         Case Is = 7
4297            indexb7 = indexb7 + 1
4298            index = Int(Rnd * 2 + 1)
4299             If index = 1 Then dc4 = 1 Else dc4 = 9
4300             If indexb71 = 1 Then dc4 = 9
4301             If indexb72 = 1 Then dc4 = 1
4302             Do
4303                count = count + 1
4304                dc5 = Int(Rnd * 9 + 1)
4305                b3 = shobo(dc5, dc4)
4306                 If count > 8000 Then Exit Do
4307             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
4308         Case Is = 8
4309             Do
4310                count = count + 1
4311                dc4 = Int(Rnd * 9 + 1)
4312                dc5 = Int(Rnd * 9 + 1)
4313                b3 = shobo(dc5, dc4)
4314                 If count > 8000 Then Exit Do
4315             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2 Or dc5 < 3 Or dc5 > 7
4316         Case Is = 9
4317            indexb9 = indexb9 + 1
4318             Do
4319                count = count + 1
4320                dc4 = Int(Rnd * 9 + 1)
4321                dc5 = Int(Rnd * 9 + 1)
4322                b3 = shobo(dc5, dc4)
4323                 If count > 8000 Then Exit Do
4324             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
4325         Case Is = 10
4326            indexb10 = indexb10 + 1
4327             Do
4328                count = count + 1
4329                dc4 = Int(Rnd * 9 + 1)
4330                dc5 = Int(Rnd * 9 + 1)
4331                b3 = shobo(dc5, dc4)
4332                 If count > 8000 Then Exit Do
4333             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
4334         Case Is = 11
4335             Do
4336                count = count + 1
4337                dc4 = Int(Rnd * 9 + 1)
4338                dc5 = Int(Rnd * 9 + 1)
4339                b3 = shobo(dc5, dc4)
4340                 If count > 8000 Then Exit Do
4341             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
4342     End Select
4343
4344    w3 = shobo(dc2, dc1):b3 = shobo(dc5, dc4)
4345    fw3x = dc1:fw3y = dc2:fb3x = dc4:fb3y = dc5
4346    fw3 = dc3:fb3 = dc6
4347
4348    x = 20:y = 160:cf = 15
4349     If dc3 = 1 Then  king ()
4350     If dc3 = 2 Then  queen ()
4351     If dc3 = 3 Then  general ()
4352     If dc3 = 4 Then  bishop ()
4353     If dc3 = 5 Then  knight ()
4354     If dc3 = 6 Then  rook ()
4355     If dc3 = 7 Then  lance ()
4356     If dc3 = 8 Then  pawn ()
4357     If dc3 = 9 Then  horse ()
4358     If dc3 = 10 Then  dragon ()
4359     If dc3 = 11 Then  tokin ()
4360    x = 580:y = 160:cf = 0
4361     If dc6 = 1 Then  king ()
4362     If dc6 = 2 Then  queen ()
4363     If dc6 = 3 Then  general ()
4364     If dc6 = 4 Then  bishop ()
4365     If dc6 = 5 Then  knight ()
4366     If dc6 = 6 Then  rook ()
4367     If dc6 = 7 Then  lance ()
4368     If dc6 = 8 Then  pawn ()
4369     If dc6 = 9 Then  horse ()
4370     If dc6 = 10 Then  dragon ()
4371     If dc6 = 11 Then  tokin ()
4372    x = 20:y = 220
4373     If dc1 = 1 Then  letterA ()
4374     If dc1 = 2 Then  letterB ()
4375     If dc1 = 3 Then  letterC ()
4376     If dc1 = 4 Then  letterD ()
4377     If dc1 = 5 Then  letterE ()
4378     If dc1 = 6 Then  letterF ()
4379     If dc1 = 7 Then  letterG ()
4380     If dc1 = 8 Then  letterH ()
4381     If dc1 = 9 Then  letterI ()
4382    x = 20:y = 280
4383     If dc2 = 1 Then  letter1 ()
4384     If dc2 = 2 Then  letter2 ()
4385     If dc2 = 3 Then  letter3 ()
4386     If dc2 = 4 Then  letter4 ()
4387     If dc2 = 5 Then  letter5 ()
4388     If dc2 = 6 Then  letter6 ()
4389     If dc2 = 7 Then  letter7 ()
4390     If dc2 = 8 Then  letter8 ()
4391     If dc2 = 9 Then  letter9 ()
4392    x = 580:y = 220
4393     If dc4 = 1 Then  letterA ()
4394     If dc4 = 2 Then  letterB ()
4395     If dc4 = 3 Then  letterC ()
4396     If dc4 = 4 Then  letterD ()
4397     If dc4 = 5 Then  letterE ()
4398     If dc4 = 6 Then  letterF ()
4399     If dc4 = 7 Then  letterG ()
4400     If dc4 = 8 Then  letterH ()
4401     If dc4 = 9 Then  letterI ()
4402    x = 580:y = 280
4403     If dc5 = 1 Then  letter1 ()
4404     If dc5 = 2 Then  letter2 ()
4405     If dc5 = 3 Then  letter3 ()
4406     If dc5 = 4 Then  letter4 ()
4407     If dc5 = 5 Then  letter5 ()
4408     If dc5 = 6 Then  letter6 ()
4409     If dc5 = 7 Then  letter7 ()
4410     If dc5 = 8 Then  letter8 ()
4411     If dc5 = 9 Then  letter9 ()
4412    x = (dc1 * 40) + 100:y = Abs((dc2 * 40) - 480) - 60
4413    cf = 15
4414     If dc3 = 1 Then  king ()
4415     If dc3 = 2 Then  queen ()
4416     If dc3 = 3 Then  general ()
4417     If dc3 = 4 Then  bishop ()
4418     If dc3 = 5 Then  knight ()
4419     If dc3 = 6 Then  rook ()
4420     If dc3 = 7 Then  lance ()
4421     If dc3 = 8 Then  pawn ()
4422     If dc3 = 9 Then  horse ()
4423     If dc3 = 10 Then  dragon ()
4424     If dc3 = 11 Then  tokin ()
4425    x = (dc4 * 40) + 100:y = Abs((dc5 * 40) - 480) - 60
4426    cf = 0
4427     If dc6 = 1 Then  king ()
4428     If dc6 = 2 Then  queen ()
4429     If dc6 = 3 Then  general ()
4430     If dc6 = 4 Then  bishop ()
4431     If dc6 = 5 Then  knight ()
4432     If dc6 = 6 Then  rook ()
4433     If dc6 = 7 Then  lance ()
4434     If dc6 = 8 Then  pawn ()
4435     If dc6 = 9 Then  horse ()
4436     If dc6 = 10 Then  dragon ()
4437     If dc6 = 11 Then  tokin ()
4438
4439     Do
4440         Select Case InKey$
4441             Case Is = Chr$(32)
4442                 Exit Do
4443             Case Is = Chr$(13)
4444                  shogifen ()
4445             Case Is = Chr$(27)
4446                 End
4447         End Select
4448     Loop
4449
4450      dices ()
4451
4452     Rem 4th roll
4453    count = 0:index = 0
4454    dc1 = Int(Rnd * 9 + 1)
4455    dc2 = Int(Rnd * 9 + 1)
4456    dc3 = Int(Rnd * 10 + 2)
4457    dc4 = Int(Rnd * 9 + 1)
4458    dc5 = Int(Rnd * 9 + 1)
4459    dc6 = Int(Rnd * 10 + 2)
4460    w4 = shobo(dc2, dc1):b4 = shobo(dc5, dc4)
4461     If dc3 = 4 Then indexw4 = indexw4 + 1
4462     If dc3 = 6 Then indexw6 = indexw6 + 1
4463     If dc3 = 9 Then indexw9 = indexw9 + 1
4464     If dc3 = 10 Then indexw10 = indexw10 + 1
4465     If indexw4 > 1 Then
4466        dc3 = 8
4467        indexw4 = indexw4 - 1
4468     End If
4469     If indexw6 > 1 Then
4470        dc3 = 8
4471        indexw6 = indexw4 - 1
4472     End If
4473     If indexw9 > 1 Then
4474        dc3 = 8
4475        indexw9 = indexw4 - 1
4476     End If
4477     If indexw10 > 1 Then
4478        dc3 = 8
4479        indexw10 = indexw4 - 1
4480     End If
4481     If indexb4 > 1 Then
4482        dc6 = 8
4483        indexb4 = indexb4 - 1
4484     End If
4485     If indexb6 > 1 Then
4486        dc6 = 8
4487        indexb6 = indexb4 - 1
4488     End If
4489     If indexb9 > 1 Then
4490        dc6 = 8
4491        indexb9 = indexb4 - 1
4492     End If
4493     If indexb10 > 1 Then
4494        dc6 = 8
4495        indexb10 = indexb4 - 1
4496     End If
4497     If indexw3 > 2 Or indexw5 > 2 Or indexw7 > 2 Then dc3 = 8
4498     If indexb3 > 2 Or indexb5 > 2 Or indexb7 > 2 Then dc6 = 8
4499
4500     Select Case dc3
4501         Case Is = 1
4502             'Exit Case
4503         Case Is = 2
4504             Do
4505                count = count + 1
4506                dc1 = Int(Rnd * 9 + 1)
4507                dc2 = Int(Rnd * 9 + 1)
4508                w4 = shobo(dc2, dc1)
4509                 If count > 8000 Then Exit Do
4510             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
4511         Case Is = 3
4512             Do
4513                count = count + 1
4514                dc1 = Int(Rnd * 9 + 1)
4515                dc2 = Int(Rnd * 9 + 1)
4516                w4 = shobo(dc2, dc1)
4517                 If count > 8000 Then Exit Do
4518             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
4519         Case Is = 4
4520             Do
4521                count = count + 1
4522                dc1 = Int(Rnd * 9 + 1)
4523                dc2 = Int(Rnd * 9 + 1)
4524                w4 = shobo(dc2, dc1)
4525                 If count > 8000 Then Exit Do
4526             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
4527         Case Is = 5
4528             Do
4529                count = count + 1
4530                dc1 = Int(Rnd * 9 + 1)
4531                dc2 = Int(Rnd * 9 + 1)
4532                fw2x = dc1:fw2y = dc2
4533                w4 = shobo(dc2, dc1)
4534                 If count > 8000 Then Exit Do
4535             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
4536         Case Is = 6
4537             Do
4538                count = count + 1
4539                dc1 = Int(Rnd * 9 + 1)
4540                dc2 = Int(Rnd * 9 + 1)
4541                fw2x = dc1:fw2y = dc2
4542                w4 = shobo(dc2, dc1)
4543                 If count > 8000 Then Exit Do
4544             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
4545         Case Is = 7
4546            index = Int(Rnd * 2 + 1)
4547             If index = 1 Then dc1 = 1 Else dc1 = 9
4548             If indexw71 = 1 Then dc1 = 9
4549             If indexw72 = 1 Then dc1 = 1
4550             Do
4551                count = count + 1
4552                dc2 = Int(Rnd * 9 + 1)
4553                w4 = shobo(dc2, dc1)
4554                 If count > 8000 Then Exit Do
4555             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
4556         Case Is = 8
4557             Do
4558                count = count + 1
4559                dc1 = Int(Rnd * 9 + 1)
4560                dc2 = Int(Rnd * 9 + 1)
4561                w4 = shobo(dc2, dc1)
4562                 If count > 8000 Then Exit Do
4563             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3 Or dc2 < 3 Or dc2 > 7
4564         Case Is = 9
4565             Do
4566                count = count + 1
4567                dc1 = Int(Rnd * 9 + 1)
4568                dc2 = Int(Rnd * 9 + 1)
4569                w4 = shobo(dc2, dc1)
4570                 If count > 8000 Then Exit Do
4571             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
4572         Case Is = 10
4573             Do
4574                count = count + 1
4575                dc1 = Int(Rnd * 9 + 1)
4576                dc2 = Int(Rnd * 9 + 1)
4577                w4 = shobo(dc2, dc1)
4578                 If count > 8000 Then Exit Do
4579             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
4580         Case Is = 11
4581             Do
4582                count = count + 1
4583                dc1 = Int(Rnd * 9 + 1)
4584                dc2 = Int(Rnd * 9 + 1)
4585                w4 = shobo(dc2, dc1)
4586                 If count > 8000 Then Exit Do
4587             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
4588     End Select
4589     Select Case dc6
4590         Case Is = 1
4591             'Exit Case
4592         Case Is = 2
4593             Do
4594                count = count + 1
4595                dc4 = Int(Rnd * 9 + 1)
4596                dc5 = Int(Rnd * 9 + 1)
4597                b4 = shobo(dc5, dc4)
4598                 If count > 8000 Then Exit Do
4599             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
4600         Case Is = 3
4601             Do
4602                count = count + 1
4603                dc4 = Int(Rnd * 9 + 1)
4604                dc5 = Int(Rnd * 9 + 1)
4605                b4 = shobo(dc5, dc4)
4606                 If count > 8000 Then Exit Do
4607             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
4608         Case Is = 4
4609             Do
4610                count = count + 1
4611                dc4 = Int(Rnd * 9 + 1)
4612                dc5 = Int(Rnd * 9 + 1)
4613                b4 = shobo(dc5, dc4)
4614                 If count > 8000 Then Exit Do
4615             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
4616         Case Is = 5
4617             Do
4618                count = count + 1
4619                dc4 = Int(Rnd * 9 + 1)
4620                dc5 = Int(Rnd * 9 + 1)
4621                fb2x = dc4:fb2y = dc5
4622                b4 = shobo(dc5, dc4)
4623                 If count > 8000 Then Exit Do
4624             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
4625         Case Is = 6
4626             Do
4627                count = count + 1
4628                dc4 = Int(Rnd * 9 + 1)
4629                dc5 = Int(Rnd * 9 + 1)
4630                fb2x = dc4:fb2y = dc5
4631                b4 = shobo(dc5, dc4)
4632                 If count > 8000 Then Exit Do
4633             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
4634         Case Is = 7
4635            index = Int(Rnd * 2 + 1)
4636             If index = 1 Then dc4 = 1 Else dc4 = 9
4637             If indexb71 = 1 Then dc4 = 9
4638             If indexb72 = 1 Then dc4 = 1
4639             Do
4640                count = count + 1
4641                dc5 = Int(Rnd * 9 + 1)
4642                b4 = shobo(dc5, dc4)
4643                 If count > 8000 Then Exit Do
4644             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
4645         Case Is = 8
4646             Do
4647                count = count + 1
4648                dc4 = Int(Rnd * 9 + 1)
4649                dc5 = Int(Rnd * 9 + 1)
4650                b4 = shobo(dc5, dc4)
4651                 If count > 8000 Then Exit Do
4652             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3 Or dc5 < 3 Or dc5 > 7
4653         Case Is = 9
4654             Do
4655                count = count + 1
4656                dc4 = Int(Rnd * 9 + 1)
4657                dc5 = Int(Rnd * 9 + 1)
4658                b4 = shobo(dc5, dc4)
4659                 If count > 8000 Then Exit Do
4660             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
4661         Case Is = 10
4662             Do
4663                count = count + 1
4664                dc4 = Int(Rnd * 9 + 1)
4665                dc5 = Int(Rnd * 9 + 1)
4666                b4 = shobo(dc5, dc4)
4667                 If count > 8000 Then Exit Do
4668             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
4669         Case Is = 11
4670             Do
4671                count = count + 1
4672                dc4 = Int(Rnd * 9 + 1)
4673                dc5 = Int(Rnd * 9 + 1)
4674                b4 = shobo(dc5, dc4)
4675                 If count > 8000 Then Exit Do
4676             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
4677     End Select
4678
4679    w4 = shobo(dc2, dc1):b4 = shobo(dc5, dc4)
4680    fw4x = dc1:fw4y = dc2:fb4x = dc4:fb4y = dc5
4681    fw4 = dc3:fb4 = dc6
4682
4683    x = 20:y = 160:cf = 15
4684     If dc3 = 1 Then  king ()
4685     If dc3 = 2 Then  queen ()
4686     If dc3 = 3 Then  general ()
4687     If dc3 = 4 Then  bishop ()
4688     If dc3 = 5 Then  knight ()
4689     If dc3 = 6 Then  rook ()
4690     If dc3 = 7 Then  lance ()
4691     If dc3 = 8 Then  pawn ()
4692     If dc3 = 9 Then  horse ()
4693     If dc3 = 10 Then  dragon ()
4694     If dc3 = 11 Then  tokin ()
4695    x = 580:y = 160:cf = 0
4696     If dc6 = 1 Then  king ()
4697     If dc6 = 2 Then  queen ()
4698     If dc6 = 3 Then  general ()
4699     If dc6 = 4 Then  bishop ()
4700     If dc6 = 5 Then  knight ()
4701     If dc6 = 6 Then  rook ()
4702     If dc6 = 7 Then  lance ()
4703     If dc6 = 8 Then  pawn ()
4704     If dc6 = 9 Then  horse ()
4705     If dc6 = 10 Then  dragon ()
4706     If dc6 = 11 Then  tokin ()
4707    x = 20:y = 220
4708     If dc1 = 1 Then  letterA ()
4709     If dc1 = 2 Then  letterB ()
4710     If dc1 = 3 Then  letterC ()
4711     If dc1 = 4 Then  letterD ()
4712     If dc1 = 5 Then  letterE ()
4713     If dc1 = 6 Then  letterF ()
4714     If dc1 = 7 Then  letterG ()
4715     If dc1 = 8 Then  letterH ()
4716     If dc1 = 9 Then  letterI ()
4717    x = 20:y = 280
4718     If dc2 = 1 Then  letter1 ()
4719     If dc2 = 2 Then  letter2 ()
4720     If dc2 = 3 Then  letter3 ()
4721     If dc2 = 4 Then  letter4 ()
4722     If dc2 = 5 Then  letter5 ()
4723     If dc2 = 6 Then  letter6 ()
4724     If dc2 = 7 Then  letter7 ()
4725     If dc2 = 8 Then  letter8 ()
4726     If dc2 = 9 Then  letter9 ()
4727    x = 580:y = 220
4728     If dc4 = 1 Then  letterA ()
4729     If dc4 = 2 Then  letterB ()
4730     If dc4 = 3 Then  letterC ()
4731     If dc4 = 4 Then  letterD ()
4732     If dc4 = 5 Then  letterE ()
4733     If dc4 = 6 Then  letterF ()
4734     If dc4 = 7 Then  letterG ()
4735     If dc4 = 8 Then  letterH ()
4736     If dc4 = 9 Then  letterI ()
4737    x = 580:y = 280
4738     If dc5 = 1 Then  letter1 ()
4739     If dc5 = 2 Then  letter2 ()
4740     If dc5 = 3 Then  letter3 ()
4741     If dc5 = 4 Then  letter4 ()
4742     If dc5 = 5 Then  letter5 ()
4743     If dc5 = 6 Then  letter6 ()
4744     If dc5 = 7 Then  letter7 ()
4745     If dc5 = 8 Then  letter8 ()
4746     If dc5 = 9 Then  letter9 ()
4747    x = (dc1 * 40) + 100:y = Abs((dc2 * 40) - 480) - 60
4748    cf = 15
4749     If dc3 = 1 Then  king ()
4750     If dc3 = 2 Then  queen ()
4751     If dc3 = 3 Then  general ()
4752     If dc3 = 4 Then  bishop ()
4753     If dc3 = 5 Then  knight ()
4754     If dc3 = 6 Then  rook ()
4755     If dc3 = 7 Then  lance ()
4756     If dc3 = 8 Then  pawn ()
4757     If dc3 = 9 Then  horse ()
4758     If dc3 = 10 Then  dragon ()
4759     If dc3 = 11 Then  tokin ()
4760    x = (dc4 * 40) + 100:y = Abs((dc5 * 40) - 480) - 60
4761    cf = 0
4762     If dc6 = 1 Then  king ()
4763     If dc6 = 2 Then  queen ()
4764     If dc6 = 3 Then  general ()
4765     If dc6 = 4 Then  bishop ()
4766     If dc6 = 5 Then  knight ()
4767     If dc6 = 6 Then  rook ()
4768     If dc6 = 7 Then  lance ()
4769     If dc6 = 8 Then  pawn ()
4770     If dc6 = 9 Then  horse ()
4771     If dc6 = 10 Then  dragon ()
4772     If dc6 = 11 Then  tokin ()
4773
4774     Do
4775         Select Case InKey$
4776             Case Is = Chr$(32)
4777                 'Exit Case
4778             Case Is = Chr$(13)
4779                  shogifen ()
4780             Case Is = Chr$(27)
4781                 End
4782         End Select
4783     Loop
4784
4785 End Sub
4786
4787 Sub draughts ()
4788
4789     Rem 1st roll
4790    count = 0:index = 0
4791    dc1 = Int(Rnd * 10 + 1)
4792    dc2 = Int(Rnd * 10 + 1)
4793    dc3 = Int(Rnd * 2 + 1)
4794    dc4 = Int(Rnd * 10 + 1)
4795    dc5 = Int(Rnd * 10 + 1)
4796    dc6 = Int(Rnd * 2 + 1)
4797    w1 = drabo(dc2, dc1):b1 = drabo(dc5, dc4)
4798
4799     Do
4800         Do
4801            count = count + 1
4802            dc1 = Int(Rnd * 8 + 1)
4803            dc2 = Int(Rnd * 8 + 1)
4804            dc4 = Int(Rnd * 8 + 1)
4805            dc5 = Int(Rnd * 8 + 1)
4806            w1 = drabo(dc2, dc1):b1 = drabo(dc5, dc4)
4807             If count > 8000 Then Exit Do
4808         Loop Until w1 Mod 2 <> 0 And b1 Mod 2 <> 0
4809        count = count + 1
4810         If count > 8000 Then Exit Do
4811     Loop While w1 = b1
4812
4813    w1 = drabo(dc2, dc1):b1 = drabo(dc5, dc4)
4814    fw1x = dc1:fw1y = dc2:fb1x = dc4:fb1y = dc5
4815    fw1 = dc3:fb1 = dc6
4816    x = 20:y = 160:cf = 15
4817     If dc3 = 1 Then  dame ()
4818     If dc3 = 2 Then  checker ()
4819    x = 580:y = 160:cf = 0
4820     If dc6 = 1 Then  dame ()
4821     If dc6 = 2 Then  checker ()
4822    x = 20:y = 220
4823     If dc1 = 1 Then  letterA ()
4824     If dc1 = 2 Then  letterB ()
4825     If dc1 = 3 Then  letterC ()
4826     If dc1 = 4 Then  letterD ()
4827     If dc1 = 5 Then  letterE ()
4828     If dc1 = 6 Then  letterF ()
4829     If dc1 = 7 Then  letterG ()
4830     If dc1 = 8 Then  letterH ()
4831     If dc1 = 9 Then  letterI ()
4832     If dc1 = 10 Then  letterJ ()
4833    x = 20:y = 280
4834     If dc2 = 1 Then  letter1 ()
4835     If dc2 = 2 Then  letter2 ()
4836     If dc2 = 3 Then  letter3 ()
4837     If dc2 = 4 Then  letter4 ()
4838     If dc2 = 5 Then  letter5 ()
4839     If dc2 = 6 Then  letter6 ()
4840     If dc2 = 7 Then  letter7 ()
4841     If dc2 = 8 Then  letter8 ()
4842     If dc2 = 9 Then  letter9 ()
4843     If dc2 = 10 Then  letter0 ()
4844    x = 580:y = 220
4845     If dc4 = 1 Then  letterA ()
4846     If dc4 = 2 Then  letterB ()
4847     If dc4 = 3 Then  letterC ()
4848     If dc4 = 4 Then  letterD ()
4849     If dc4 = 5 Then  letterE ()
4850     If dc4 = 6 Then  letterF ()
4851     If dc4 = 7 Then  letterG ()
4852     If dc4 = 8 Then  letterH ()
4853     If dc4 = 9 Then  letterI ()
4854     If dc4 = 10 Then  letterJ ()
4855    x = 580:y = 280
4856     If dc5 = 1 Then  letter1 ()
4857     If dc5 = 2 Then  letter2 ()
4858     If dc5 = 3 Then  letter3 ()
4859     If dc5 = 4 Then  letter4 ()
4860     If dc5 = 5 Then  letter5 ()
4861     If dc5 = 6 Then  letter6 ()
4862     If dc5 = 7 Then  letter7 ()
4863     If dc5 = 8 Then  letter8 ()
4864     If dc5 = 9 Then  letter9 ()
4865     If dc5 = 10 Then  letter0 ()
4866    x = (dc1 * 40) + 80:y = Abs((dc2 * 40) - 480) - 40
4867    cf = 15
4868     If dc3 = 1 Then  dame ()
4869     If dc3 = 2 Then  checker ()
4870    x = (dc4 * 40) + 80:y = Abs((dc5 * 40) - 480) - 40
4871    cf = 0
4872     If dc6 = 1 Then  dame ()
4873     If dc6 = 2 Then  checker ()
4874
4875     Do
4876         Select Case InKey$
4877             Case Is = Chr$(32)
4878                 Exit Do
4879             Case Is = Chr$(13)
4880                  draughtsfen ()
4881             Case Is = Chr$(27)
4882                 End
4883         End Select
4884     Loop
4885
4886      dices ()
4887
4888     Rem 2nd roll
4889    count = 0:index = 0
4890    dc1 = Int(Rnd * 10 + 1)
4891    dc2 = Int(Rnd * 10 + 1)
4892    dc3 = Int(Rnd * 2 + 1)
4893    dc4 = Int(Rnd * 10 + 1)
4894    dc5 = Int(Rnd * 10 + 1)
4895    dc6 = Int(Rnd * 2 + 1)
4896    w2 = drabo(dc2, dc1):b2 = drabo(dc5, dc4)
4897
4898     Select Case dc3
4899         Case Is = 1
4900             Do
4901                 Do
4902                    count = count + 1
4903                    dc1 = Int(Rnd * 10 + 1)
4904                    dc2 = Int(Rnd * 10 + 1)
4905                    w2 = drabo(dc2, dc1)
4906                     If count > 8000 Then Exit Do
4907                 Loop Until w2 Mod 2 <> 0
4908                count = count + 1
4909                 If count > 8000 Then Exit Do
4910             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
4911         Case Is = 2
4912             Do
4913                 Do
4914                    count = count + 1
4915                    dc1 = Int(Rnd * 10 + 1)
4916                    dc2 = Int(Rnd * 10 + 1)
4917                    w2 = drabo(dc2, dc1)
4918                     If count > 8000 Then Exit Do
4919                 Loop Until w2 Mod 2 <> 0
4920                count = count + 1
4921                 If count > 8000 Then Exit Do
4922             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
4923     End Select
4924     Select Case dc6
4925         Case Is = 1
4926             Do
4927                 Do
4928                    count = count + 1
4929                    dc4 = Int(Rnd * 10 + 1)
4930                    dc5 = Int(Rnd * 10 + 1)
4931                    b2 = drabo(dc5, dc4)
4932                     If count > 8000 Then Exit Do
4933                 Loop Until b2 Mod 2 <> 0
4934                count = count + 1
4935                 If count > 8000 Then Exit Do
4936             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
4937         Case Is = 2
4938             Do
4939                 Do
4940                    count = count + 1
4941                    dc4 = Int(Rnd * 10 + 1)
4942                    dc5 = Int(Rnd * 10 + 1)
4943                    b2 = drabo(dc5, dc4)
4944                     If count > 8000 Then Exit Do
4945                 Loop Until b2 Mod 2 <> 0
4946                count = count + 1
4947                 If count > 8000 Then Exit Do
4948             Loop While w2 = w1 Or w2 = b1 Or w2 = b2 Or b2 = w1 Or b2 = b1
4949     End Select
4950
4951    w2 = drabo(dc2, dc1):b2 = drabo(dc5, dc4)
4952    fw2x = dc1:fw2y = dc2:fb2x = dc4:fb2y = dc5
4953    fw2 = dc3:fb2 = dc6
4954
4955    x = 20:y = 160:cf = 15
4956     If dc3 = 1 Then  dame ()
4957     If dc3 = 2 Then  checker ()
4958    x = 580:y = 160:cf = 0
4959     If dc6 = 1 Then  dame ()
4960     If dc6 = 2 Then  checker ()
4961    x = 20:y = 220
4962     If dc1 = 1 Then  letterA ()
4963     If dc1 = 2 Then  letterB ()
4964     If dc1 = 3 Then  letterC ()
4965     If dc1 = 4 Then  letterD ()
4966     If dc1 = 5 Then  letterE ()
4967     If dc1 = 6 Then  letterF ()
4968     If dc1 = 7 Then  letterG ()
4969     If dc1 = 8 Then  letterH ()
4970     If dc1 = 9 Then  letterI ()
4971     If dc1 = 10 Then  letterJ ()
4972    x = 20:y = 280
4973     If dc2 = 1 Then  letter1 ()
4974     If dc2 = 2 Then  letter2 ()
4975     If dc2 = 3 Then  letter3 ()
4976     If dc2 = 4 Then  letter4 ()
4977     If dc2 = 5 Then  letter5 ()
4978     If dc2 = 6 Then  letter6 ()
4979     If dc2 = 7 Then  letter7 ()
4980     If dc2 = 8 Then  letter8 ()
4981     If dc2 = 9 Then  letter9 ()
4982     If dc2 = 10 Then  letter0 ()
4983    x = 580:y = 220
4984     If dc4 = 1 Then  letterA ()
4985     If dc4 = 2 Then  letterB ()
4986     If dc4 = 3 Then  letterC ()
4987     If dc4 = 4 Then  letterD ()
4988     If dc4 = 5 Then  letterE ()
4989     If dc4 = 6 Then  letterF ()
4990     If dc4 = 7 Then  letterG ()
4991     If dc4 = 8 Then  letterH ()
4992     If dc4 = 9 Then  letterI ()
4993     If dc4 = 10 Then  letterJ ()
4994    x = 580:y = 280
4995     If dc5 = 1 Then  letter1 ()
4996     If dc5 = 2 Then  letter2 ()
4997     If dc5 = 3 Then  letter3 ()
4998     If dc5 = 4 Then  letter4 ()
4999     If dc5 = 5 Then  letter5 ()
5000     If dc5 = 6 Then  letter6 ()
5001     If dc5 = 7 Then  letter7 ()
5002     If dc5 = 8 Then  letter8 ()
5003     If dc5 = 9 Then  letter9 ()
5004     If dc5 = 10 Then  letter0 ()
5005    x = (dc1 * 40) + 80:y = Abs((dc2 * 40) - 480) - 40
5006    cf = 15
5007     If dc3 = 1 Then  dame ()
5008     If dc3 = 2 Then  checker ()
5009    x = (dc4 * 40) + 80:y = Abs((dc5 * 40) - 480) - 40
5010    cf = 0
5011     If dc6 = 1 Then  dame ()
5012     If dc6 = 2 Then  checker ()
5013
5014     Do
5015         Select Case InKey$
5016             Case Is = Chr$(32)
5017                 Exit Do
5018             Case Is = Chr$(13)
5019                  draughtsfen ()
5020             Case Is = Chr$(27)
5021                 End
5022         End Select
5023     Loop
5024
5025      dices ()
5026
5027     Rem 3rd roll
5028    count = 0:index = 0
5029    dc1 = Int(Rnd * 10 + 1)
5030    dc2 = Int(Rnd * 10 + 1)
5031    dc3 = Int(Rnd * 2 + 1)
5032    dc4 = Int(Rnd * 10 + 1)
5033    dc5 = Int(Rnd * 10 + 1)
5034    dc6 = Int(Rnd * 2 + 1)
5035    w3 = drabo(dc2, dc1):b3 = drabo(dc5, dc4)
5036
5037     Select Case dc3
5038         Case Is = 1
5039             Do
5040                 Do
5041                    count = count + 1
5042                    dc1 = Int(Rnd * 10 + 1)
5043                    dc2 = Int(Rnd * 10 + 1)
5044                    w3 = drabo(dc2, dc1)
5045                     If count > 8000 Then Exit Do
5046                 Loop Until w3 Mod 2 <> 0
5047                count = count + 1
5048                 If count > 8000 Then Exit Do
5049             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
5050         Case Is = 2
5051             Do
5052                 Do
5053                    count = count + 1
5054                    dc1 = Int(Rnd * 10 + 1)
5055                    dc2 = Int(Rnd * 10 + 1)
5056                    w3 = drabo(dc2, dc1)
5057                     If count > 8000 Then Exit Do
5058                 Loop Until w3 Mod 2 <> 0
5059                count = count + 1
5060                 If count > 8000 Then Exit Do
5061             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
5062     End Select
5063     Select Case dc6
5064         Case Is = 1
5065             Do
5066                 Do
5067                    count = count + 1
5068                    dc4 = Int(Rnd * 10 + 1)
5069                    dc5 = Int(Rnd * 10 + 1)
5070                    b3 = drabo(dc5, dc4)
5071                     If count > 8000 Then Exit Do
5072                 Loop Until b3 Mod 2 <> 0
5073                count = count + 1
5074                 If count > 8000 Then Exit Do
5075             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
5076         Case Is = 2
5077             Do
5078                 Do
5079                    count = count + 1
5080                    dc4 = Int(Rnd * 10 + 1)
5081                    dc5 = Int(Rnd * 10 + 1)
5082                    b3 = drabo(dc5, dc4)
5083                     If count > 8000 Then Exit Do
5084                 Loop Until b3 Mod 2 <> 0
5085                count = count + 1
5086                 If count > 8000 Then Exit Do
5087             Loop While w3 = w1 Or w3 = w2 Or w3 = b1 Or w3 = b2 Or w3 = b3 Or b3 = w1 Or b3 = w2 Or b3 = b1 Or b3 = b2
5088     End Select
5089
5090    w3 = drabo(dc2, dc1):b3 = drabo(dc5, dc4)
5091    fw3x = dc1:fw3y = dc2:fb3x = dc4:fb3y = dc5
5092    fw3 = dc3:fb3 = dc6
5093
5094    x = 20:y = 160:cf = 15
5095     If dc3 = 1 Then  dame ()
5096     If dc3 = 2 Then  checker ()
5097    x = 580:y = 160:cf = 0
5098     If dc6 = 1 Then  dame ()
5099     If dc6 = 2 Then  checker ()
5100    x = 20:y = 220
5101     If dc1 = 1 Then  letterA ()
5102     If dc1 = 2 Then  letterB ()
5103     If dc1 = 3 Then  letterC ()
5104     If dc1 = 4 Then  letterD ()
5105     If dc1 = 5 Then  letterE ()
5106     If dc1 = 6 Then  letterF ()
5107     If dc1 = 7 Then  letterG ()
5108     If dc1 = 8 Then  letterH ()
5109     If dc1 = 9 Then  letterI ()
5110     If dc1 = 10 Then  letterJ ()
5111    x = 20:y = 280
5112     If dc2 = 1 Then  letter1 ()
5113     If dc2 = 2 Then  letter2 ()
5114     If dc2 = 3 Then  letter3 ()
5115     If dc2 = 4 Then  letter4 ()
5116     If dc2 = 5 Then  letter5 ()
5117     If dc2 = 6 Then  letter6 ()
5118     If dc2 = 7 Then  letter7 ()
5119     If dc2 = 8 Then  letter8 ()
5120     If dc2 = 9 Then  letter9 ()
5121     If dc2 = 10 Then  letter0 ()
5122    x = 580:y = 220
5123     If dc4 = 1 Then  letterA ()
5124     If dc4 = 2 Then  letterB ()
5125     If dc4 = 3 Then  letterC ()
5126     If dc4 = 4 Then  letterD ()
5127     If dc4 = 5 Then  letterE ()
5128     If dc4 = 6 Then  letterF ()
5129     If dc4 = 7 Then  letterG ()
5130     If dc4 = 8 Then  letterH ()
5131     If dc4 = 9 Then  letterI ()
5132     If dc4 = 10 Then  letterJ ()
5133    x = 580:y = 280
5134     If dc5 = 1 Then  letter1 ()
5135     If dc5 = 2 Then  letter2 ()
5136     If dc5 = 3 Then  letter3 ()
5137     If dc5 = 4 Then  letter4 ()
5138     If dc5 = 5 Then  letter5 ()
5139     If dc5 = 6 Then  letter6 ()
5140     If dc5 = 7 Then  letter7 ()
5141     If dc5 = 8 Then  letter8 ()
5142     If dc5 = 9 Then  letter9 ()
5143     If dc5 = 10 Then  letter0 ()
5144    x = (dc1 * 40) + 80:y = Abs((dc2 * 40) - 480) - 40
5145    cf = 15
5146     If dc3 = 1 Then  dame ()
5147     If dc3 = 2 Then  checker ()
5148    x = (dc4 * 40) + 80:y = Abs((dc5 * 40) - 480) - 40
5149    cf = 0
5150     If dc6 = 1 Then  dame ()
5151     If dc6 = 2 Then  checker ()
5152
5153     Do
5154         Select Case InKey$
5155             Case Is = Chr$(32)
5156                 Exit Do
5157             Case Is = Chr$(13)
5158                  draughtsfen ()
5159             Case Is = Chr$(27)
5160                 End
5161         End Select
5162     Loop
5163
5164      dices ()
5165
5166     Rem 4th roll
5167    count = 0:index = 0
5168    dc1 = Int(Rnd * 10 + 1)
5169    dc2 = Int(Rnd * 10 + 1)
5170    dc3 = Int(Rnd * 2 + 1)
5171    dc4 = Int(Rnd * 10 + 1)
5172    dc5 = Int(Rnd * 10 + 1)
5173    dc6 = Int(Rnd * 2 + 1)
5174    w4 = drabo(dc2, dc1):b4 = drabo(dc5, dc4)
5175
5176     Select Case dc3
5177         Case Is = 1
5178             Do
5179                 Do
5180                    count = count + 1
5181                    dc1 = Int(Rnd * 10 + 1)
5182                    dc2 = Int(Rnd * 10 + 1)
5183                    w4 = drabo(dc2, dc1)
5184                     If count > 8000 Then Exit Do
5185                 Loop Until w4 Mod 2 <> 0
5186                count = count + 1
5187                 If count > 8000 Then Exit Do
5188             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
5189         Case Is = 2
5190             Do
5191                 Do
5192                    count = count + 1
5193                    dc1 = Int(Rnd * 10 + 1)
5194                    dc2 = Int(Rnd * 10 + 1)
5195                    w4 = drabo(dc2, dc1)
5196                     If count > 8000 Then Exit Do
5197                 Loop Until w4 Mod 2 <> 0
5198                count = count + 1
5199                 If count > 8000 Then Exit Do
5200             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
5201     End Select
5202     Select Case dc6
5203         Case Is = 1
5204             Do
5205                 Do
5206                    count = count + 1
5207                    dc4 = Int(Rnd * 10 + 1)
5208                    dc5 = Int(Rnd * 10 + 1)
5209                    b4 = drabo(dc5, dc4)
5210                     If count > 8000 Then Exit Do
5211                 Loop Until b4 Mod 2 <> 0
5212                count = count + 1
5213                 If count > 8000 Then Exit Do
5214             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
5215         Case Is = 2
5216             Do
5217                 Do
5218                    count = count + 1
5219                    dc4 = Int(Rnd * 10 + 1)
5220                    dc5 = Int(Rnd * 10 + 1)
5221                    b4 = drabo(dc5, dc4)
5222                     If count > 8000 Then Exit Do
5223                 Loop Until b4 Mod 2 <> 0
5224                count = count + 1
5225                 If count > 8000 Then Exit Do
5226             Loop While w4 = w1 Or w4 = w2 Or w4 = w3 Or w4 = b1 Or w4 = b2 Or w4 = b3 Or w4 = b4 Or b4 = w1 Or b4 = w2 Or b4 = w3 Or b4 = b1 Or b4 = b2 Or b4 = b3
5227     End Select
5228
5229    w4 = drabo(dc2, dc1):b4 = drabo(dc5, dc4)
5230    fw4x = dc1:fw4y = dc2:fb4x = dc4:fb4y = dc5
5231    fw4 = dc3:fb4 = dc6
5232
5233    x = 20:y = 160:cf = 15
5234     If dc3 = 1 Then  dame ()
5235     If dc3 = 2 Then  checker ()
5236    x = 580:y = 160:cf = 0
5237     If dc6 = 1 Then  dame ()
5238     If dc6 = 2 Then  checker ()
5239    x = 20:y = 220
5240     If dc1 = 1 Then  letterA ()
5241     If dc1 = 2 Then  letterB ()
5242     If dc1 = 3 Then  letterC ()
5243     If dc1 = 4 Then  letterD ()
5244     If dc1 = 5 Then  letterE ()
5245     If dc1 = 6 Then  letterF ()
5246     If dc1 = 7 Then  letterG ()
5247     If dc1 = 8 Then  letterH ()
5248     If dc1 = 9 Then  letterI ()
5249     If dc1 = 10 Then  letterJ ()
5250    x = 20:y = 280
5251     If dc2 = 1 Then  letter1 ()
5252     If dc2 = 2 Then  letter2 ()
5253     If dc2 = 3 Then  letter3 ()
5254     If dc2 = 4 Then  letter4 ()
5255     If dc2 = 5 Then  letter5 ()
5256     If dc2 = 6 Then  letter6 ()
5257     If dc2 = 7 Then  letter7 ()
5258     If dc2 = 8 Then  letter8 ()
5259     If dc2 = 9 Then  letter9 ()
5260     If dc2 = 10 Then  letter0 ()
5261    x = 580:y = 220
5262     If dc4 = 1 Then  letterA ()
5263     If dc4 = 2 Then  letterB ()
5264     If dc4 = 3 Then  letterC ()
5265     If dc4 = 4 Then  letterD ()
5266     If dc4 = 5 Then  letterE ()
5267     If dc4 = 6 Then  letterF ()
5268     If dc4 = 7 Then  letterG ()
5269     If dc4 = 8 Then  letterH ()
5270     If dc4 = 9 Then  letterI ()
5271     If dc4 = 10 Then  letterJ ()
5272    x = 580:y = 280
5273     If dc5 = 1 Then  letter1 ()
5274     If dc5 = 2 Then  letter2 ()
5275     If dc5 = 3 Then  letter3 ()
5276     If dc5 = 4 Then  letter4 ()
5277     If dc5 = 5 Then  letter5 ()
5278     If dc5 = 6 Then  letter6 ()
5279     If dc5 = 7 Then  letter7 ()
5280     If dc5 = 8 Then  letter8 ()
5281     If dc5 = 9 Then  letter9 ()
5282     If dc5 = 10 Then  letter0 ()
5283    x = (dc1 * 40) + 80:y = Abs((dc2 * 40) - 480) - 40
5284    cf = 15
5285     If dc3 = 1 Then  dame ()
5286     If dc3 = 2 Then  checker ()
5287    x = (dc4 * 40) + 80:y = Abs((dc5 * 40) - 480) - 40
5288    cf = 0
5289     If dc6 = 1 Then  dame ()
5290     If dc6 = 2 Then  checker ()
5291
5292     Do
5293         Select Case InKey$
5294             Case Is = Chr$(32)
5295                 'Exit Case
5296             Case Is = Chr$(13)
5297                  draughtsfen ()
5298             Case Is = Chr$(27)
5299                 End
5300         End Select
5301     Loop
5302
5303 End Sub
5304
5305 Sub chessfen ()
5306
5307     Rem Forsyth-Edwards notation
5308
5309     If fw1 = 1 Then fig1w$ = "K"
5310     If fw1 = 2 Then fig1w$ = "Q"
5311     If fw1 = 3 Then fig1w$ = "B"
5312     If fw1 = 4 Then fig1w$ = "N"
5313     If fw1 = 5 Then fig1w$ = "R"
5314     If fw1 = 6 Then fig1w$ = "P"
5315
5316     If fb1 = 1 Then fig1b$ = "k"
5317     If fb1 = 2 Then fig1b$ = "q"
5318     If fb1 = 3 Then fig1b$ = "b"
5319     If fb1 = 4 Then fig1b$ = "n"
5320     If fb1 = 5 Then fig1b$ = "r"
5321     If fb1 = 6 Then fig1b$ = "p"
5322
5323     If fw2 = 1 Then fig2w$ = "K"
5324     If fw2 = 2 Then fig2w$ = "Q"
5325     If fw2 = 3 Then fig2w$ = "B"
5326     If fw2 = 4 Then fig2w$ = "N"
5327     If fw2 = 5 Then fig2w$ = "R"
5328     If fw2 = 6 Then fig2w$ = "P"
5329
5330     If fb2 = 1 Then fig2b$ = "k"
5331     If fb2 = 2 Then fig2b$ = "q"
5332     If fb2 = 3 Then fig2b$ = "b"
5333     If fb2 = 4 Then fig2b$ = "n"
5334     If fb2 = 5 Then fig2b$ = "r"
5335     If fb2 = 6 Then fig2b$ = "p"
5336
5337     If fw3 = 1 Then fig3w$ = "K"
5338     If fw3 = 2 Then fig3w$ = "Q"
5339     If fw3 = 3 Then fig3w$ = "B"
5340     If fw3 = 4 Then fig3w$ = "N"
5341     If fw3 = 5 Then fig3w$ = "R"
5342     If fw3 = 6 Then fig3w$ = "P"
5343
5344     If fb3 = 1 Then fig3b$ = "k"
5345     If fb3 = 2 Then fig3b$ = "q"
5346     If fb3 = 3 Then fig3b$ = "b"
5347     If fb3 = 4 Then fig3b$ = "n"
5348     If fb3 = 5 Then fig3b$ = "r"
5349     If fb3 = 6 Then fig3b$ = "p"
5350
5351     If fw4 = 1 Then fig4w$ = "K"
5352     If fw4 = 2 Then fig4w$ = "Q"
5353     If fw4 = 3 Then fig4w$ = "B"
5354     If fw4 = 4 Then fig4w$ = "N"
5355     If fw4 = 5 Then fig4w$ = "R"
5356     If fw4 = 6 Then fig4w$ = "P"
5357
5358     If fb4 = 1 Then fig4b$ = "k"
5359     If fb4 = 2 Then fig4b$ = "q"
5360     If fb4 = 3 Then fig4b$ = "b"
5361     If fb4 = 4 Then fig4b$ = "n"
5362     If fb4 = 5 Then fig4b$ = "r"
5363     If fb4 = 6 Then fig4b$ = "p"
5364
5365     Dim table(8, 8) As String
5366    table(fw1y, fw1x) = fig1w$
5367    table(fb1y, fb1x) = fig1b$
5368    table(fw2y, fw2x) = fig2w$
5369    table(fb2y, fb2x) = fig2b$
5370    table(fw3y, fw3x) = fig3w$
5371    table(fb3y, fb3x) = fig3b$
5372    table(fw4y, fw4x) = fig4w$
5373    table(fb4y, fb4x) = fig4b$
5374     For row = 1 To 8: For col = 1 To 8
5375         If table(row, col) = "" Then table(row, col) = "+"
5376     Next col: Next row
5377
5378    mas1$ = table(1, 1) + table(1, 2) + table(1, 3) + table(1, 4) + table(1, 5) + table(1, 6) + table(1, 7) + table(1, 8)
5379    lin1$ = ""
5380    count = 0
5381     For index = 1 To 8
5382         If index = 8 And Mid$(mas1$, index, 1) = "+" Then
5383             count = count + 1
5384             lin1$ = lin1$ + LTrim$(Str$(count))
5385         End If
5386         If index < 8 And Mid$(mas1$, index, 1) = "+" Then
5387             count = count + 1
5388         End If
5389         If Mid$(mas1$, index, 1) <> "+" And count = 0 Then
5390             lin1$ = lin1$ + Mid$(mas1$, index, 1)
5391         End If
5392         If Mid$(mas1$, index, 1) <> "+" And count > 0 Then
5393             lin1$ = lin1$ + LTrim$(Str$(count))
5394             lin1$ = lin1$ + Mid$(mas1$, index, 1)
5395            count = 0
5396         End If
5397     Next index
5398
5399    mas2$ = table(2, 1) + table(2, 2) + table(2, 3) + table(2, 4) + table(2, 5) + table(2, 6) + table(2, 7) + table(2, 8)
5400    lin2$ = ""
5401    count = 0
5402     For index = 1 To 8
5403         If index = 8 And Mid$(mas2$, index, 1) = "+" Then
5404             count = count + 1
5405             lin2$ = lin2$ + LTrim$(Str$(count))
5406         End If
5407         If index < 8 And Mid$(mas2$, index, 1) = "+" Then
5408             count = count + 1
5409         End If
5410         If Mid$(mas2$, index, 1) <> "+" And count = 0 Then
5411             lin2$ = lin2$ + Mid$(mas2$, index, 1)
5412         End If
5413         If Mid$(mas2$, index, 1) <> "+" And count > 0 Then
5414             lin2$ = lin2$ + LTrim$(Str$(count))
5415             lin2$ = lin2$ + Mid$(mas2$, index, 1)
5416            count = 0
5417         End If
5418     Next index
5419
5420    mas3$ = table(3, 1) + table(3, 2) + table(3, 3) + table(3, 4) + table(3, 5) + table(3, 6) + table(3, 7) + table(3, 8)
5421    lin3$ = ""
5422    count = 0
5423     For index = 1 To 8
5424         If index = 8 And Mid$(mas3$, index, 1) = "+" Then
5425             count = count + 1
5426             lin3$ = lin3$ + LTrim$(Str$(count))
5427         End If
5428         If index < 8 And Mid$(mas3$, index, 1) = "+" Then
5429             count = count + 1
5430         End If
5431         If Mid$(mas3$, index, 1) <> "+" And count = 0 Then
5432             lin3$ = lin3$ + Mid$(mas3$, index, 1)
5433         End If
5434         If Mid$(mas3$, index, 1) <> "+" And count > 0 Then
5435             lin3$ = lin3$ + LTrim$(Str$(count))
5436             lin3$ = lin3$ + Mid$(mas3$, index, 1)
5437            count = 0
5438         End If
5439     Next index
5440
5441    mas4$ = table(4, 1) + table(4, 2) + table(4, 3) + table(4, 4) + table(4, 5) + table(4, 6) + table(4, 7) + table(4, 8)
5442    lin4$ = ""
5443    count = 0
5444     For index = 1 To 8
5445         If index = 8 And Mid$(mas4$, index, 1) = "+" Then
5446             count = count + 1
5447             lin4$ = lin4$ + LTrim$(Str$(count))
5448         End If
5449         If index < 8 And Mid$(mas4$, index, 1) = "+" Then
5450             count = count + 1
5451         End If
5452         If Mid$(mas4$, index, 1) <> "+" And count = 0 Then
5453             lin4$ = lin4$ + Mid$(mas4$, index, 1)
5454         End If
5455         If Mid$(mas4$, index, 1) <> "+" And count > 0 Then
5456             lin4$ = lin4$ + LTrim$(Str$(count))
5457             lin4$ = lin4$ + Mid$(mas4$, index, 1)
5458            count = 0
5459         End If
5460     Next index
5461
5462    mas5$ = table(5, 1) + table(5, 2) + table(5, 3) + table(5, 4) + table(5, 5) + table(5, 6) + table(5, 7) + table(5, 8)
5463    lin5$ = ""
5464    count = 0
5465     For index = 1 To 8
5466         If index = 8 And Mid$(mas5$, index, 1) = "+" Then
5467             count = count + 1
5468             lin5$ = lin5$ + LTrim$(Str$(count))
5469         End If
5470         If index < 8 And Mid$(mas5$, index, 1) = "+" Then
5471             count = count + 1
5472         End If
5473         If Mid$(mas5$, index, 1) <> "+" And count = 0 Then
5474             lin5$ = lin5$ + Mid$(mas5$, index, 1)
5475         End If
5476         If Mid$(mas5$, index, 1) <> "+" And count > 0 Then
5477             lin5$ = lin5$ + LTrim$(Str$(count))
5478             lin5$ = lin5$ + Mid$(mas5$, index, 1)
5479            count = 0
5480         End If
5481     Next index
5482
5483    mas6$ = table(6, 1) + table(6, 2) + table(6, 3) + table(6, 4) + table(6, 5) + table(6, 6) + table(6, 7) + table(6, 8)
5484    lin6$ = ""
5485    count = 0
5486     For index = 1 To 8
5487         If index = 8 And Mid$(mas6$, index, 1) = "+" Then
5488             count = count + 1
5489             lin6$ = lin6$ + LTrim$(Str$(count))
5490         End If
5491         If index < 8 And Mid$(mas6$, index, 1) = "+" Then
5492             count = count + 1
5493         End If
5494         If Mid$(mas6$, index, 1) <> "+" And count = 0 Then
5495             lin6$ = lin6$ + Mid$(mas6$, index, 1)
5496         End If
5497         If Mid$(mas6$, index, 1) <> "+" And count > 0 Then
5498             lin6$ = lin6$ + LTrim$(Str$(count))
5499             lin6$ = lin6$ + Mid$(mas6$, index, 1)
5500            count = 0
5501         End If
5502     Next index
5503
5504    mas7$ = table(7, 1) + table(7, 2) + table(7, 3) + table(7, 4) + table(7, 5) + table(7, 6) + table(7, 7) + table(7, 8)
5505    lin7$ = ""
5506    count = 0
5507     For index = 1 To 8
5508         If index = 8 And Mid$(mas7$, index, 1) = "+" Then
5509             count = count + 1
5510             lin7$ = lin7$ + LTrim$(Str$(count))
5511         End If
5512         If index < 8 And Mid$(mas7$, index, 1) = "+" Then
5513             count = count + 1
5514         End If
5515         If Mid$(mas7$, index, 1) <> "+" And count = 0 Then
5516             lin7$ = lin7$ + Mid$(mas7$, index, 1)
5517         End If
5518         If Mid$(mas7$, index, 1) <> "+" And count > 0 Then
5519             lin7$ = lin7$ + LTrim$(Str$(count))
5520             lin7$ = lin7$ + Mid$(mas7$, index, 1)
5521            count = 0
5522         End If
5523     Next index
5524
5525    mas8$ = table(8, 1) + table(8, 2) + table(8, 3) + table(8, 4) + table(8, 5) + table(8, 6) + table(8, 7) + table(8, 8)
5526    lin8$ = ""
5527    count = 0
5528     For index = 1 To 8
5529         If index = 8 And Mid$(mas8$, index, 1) = "+" Then
5530             count = count + 1
5531             lin8$ = lin8$ + LTrim$(Str$(count))
5532         End If
5533         If index < 8 And Mid$(mas8$, index, 1) = "+" Then
5534             count = count + 1
5535         End If
5536         If Mid$(mas8$, index, 1) <> "+" And count = 0 Then
5537             lin8$ = lin8$ + Mid$(mas8$, index, 1)
5538         End If
5539         If Mid$(mas8$, index, 1) <> "+" And count > 0 Then
5540             lin8$ = lin8$ + LTrim$(Str$(count))
5541             lin8$ = lin8$ + Mid$(mas8$, index, 1)
5542            count = 0
5543         End If
5544     Next index
5545
5546    fen$ = lin8$ + "/" + lin7$ + "/" + lin6$ + "/" + lin5$ + "/" + lin4$ + "/" + lin3$ + "/" + lin2$ + "/" + lin1$
5547
5548     Color 10
5549     Locate 2, 1: Print "              Press any key to display the Forsyth-Edwards notation                    "
5550     Do
5551     Loop Until InKey$ <> ""
5552     Locate 2, 1: Print "                                                                                       "
5553     Color 12
5554     Locate 2, 28: Print fen$
5555
5556     Do
5557     Loop Until InKey$ <> ""
5558
5559     SetTextClpbrd (fen$)
5560
5561     url$ = "https://syzygy-tables.info/?fen=" + fen$
5562     If InStr(_OS$, "[WINDOWS]") Then
5563         Shell url$
5564     End If
5565     If InStr(_OS$, "[LINUX]") Then
5566         Shell "xdg-open " + url$
5567     End If
5568     If InStr(_OS$, "[MACOSX]") Then
5569         Shell "open -a safari https://" + url$
5570     End If
5571
5572     System
5573 End Sub
5574
5575 Sub makrukfen ()
5576
5577     Rem Forsyth-Edwards notation
5578
5579     If fw1 = 1 Then fig1w$ = "L"
5580     If fw1 = 2 Then fig1w$ = "S"
5581     If fw1 = 3 Then fig1w$ = "N"
5582     If fw1 = 4 Then fig1w$ = "H"
5583     If fw1 = 5 Then fig1w$ = "B"
5584     If fw1 = 6 Then fig1w$ = "C"
5585
5586     If fb1 = 1 Then fig1b$ = "l"
5587     If fb1 = 2 Then fig1b$ = "s"
5588     If fb1 = 3 Then fig1b$ = "n"
5589     If fb1 = 4 Then fig1b$ = "h"
5590     If fb1 = 5 Then fig1b$ = "b"
5591     If fb1 = 6 Then fig1b$ = "c"
5592
5593     If fw2 = 1 Then fig2w$ = "L"
5594     If fw2 = 2 Then fig2w$ = "S"
5595     If fw2 = 3 Then fig2w$ = "N"
5596     If fw2 = 4 Then fig2w$ = "H"
5597     If fw2 = 5 Then fig2w$ = "B"
5598     If fw2 = 6 Then fig2w$ = "C"
5599
5600     If fb2 = 1 Then fig2b$ = "l"
5601     If fb2 = 2 Then fig2b$ = "s"
5602     If fb2 = 3 Then fig2b$ = "n"
5603     If fb2 = 4 Then fig2b$ = "h"
5604     If fb2 = 5 Then fig2b$ = "b"
5605     If fb2 = 6 Then fig2b$ = "c"
5606
5607     If fw3 = 1 Then fig3w$ = "L"
5608     If fw3 = 2 Then fig3w$ = "S"
5609     If fw3 = 3 Then fig3w$ = "N"
5610     If fw3 = 4 Then fig3w$ = "H"
5611     If fw3 = 5 Then fig3w$ = "B"
5612     If fw3 = 6 Then fig3w$ = "C"
5613
5614     If fb3 = 1 Then fig3b$ = "l"
5615     If fb3 = 2 Then fig3b$ = "s"
5616     If fb3 = 3 Then fig3b$ = "n"
5617     If fb3 = 4 Then fig3b$ = "h"
5618     If fb3 = 5 Then fig3b$ = "b"
5619     If fb3 = 6 Then fig3b$ = "c"
5620
5621     If fw4 = 1 Then fig4w$ = "L"
5622     If fw4 = 2 Then fig4w$ = "S"
5623     If fw4 = 3 Then fig4w$ = "N"
5624     If fw4 = 4 Then fig4w$ = "H"
5625     If fw4 = 5 Then fig4w$ = "B"
5626     If fw4 = 6 Then fig4w$ = "C"
5627
5628     If fb4 = 1 Then fig4b$ = "l"
5629     If fb4 = 2 Then fig4b$ = "s"
5630     If fb4 = 3 Then fig4b$ = "n"
5631     If fb4 = 4 Then fig4b$ = "h"
5632     If fb4 = 5 Then fig4b$ = "b"
5633     If fb4 = 6 Then fig4b$ = "c"
5634
5635     Dim table(8, 8) As String
5636    table(fw1y, fw1x) = fig1w$
5637    table(fb1y, fb1x) = fig1b$
5638    table(fw2y, fw2x) = fig2w$
5639    table(fb2y, fb2x) = fig2b$
5640    table(fw3y, fw3x) = fig3w$
5641    table(fb3y, fb3x) = fig3b$
5642    table(fw4y, fw4x) = fig4w$
5643    table(fb4y, fb4x) = fig4b$
5644     For row = 1 To 8: For col = 1 To 8
5645         If table(row, col) = "" Then table(row, col) = "+"
5646     Next col: Next row
5647
5648    mas1$ = table(1, 1) + table(1, 2) + table(1, 3) + table(1, 4) + table(1, 5) + table(1, 6) + table(1, 7) + table(1, 8)
5649    lin1$ = ""
5650    count = 0
5651     For index = 1 To 8
5652         If index = 8 And Mid$(mas1$, index, 1) = "+" Then
5653             count = count + 1
5654             lin1$ = lin1$ + LTrim$(Str$(count))
5655         End If
5656         If index < 8 And Mid$(mas1$, index, 1) = "+" Then
5657             count = count + 1
5658         End If
5659         If Mid$(mas1$, index, 1) <> "+" And count = 0 Then
5660             lin1$ = lin1$ + Mid$(mas1$, index, 1)
5661         End If
5662         If Mid$(mas1$, index, 1) <> "+" And count > 0 Then
5663             lin1$ = lin1$ + LTrim$(Str$(count))
5664             lin1$ = lin1$ + Mid$(mas1$, index, 1)
5665            count = 0
5666         End If
5667     Next index
5668
5669    mas2$ = table(2, 1) + table(2, 2) + table(2, 3) + table(2, 4) + table(2, 5) + table(2, 6) + table(2, 7) + table(2, 8)
5670    lin2$ = ""
5671    count = 0
5672     For index = 1 To 8
5673         If index = 8 And Mid$(mas2$, index, 1) = "+" Then
5674             count = count + 1
5675             lin2$ = lin2$ + LTrim$(Str$(count))
5676         End If
5677         If index < 8 And Mid$(mas2$, index, 1) = "+" Then
5678             count = count + 1
5679         End If
5680         If Mid$(mas2$, index, 1) <> "+" And count = 0 Then
5681             lin2$ = lin2$ + Mid$(mas2$, index, 1)
5682         End If
5683         If Mid$(mas2$, index, 1) <> "+" And count > 0 Then
5684             lin2$ = lin2$ + LTrim$(Str$(count))
5685             lin2$ = lin2$ + Mid$(mas2$, index, 1)
5686            count = 0
5687         End If
5688     Next index
5689
5690    mas3$ = table(3, 1) + table(3, 2) + table(3, 3) + table(3, 4) + table(3, 5) + table(3, 6) + table(3, 7) + table(3, 8)
5691    lin3$ = ""
5692    count = 0
5693     For index = 1 To 8
5694         If index = 8 And Mid$(mas3$, index, 1) = "+" Then
5695             count = count + 1
5696             lin3$ = lin3$ + LTrim$(Str$(count))
5697         End If
5698         If index < 8 And Mid$(mas3$, index, 1) = "+" Then
5699             count = count + 1
5700         End If
5701         If Mid$(mas3$, index, 1) <> "+" And count = 0 Then
5702             lin3$ = lin3$ + Mid$(mas3$, index, 1)
5703         End If
5704         If Mid$(mas3$, index, 1) <> "+" And count > 0 Then
5705             lin3$ = lin3$ + LTrim$(Str$(count))
5706             lin3$ = lin3$ + Mid$(mas3$, index, 1)
5707            count = 0
5708         End If
5709     Next index
5710
5711    mas4$ = table(4, 1) + table(4, 2) + table(4, 3) + table(4, 4) + table(4, 5) + table(4, 6) + table(4, 7) + table(4, 8)
5712    lin4$ = ""
5713    count = 0
5714     For index = 1 To 8
5715         If index = 8 And Mid$(mas4$, index, 1) = "+" Then
5716             count = count + 1
5717             lin4$ = lin4$ + LTrim$(Str$(count))
5718         End If
5719         If index < 8 And Mid$(mas4$, index, 1) = "+" Then
5720             count = count + 1
5721         End If
5722         If Mid$(mas4$, index, 1) <> "+" And count = 0 Then
5723             lin4$ = lin4$ + Mid$(mas4$, index, 1)
5724         End If
5725         If Mid$(mas4$, index, 1) <> "+" And count > 0 Then
5726             lin4$ = lin4$ + LTrim$(Str$(count))
5727             lin4$ = lin4$ + Mid$(mas4$, index, 1)
5728            count = 0
5729         End If
5730     Next index
5731
5732    mas5$ = table(5, 1) + table(5, 2) + table(5, 3) + table(5, 4) + table(5, 5) + table(5, 6) + table(5, 7) + table(5, 8)
5733    lin5$ = ""
5734    count = 0
5735     For index = 1 To 8
5736         If index = 8 And Mid$(mas5$, index, 1) = "+" Then
5737             count = count + 1
5738             lin5$ = lin5$ + LTrim$(Str$(count))
5739         End If
5740         If index < 8 And Mid$(mas5$, index, 1) = "+" Then
5741             count = count + 1
5742         End If
5743         If Mid$(mas5$, index, 1) <> "+" And count = 0 Then
5744             lin5$ = lin5$ + Mid$(mas5$, index, 1)
5745         End If
5746         If Mid$(mas5$, index, 1) <> "+" And count > 0 Then
5747             lin5$ = lin5$ + LTrim$(Str$(count))
5748             lin5$ = lin5$ + Mid$(mas5$, index, 1)
5749            count = 0
5750         End If
5751     Next index
5752
5753    mas6$ = table(6, 1) + table(6, 2) + table(6, 3) + table(6, 4) + table(6, 5) + table(6, 6) + table(6, 7) + table(6, 8)
5754    lin6$ = ""
5755    count = 0
5756     For index = 1 To 8
5757         If index = 8 And Mid$(mas6$, index, 1) = "+" Then
5758             count = count + 1
5759             lin6$ = lin6$ + LTrim$(Str$(count))
5760         End If
5761         If index < 8 And Mid$(mas6$, index, 1) = "+" Then
5762             count = count + 1
5763         End If
5764         If Mid$(mas6$, index, 1) <> "+" And count = 0 Then
5765             lin6$ = lin6$ + Mid$(mas6$, index, 1)
5766         End If
5767         If Mid$(mas6$, index, 1) <> "+" And count > 0 Then
5768             lin6$ = lin6$ + LTrim$(Str$(count))
5769             lin6$ = lin6$ + Mid$(mas6$, index, 1)
5770            count = 0
5771         End If
5772     Next index
5773
5774    mas7$ = table(7, 1) + table(7, 2) + table(7, 3) + table(7, 4) + table(7, 5) + table(7, 6) + table(7, 7) + table(7, 8)
5775    lin7$ = ""
5776    count = 0
5777     For index = 1 To 8
5778         If index = 8 And Mid$(mas7$, index, 1) = "+" Then
5779             count = count + 1
5780             lin7$ = lin7$ + LTrim$(Str$(count))
5781         End If
5782         If index < 8 And Mid$(mas7$, index, 1) = "+" Then
5783             count = count + 1
5784         End If
5785         If Mid$(mas7$, index, 1) <> "+" And count = 0 Then
5786             lin7$ = lin7$ + Mid$(mas7$, index, 1)
5787         End If
5788         If Mid$(mas7$, index, 1) <> "+" And count > 0 Then
5789             lin7$ = lin7$ + LTrim$(Str$(count))
5790             lin7$ = lin7$ + Mid$(mas7$, index, 1)
5791            count = 0
5792         End If
5793     Next index
5794
5795    mas8$ = table(8, 1) + table(8, 2) + table(8, 3) + table(8, 4) + table(8, 5) + table(8, 6) + table(8, 7) + table(8, 8)
5796    lin8$ = ""
5797    count = 0
5798     For index = 1 To 8
5799         If index = 8 And Mid$(mas8$, index, 1) = "+" Then
5800             count = count + 1
5801             lin8$ = lin8$ + LTrim$(Str$(count))
5802         End If
5803         If index < 8 And Mid$(mas8$, index, 1) = "+" Then
5804             count = count + 1
5805         End If
5806         If Mid$(mas8$, index, 1) <> "+" And count = 0 Then
5807             lin8$ = lin8$ + Mid$(mas8$, index, 1)
5808         End If
5809         If Mid$(mas8$, index, 1) <> "+" And count > 0 Then
5810             lin8$ = lin8$ + LTrim$(Str$(count))
5811             lin8$ = lin8$ + Mid$(mas8$, index, 1)
5812            count = 0
5813         End If
5814     Next index
5815
5816    fen$ = lin8$ + "/" + lin7$ + "/" + lin6$ + "/" + lin5$ + "/" + lin4$ + "/" + lin3$ + "/" + lin2$ + "/" + lin1$
5817
5818     Color 10
5819     Locate 2, 1: Print "              Press any key to display the Forsyth-Edwards notation                    "
5820     Do
5821     Loop Until InKey$ <> ""
5822     Locate 2, 1: Print "                                                                                       "
5823     Color 12
5824     Locate 2, 28: Print fen$
5825
5826     Do
5827     Loop Until InKey$ <> ""
5828
5829     SetTextClpbrd (fen$)
5830
5831     System
5832 End Sub
5833
5834 Sub xiangqifen ()
5835
5836     Rem Forsyth-Edwards notation
5837
5838     If fw1 = 1 Then fig1w$ = "K"
5839     If fw1 = 2 Then fig1w$ = "A"
5840     If fw1 = 3 Then fig1w$ = "E"
5841     If fw1 = 4 Then fig1w$ = "H"
5842     If fw1 = 5 Then fig1w$ = "R"
5843     If fw1 = 6 Then fig1w$ = "C"
5844     If fw1 = 7 Then fig1w$ = "P"
5845
5846     If fb1 = 1 Then fig1b$ = "k"
5847     If fb1 = 2 Then fig1b$ = "a"
5848     If fb1 = 3 Then fig1b$ = "e"
5849     If fb1 = 4 Then fig1b$ = "h"
5850     If fb1 = 5 Then fig1b$ = "r"
5851     If fb1 = 6 Then fig1b$ = "c"
5852     If fb1 = 7 Then fig1w$ = "p"
5853
5854     If fw2 = 1 Then fig2w$ = "K"
5855     If fw2 = 2 Then fig2w$ = "A"
5856     If fw2 = 3 Then fig2w$ = "E"
5857     If fw2 = 4 Then fig2w$ = "H"
5858     If fw2 = 5 Then fig2w$ = "R"
5859     If fw2 = 6 Then fig2w$ = "C"
5860     If fw2 = 7 Then fig2w$ = "P"
5861
5862     If fb2 = 1 Then fig2b$ = "k"
5863     If fb2 = 2 Then fig2b$ = "a"
5864     If fb2 = 3 Then fig2b$ = "e"
5865     If fb2 = 4 Then fig2b$ = "h"
5866     If fb2 = 5 Then fig2b$ = "r"
5867     If fb2 = 6 Then fig2b$ = "c"
5868     If fb2 = 7 Then fig2w$ = "p"
5869
5870     If fw3 = 1 Then fig3w$ = "K"
5871     If fw3 = 2 Then fig3w$ = "A"
5872     If fw3 = 3 Then fig3w$ = "E"
5873     If fw3 = 4 Then fig3w$ = "H"
5874     If fw3 = 5 Then fig3w$ = "R"
5875     If fw3 = 6 Then fig3w$ = "C"
5876     If fw3 = 7 Then fig3w$ = "P"
5877
5878     If fb3 = 1 Then fig3b$ = "k"
5879     If fb3 = 2 Then fig3b$ = "a"
5880     If fb3 = 3 Then fig3b$ = "e"
5881     If fb3 = 4 Then fig3b$ = "h"
5882     If fb3 = 5 Then fig3b$ = "r"
5883     If fb3 = 6 Then fig3b$ = "c"
5884     If fb3 = 7 Then fig3w$ = "p"
5885
5886     If fw4 = 1 Then fig4w$ = "K"
5887     If fw4 = 2 Then fig4w$ = "A"
5888     If fw4 = 3 Then fig4w$ = "E"
5889     If fw4 = 4 Then fig4w$ = "H"
5890     If fw4 = 5 Then fig4w$ = "R"
5891     If fw4 = 6 Then fig4w$ = "C"
5892     If fw4 = 7 Then fig4w$ = "P"
5893
5894     If fb4 = 1 Then fig4b$ = "k"
5895     If fb4 = 2 Then fig4b$ = "a"
5896     If fb4 = 3 Then fig4b$ = "e"
5897     If fb4 = 4 Then fig4b$ = "h"
5898     If fb4 = 5 Then fig4b$ = "r"
5899     If fb4 = 6 Then fig4b$ = "c"
5900     If fb4 = 7 Then fig4w$ = "p"
5901
5902     Dim table(10, 9) As String
5903    table(fw1y, fw1x) = fig1w$
5904    table(fb1y, fb1x) = fig1b$
5905    table(fw2y, fw2x) = fig2w$
5906    table(fb2y, fb2x) = fig2b$
5907    table(fw3y, fw3x) = fig3w$
5908    table(fb3y, fb3x) = fig3b$
5909    table(fw4y, fw4x) = fig4w$
5910    table(fb4y, fb4x) = fig4b$
5911     For row = 1 To 10: For col = 1 To 9
5912         If table(row, col) = "" Then table(row, col) = "+"
5913     Next col: Next row
5914
5915    mas1$ = table(1, 1) + table(1, 2) + table(1, 3) + table(1, 4) + table(1, 5) + table(1, 6) + table(1, 7) + table(1, 8) + table(1, 9)
5916    lin1$ = ""
5917    count = 0
5918     For index = 1 To 9
5919         If index = 9 And Mid$(mas1$, index, 1) = "+" Then
5920             count = count + 1
5921             lin1$ = lin1$ + LTrim$(Str$(count))
5922         End If
5923         If index < 9 And Mid$(mas1$, index, 1) = "+" Then
5924             count = count + 1
5925         End If
5926         If Mid$(mas1$, index, 1) <> "+" And count = 0 Then
5927             lin1$ = lin1$ + Mid$(mas1$, index, 1)
5928         End If
5929         If Mid$(mas1$, index, 1) <> "+" And count > 0 Then
5930             lin1$ = lin1$ + LTrim$(Str$(count))
5931             lin1$ = lin1$ + Mid$(mas1$, index, 1)
5932            count = 0
5933         End If
5934     Next index
5935
5936    mas2$ = table(2, 1) + table(2, 2) + table(2, 3) + table(2, 4) + table(2, 5) + table(2, 6) + table(2, 7) + table(2, 8) + table(2, 9)
5937    lin2$ = ""
5938    count = 0
5939     For index = 1 To 9
5940         If index = 9 And Mid$(mas2$, index, 1) = "+" Then
5941             count = count + 1
5942             lin2$ = lin2$ + LTrim$(Str$(count))
5943         End If
5944         If index < 9 And Mid$(mas2$, index, 1) = "+" Then
5945             count = count + 1
5946         End If
5947         If Mid$(mas2$, index, 1) <> "+" And count = 0 Then
5948             lin2$ = lin2$ + Mid$(mas2$, index, 1)
5949         End If
5950         If Mid$(mas2$, index, 1) <> "+" And count > 0 Then
5951             lin2$ = lin2$ + LTrim$(Str$(count))
5952             lin2$ = lin2$ + Mid$(mas2$, index, 1)
5953            count = 0
5954         End If
5955     Next index
5956
5957    mas3$ = table(3, 1) + table(3, 2) + table(3, 3) + table(3, 4) + table(3, 5) + table(3, 6) + table(3, 7) + table(3, 8) + table(3, 9)
5958    lin3$ = ""
5959    count = 0
5960     For index = 1 To 9
5961         If index = 9 And Mid$(mas3$, index, 1) = "+" Then
5962             count = count + 1
5963             lin3$ = lin3$ + LTrim$(Str$(count))
5964         End If
5965         If index < 9 And Mid$(mas3$, index, 1) = "+" Then
5966             count = count + 1
5967         End If
5968         If Mid$(mas3$, index, 1) <> "+" And count = 0 Then
5969             lin3$ = lin3$ + Mid$(mas3$, index, 1)
5970         End If
5971         If Mid$(mas3$, index, 1) <> "+" And count > 0 Then
5972             lin3$ = lin3$ + LTrim$(Str$(count))
5973             lin3$ = lin3$ + Mid$(mas3$, index, 1)
5974            count = 0
5975         End If
5976     Next index
5977
5978    mas4$ = table(4, 1) + table(4, 2) + table(4, 3) + table(4, 4) + table(4, 5) + table(4, 6) + table(4, 7) + table(4, 8) + table(4, 9)
5979    lin4$ = ""
5980    count = 0
5981     For index = 1 To 9
5982         If index = 9 And Mid$(mas4$, index, 1) = "+" Then
5983             count = count + 1
5984             lin4$ = lin4$ + LTrim$(Str$(count))
5985         End If
5986         If index < 9 And Mid$(mas4$, index, 1) = "+" Then
5987             count = count + 1
5988         End If
5989         If Mid$(mas4$, index, 1) <> "+" And count = 0 Then
5990             lin4$ = lin4$ + Mid$(mas4$, index, 1)
5991         End If
5992         If Mid$(mas4$, index, 1) <> "+" And count > 0 Then
5993             lin4$ = lin4$ + LTrim$(Str$(count))
5994             lin4$ = lin4$ + Mid$(mas4$, index, 1)
5995            count = 0
5996         End If
5997     Next index
5998
5999    mas5$ = table(5, 1) + table(5, 2) + table(5, 3) + table(5, 4) + table(5, 5) + table(5, 6) + table(5, 7) + table(5, 8) + table(5, 9)
6000    lin5$ = ""
6001    count = 0
6002     For index = 1 To 9
6003         If index = 9 And Mid$(mas5$, index, 1) = "+" Then
6004             count = count + 1
6005             lin5$ = lin5$ + LTrim$(Str$(count))
6006         End If
6007         If index < 9 And Mid$(mas5$, index, 1) = "+" Then
6008             count = count + 1
6009         End If
6010         If Mid$(mas5$, index, 1) <> "+" And count = 0 Then
6011             lin5$ = lin5$ + Mid$(mas5$, index, 1)
6012         End If
6013         If Mid$(mas5$, index, 1) <> "+" And count > 0 Then
6014             lin5$ = lin5$ + LTrim$(Str$(count))
6015             lin5$ = lin5$ + Mid$(mas5$, index, 1)
6016            count = 0
6017         End If
6018     Next index
6019
6020    mas6$ = table(6, 1) + table(6, 2) + table(6, 3) + table(6, 4) + table(6, 5) + table(6, 6) + table(6, 7) + table(6, 8) + table(6, 9)
6021    lin6$ = ""
6022    count = 0
6023     For index = 1 To 9
6024         If index = 9 And Mid$(mas6$, index, 1) = "+" Then
6025             count = count + 1
6026             lin6$ = lin6$ + LTrim$(Str$(count))
6027         End If
6028         If index < 9 And Mid$(mas6$, index, 1) = "+" Then
6029             count = count + 1
6030         End If
6031         If Mid$(mas6$, index, 1) <> "+" And count = 0 Then
6032             lin6$ = lin6$ + Mid$(mas6$, index, 1)
6033         End If
6034         If Mid$(mas6$, index, 1) <> "+" And count > 0 Then
6035             lin6$ = lin6$ + LTrim$(Str$(count))
6036             lin6$ = lin6$ + Mid$(mas6$, index, 1)
6037            count = 0
6038         End If
6039     Next index
6040
6041    mas7$ = table(7, 1) + table(7, 2) + table(7, 3) + table(7, 4) + table(7, 5) + table(7, 6) + table(7, 7) + table(7, 8) + table(7, 9)
6042    lin7$ = ""
6043    count = 0
6044     For index = 1 To 9
6045         If index = 9 And Mid$(mas7$, index, 1) = "+" Then
6046             count = count + 1
6047             lin7$ = lin7$ + LTrim$(Str$(count))
6048         End If
6049         If index < 9 And Mid$(mas7$, index, 1) = "+" Then
6050             count = count + 1
6051         End If
6052         If Mid$(mas7$, index, 1) <> "+" And count = 0 Then
6053             lin7$ = lin7$ + Mid$(mas7$, index, 1)
6054         End If
6055         If Mid$(mas7$, index, 1) <> "+" And count > 0 Then
6056             lin7$ = lin7$ + LTrim$(Str$(count))
6057             lin7$ = lin7$ + Mid$(mas7$, index, 1)
6058            count = 0
6059         End If
6060     Next index
6061
6062    mas8$ = table(8, 1) + table(8, 2) + table(8, 3) + table(8, 4) + table(8, 5) + table(8, 6) + table(8, 7) + table(8, 8) + table(8, 9)
6063    lin8$ = ""
6064    count = 0
6065     For index = 1 To 9
6066         If index = 9 And Mid$(mas8$, index, 1) = "+" Then
6067             count = count + 1
6068             lin8$ = lin8$ + LTrim$(Str$(count))
6069         End If
6070         If index < 9 And Mid$(mas8$, index, 1) = "+" Then
6071             count = count + 1
6072         End If
6073         If Mid$(mas8$, index, 1) <> "+" And count = 0 Then
6074             lin8$ = lin8$ + Mid$(mas8$, index, 1)
6075         End If
6076         If Mid$(mas8$, index, 1) <> "+" And count > 0 Then
6077             lin8$ = lin8$ + LTrim$(Str$(count))
6078             lin8$ = lin8$ + Mid$(mas8$, index, 1)
6079            count = 0
6080         End If
6081     Next index
6082
6083    mas9$ = table(9, 1) + table(9, 2) + table(9, 3) + table(9, 4) + table(9, 5) + table(9, 6) + table(9, 7) + table(9, 8) + table(9, 9)
6084    lin9$ = ""
6085    count = 0
6086     For index = 1 To 9
6087         If index = 9 And Mid$(mas9$, index, 1) = "+" Then
6088             count = count + 1
6089             lin9$ = lin9$ + LTrim$(Str$(count))
6090         End If
6091         If index < 9 And Mid$(mas9$, index, 1) = "+" Then
6092             count = count + 1
6093         End If
6094         If Mid$(mas9$, index, 1) <> "+" And count = 0 Then
6095             lin9$ = lin9$ + Mid$(mas9$, index, 1)
6096         End If
6097         If Mid$(mas9$, index, 1) <> "+" And count > 0 Then
6098             lin9$ = lin9$ + LTrim$(Str$(count))
6099             lin9$ = lin9$ + Mid$(mas9$, index, 1)
6100            count = 0
6101         End If
6102     Next index
6103
6104    mas0$ = table(10, 1) + table(10, 2) + table(10, 3) + table(10, 4) + table(10, 5) + table(10, 6) + table(10, 7) + table(10, 8) + table(10, 9)
6105    lin0$ = ""
6106    count = 0
6107     For index = 1 To 9
6108         If index = 9 And Mid$(mas0$, index, 1) = "+" Then
6109             count = count + 1
6110             lin0$ = lin0$ + LTrim$(Str$(count))
6111         End If
6112         If index < 9 And Mid$(mas0$, index, 1) = "+" Then
6113             count = count + 1
6114         End If
6115         If Mid$(mas0$, index, 1) <> "+" And count = 0 Then
6116             lin0$ = lin0$ + Mid$(mas0$, index, 1)
6117         End If
6118         If Mid$(mas0$, index, 1) <> "+" And count > 0 Then
6119             lin0$ = lin0$ + LTrim$(Str$(count))
6120             lin0$ = lin0$ + Mid$(mas0$, index, 1)
6121            count = 0
6122         End If
6123     Next index
6124
6125    fen$ = lin0$ + "/" + lin9$ + "/" + lin8$ + "/" + lin7$ + "/" + lin6$ + "/" + lin5$ + "/" + lin4$ + "/" + lin3$ + "/" + lin2$ + "/" + lin1$
6126
6127     Color 10
6128     Locate 2, 1: Print "              Press any key to display the Forsyth-Edwards notation                    "
6129     Do
6130     Loop Until InKey$ <> ""
6131     Locate 2, 1: Print "                                                                                       "
6132     Color 12
6133     Locate 2, 24: Print fen$
6134
6135     Do
6136     Loop Until InKey$ <> ""
6137
6138     SetTextClpbrd (fen$)
6139
6140     System
6141 End Sub
6142
6143 Sub shogifen ()
6144
6145     Rem Forsyth-Edwards notation
6146
6147     If fw1 = 1 Then fig1w$ = "K"
6148     If fw1 = 2 Then fig1w$ = "G"
6149     If fw1 = 3 Then fig1w$ = "S"
6150     If fw1 = 4 Then fig1w$ = "B"
6151     If fw1 = 5 Then fig1w$ = "N"
6152     If fw1 = 6 Then fig1w$ = "R"
6153     If fw1 = 7 Then fig1w$ = "L"
6154     If fw1 = 8 Then fig1w$ = "P"
6155     If fw1 = 9 Then fig1w$ = "H"
6156     If fw1 = 10 Then fig1w$ = "D"
6157     If fw1 = 11 Then fig1w$ = "T"
6158
6159     If fb1 = 1 Then fig1b$ = "k"
6160     If fb1 = 2 Then fig1b$ = "g"
6161     If fb1 = 3 Then fig1b$ = "a"
6162     If fb1 = 4 Then fig1b$ = "b"
6163     If fb1 = 5 Then fig1b$ = "n"
6164     If fb1 = 6 Then fig1b$ = "r"
6165     If fb1 = 7 Then fig1b$ = "l"
6166     If fb1 = 8 Then fig1b$ = "p"
6167     If fb1 = 9 Then fig1b$ = "h"
6168     If fb1 = 10 Then fig1b$ = "d"
6169     If fb1 = 11 Then fig1b$ = "t"
6170
6171     If fw2 = 1 Then fig2w$ = "K"
6172     If fw2 = 2 Then fig2w$ = "G"
6173     If fw2 = 3 Then fig2w$ = "S"
6174     If fw2 = 4 Then fig2w$ = "B"
6175     If fw2 = 5 Then fig2w$ = "N"
6176     If fw2 = 6 Then fig2w$ = "R"
6177     If fw2 = 7 Then fig2w$ = "L"
6178     If fw2 = 8 Then fig2w$ = "P"
6179     If fw2 = 9 Then fig2w$ = "H"
6180     If fw2 = 20 Then fig2w$ = "D"
6181     If fw2 = 22 Then fig2w$ = "T"
6182
6183     If fb2 = 1 Then fig2b$ = "k"
6184     If fb2 = 2 Then fig2b$ = "g"
6185     If fb2 = 3 Then fig2b$ = "a"
6186     If fb2 = 4 Then fig2b$ = "b"
6187     If fb2 = 5 Then fig2b$ = "n"
6188     If fb2 = 6 Then fig2b$ = "r"
6189     If fb2 = 7 Then fig2b$ = "l"
6190     If fb2 = 8 Then fig2b$ = "p"
6191     If fb2 = 9 Then fig2b$ = "h"
6192     If fb2 = 20 Then fig2b$ = "d"
6193     If fb2 = 22 Then fig2b$ = "t"
6194
6195     If fw3 = 1 Then fig3w$ = "K"
6196     If fw3 = 2 Then fig3w$ = "G"
6197     If fw3 = 3 Then fig3w$ = "S"
6198     If fw3 = 4 Then fig3w$ = "B"
6199     If fw3 = 5 Then fig3w$ = "N"
6200     If fw3 = 6 Then fig3w$ = "R"
6201     If fw3 = 7 Then fig3w$ = "L"
6202     If fw3 = 8 Then fig3w$ = "P"
6203     If fw3 = 9 Then fig3w$ = "H"
6204     If fw3 = 30 Then fig3w$ = "D"
6205     If fw3 = 33 Then fig3w$ = "T"
6206
6207     If fb3 = 1 Then fig3b$ = "k"
6208     If fb3 = 2 Then fig3b$ = "g"
6209     If fb3 = 3 Then fig3b$ = "a"
6210     If fb3 = 4 Then fig3b$ = "b"
6211     If fb3 = 5 Then fig3b$ = "n"
6212     If fb3 = 6 Then fig3b$ = "r"
6213     If fb3 = 7 Then fig3b$ = "l"
6214     If fb3 = 8 Then fig3b$ = "p"
6215     If fb3 = 9 Then fig3b$ = "h"
6216     If fb3 = 30 Then fig3b$ = "d"
6217     If fb3 = 33 Then fig3b$ = "t"
6218
6219     If fw4 = 1 Then fig4w$ = "K"
6220     If fw4 = 2 Then fig4w$ = "G"
6221     If fw4 = 3 Then fig4w$ = "S"
6222     If fw4 = 4 Then fig4w$ = "B"
6223     If fw4 = 5 Then fig4w$ = "N"
6224     If fw4 = 6 Then fig4w$ = "R"
6225     If fw4 = 7 Then fig4w$ = "L"
6226     If fw4 = 8 Then fig4w$ = "P"
6227     If fw4 = 9 Then fig4w$ = "H"
6228     If fw4 = 40 Then fig4w$ = "D"
6229     If fw4 = 44 Then fig4w$ = "T"
6230
6231     If fb4 = 1 Then fig4b$ = "k"
6232     If fb4 = 2 Then fig4b$ = "g"
6233     If fb4 = 3 Then fig4b$ = "a"
6234     If fb4 = 4 Then fig4b$ = "b"
6235     If fb4 = 5 Then fig4b$ = "n"
6236     If fb4 = 6 Then fig4b$ = "r"
6237     If fb4 = 7 Then fig4b$ = "l"
6238     If fb4 = 8 Then fig4b$ = "p"
6239     If fb4 = 9 Then fig4b$ = "h"
6240     If fb4 = 40 Then fig4b$ = "d"
6241     If fb4 = 44 Then fig4b$ = "t"
6242
6243     Dim table(9, 9) As String
6244    table(fw1y, fw1x) = fig1w$
6245    table(fb1y, fb1x) = fig1b$
6246    table(fw2y, fw2x) = fig2w$
6247    table(fb2y, fb2x) = fig2b$
6248    table(fw3y, fw3x) = fig3w$
6249    table(fb3y, fb3x) = fig3b$
6250    table(fw4y, fw4x) = fig4w$
6251    table(fb4y, fb4x) = fig4b$
6252     For row = 1 To 9: For col = 1 To 9
6253         If table(row, col) = "" Then table(row, col) = "+"
6254     Next col: Next row
6255
6256    mas1$ = table(1, 1) + table(1, 2) + table(1, 3) + table(1, 4) + table(1, 5) + table(1, 6) + table(1, 7) + table(1, 8) + table(1, 9)
6257    lin1$ = ""
6258    count = 0
6259     For index = 1 To 9
6260         If index = 9 And Mid$(mas1$, index, 1) = "+" Then
6261             count = count + 1
6262             lin1$ = lin1$ + LTrim$(Str$(count))
6263         End If
6264         If index < 9 And Mid$(mas1$, index, 1) = "+" Then
6265             count = count + 1
6266         End If
6267         If Mid$(mas1$, index, 1) <> "+" And count = 0 Then
6268             lin1$ = lin1$ + Mid$(mas1$, index, 1)
6269         End If
6270         If Mid$(mas1$, index, 1) <> "+" And count > 0 Then
6271             lin1$ = lin1$ + LTrim$(Str$(count))
6272             lin1$ = lin1$ + Mid$(mas1$, index, 1)
6273            count = 0
6274         End If
6275     Next index
6276
6277    mas2$ = table(2, 1) + table(2, 2) + table(2, 3) + table(2, 4) + table(2, 5) + table(2, 6) + table(2, 7) + table(2, 8) + table(2, 9)
6278    lin2$ = ""
6279    count = 0
6280     For index = 1 To 9
6281         If index = 9 And Mid$(mas2$, index, 1) = "+" Then
6282             count = count + 1
6283             lin2$ = lin2$ + LTrim$(Str$(count))
6284         End If
6285         If index < 9 And Mid$(mas2$, index, 1) = "+" Then
6286             count = count + 1
6287         End If
6288         If Mid$(mas2$, index, 1) <> "+" And count = 0 Then
6289             lin2$ = lin2$ + Mid$(mas2$, index, 1)
6290         End If
6291         If Mid$(mas2$, index, 1) <> "+" And count > 0 Then
6292             lin2$ = lin2$ + LTrim$(Str$(count))
6293             lin2$ = lin2$ + Mid$(mas2$, index, 1)
6294            count = 0
6295         End If
6296     Next index
6297
6298    mas3$ = table(3, 1) + table(3, 2) + table(3, 3) + table(3, 4) + table(3, 5) + table(3, 6) + table(3, 7) + table(3, 8) + table(3, 9)
6299    lin3$ = ""
6300    count = 0
6301     For index = 1 To 9
6302         If index = 9 And Mid$(mas3$, index, 1) = "+" Then
6303             count = count + 1
6304             lin3$ = lin3$ + LTrim$(Str$(count))
6305         End If
6306         If index < 9 And Mid$(mas3$, index, 1) = "+" Then
6307             count = count + 1
6308         End If
6309         If Mid$(mas3$, index, 1) <> "+" And count = 0 Then
6310             lin3$ = lin3$ + Mid$(mas3$, index, 1)
6311         End If
6312         If Mid$(mas3$, index, 1) <> "+" And count > 0 Then
6313             lin3$ = lin3$ + LTrim$(Str$(count))
6314             lin3$ = lin3$ + Mid$(mas3$, index, 1)
6315            count = 0
6316         End If
6317     Next index
6318
6319    mas4$ = table(4, 1) + table(4, 2) + table(4, 3) + table(4, 4) + table(4, 5) + table(4, 6) + table(4, 7) + table(4, 8) + table(4, 9)
6320    lin4$ = ""
6321    count = 0
6322     For index = 1 To 9
6323         If index = 9 And Mid$(mas4$, index, 1) = "+" Then
6324             count = count + 1
6325             lin4$ = lin4$ + LTrim$(Str$(count))
6326         End If
6327         If index < 9 And Mid$(mas4$, index, 1) = "+" Then
6328             count = count + 1
6329         End If
6330         If Mid$(mas4$, index, 1) <> "+" And count = 0 Then
6331             lin4$ = lin4$ + Mid$(mas4$, index, 1)
6332         End If
6333         If Mid$(mas4$, index, 1) <> "+" And count > 0 Then
6334             lin4$ = lin4$ + LTrim$(Str$(count))
6335             lin4$ = lin4$ + Mid$(mas4$, index, 1)
6336            count = 0
6337         End If
6338     Next index
6339
6340    mas5$ = table(5, 1) + table(5, 2) + table(5, 3) + table(5, 4) + table(5, 5) + table(5, 6) + table(5, 7) + table(5, 8) + table(5, 9)
6341    lin5$ = ""
6342    count = 0
6343     For index = 1 To 9
6344         If index = 9 And Mid$(mas5$, index, 1) = "+" Then
6345             count = count + 1
6346             lin5$ = lin5$ + LTrim$(Str$(count))
6347         End If
6348         If index < 9 And Mid$(mas5$, index, 1) = "+" Then
6349             count = count + 1
6350         End If
6351         If Mid$(mas5$, index, 1) <> "+" And count = 0 Then
6352             lin5$ = lin5$ + Mid$(mas5$, index, 1)
6353         End If
6354         If Mid$(mas5$, index, 1) <> "+" And count > 0 Then
6355             lin5$ = lin5$ + LTrim$(Str$(count))
6356             lin5$ = lin5$ + Mid$(mas5$, index, 1)
6357            count = 0
6358         End If
6359     Next index
6360
6361    mas6$ = table(6, 1) + table(6, 2) + table(6, 3) + table(6, 4) + table(6, 5) + table(6, 6) + table(6, 7) + table(6, 8) + table(6, 9)
6362    lin6$ = ""
6363    count = 0
6364     For index = 1 To 9
6365         If index = 9 And Mid$(mas6$, index, 1) = "+" Then
6366             count = count + 1
6367             lin6$ = lin6$ + LTrim$(Str$(count))
6368         End If
6369         If index < 9 And Mid$(mas6$, index, 1) = "+" Then
6370             count = count + 1
6371         End If
6372         If Mid$(mas6$, index, 1) <> "+" And count = 0 Then
6373             lin6$ = lin6$ + Mid$(mas6$, index, 1)
6374         End If
6375         If Mid$(mas6$, index, 1) <> "+" And count > 0 Then
6376             lin6$ = lin6$ + LTrim$(Str$(count))
6377             lin6$ = lin6$ + Mid$(mas6$, index, 1)
6378            count = 0
6379         End If
6380     Next index
6381
6382    mas7$ = table(7, 1) + table(7, 2) + table(7, 3) + table(7, 4) + table(7, 5) + table(7, 6) + table(7, 7) + table(7, 8) + table(7, 9)
6383    lin7$ = ""
6384    count = 0
6385     For index = 1 To 9
6386         If index = 9 And Mid$(mas7$, index, 1) = "+" Then
6387             count = count + 1
6388             lin7$ = lin7$ + LTrim$(Str$(count))
6389         End If
6390         If index < 9 And Mid$(mas7$, index, 1) = "+" Then
6391             count = count + 1
6392         End If
6393         If Mid$(mas7$, index, 1) <> "+" And count = 0 Then
6394             lin7$ = lin7$ + Mid$(mas7$, index, 1)
6395         End If
6396         If Mid$(mas7$, index, 1) <> "+" And count > 0 Then
6397             lin7$ = lin7$ + LTrim$(Str$(count))
6398             lin7$ = lin7$ + Mid$(mas7$, index, 1)
6399            count = 0
6400         End If
6401     Next index
6402
6403    mas8$ = table(8, 1) + table(8, 2) + table(8, 3) + table(8, 4) + table(8, 5) + table(8, 6) + table(8, 7) + table(8, 8) + table(8, 9)
6404    lin8$ = ""
6405    count = 0
6406     For index = 1 To 9
6407         If index = 9 And Mid$(mas8$, index, 1) = "+" Then
6408             count = count + 1
6409             lin8$ = lin8$ + LTrim$(Str$(count))
6410         End If
6411         If index < 9 And Mid$(mas8$, index, 1) = "+" Then
6412             count = count + 1
6413         End If
6414         If Mid$(mas8$, index, 1) <> "+" And count = 0 Then
6415             lin8$ = lin8$ + Mid$(mas8$, index, 1)
6416         End If
6417         If Mid$(mas8$, index, 1) <> "+" And count > 0 Then
6418             lin8$ = lin8$ + LTrim$(Str$(count))
6419             lin8$ = lin8$ + Mid$(mas8$, index, 1)
6420            count = 0
6421         End If
6422     Next index
6423
6424    mas9$ = table(9, 1) + table(9, 2) + table(9, 3) + table(9, 4) + table(9, 5) + table(9, 6) + table(9, 7) + table(9, 8) + table(9, 9)
6425    lin9$ = ""
6426    count = 0
6427     For index = 1 To 9
6428         If index = 9 And Mid$(mas9$, index, 1) = "+" Then
6429             count = count + 1
6430             lin9$ = lin9$ + LTrim$(Str$(count))
6431         End If
6432         If index < 9 And Mid$(mas9$, index, 1) = "+" Then
6433             count = count + 1
6434         End If
6435         If Mid$(mas9$, index, 1) <> "+" And count = 0 Then
6436             lin9$ = lin9$ + Mid$(mas9$, index, 1)
6437         End If
6438         If Mid$(mas9$, index, 1) <> "+" And count > 0 Then
6439             lin9$ = lin9$ + LTrim$(Str$(count))
6440             lin9$ = lin9$ + Mid$(mas9$, index, 1)
6441            count = 0
6442         End If
6443     Next index
6444
6445    fen$ = lin9$ + "/" + lin8$ + "/" + lin7$ + "/" + lin6$ + "/" + lin5$ + "/" + lin4$ + "/" + lin3$ + "/" + lin2$ + "/" + lin1$
6446
6447     Color 10
6448     Locate 2, 1: Print "              Press any key to display the Forsyth-Edwards notation                    "
6449     Do
6450     Loop Until InKey$ <> ""
6451     Locate 2, 1: Print "                                                                                       "
6452     Color 12
6453     Locate 2, 25: Print fen$
6454
6455     Do
6456     Loop Until InKey$ <> ""
6457
6458     SetTextClpbrd (fen$)
6459
6460     System
6461 End Sub
6462
6463 Sub draughtsfen ()
6464
6465     Rem Forsyth-Edwards notation
6466
6467     If fw1 = 1 Then fig1w$ = "D"
6468     If fw1 = 2 Then fig1w$ = "C"
6469
6470     If fb1 = 1 Then fig1b$ = "d"
6471     If fb1 = 2 Then fig1b$ = "c"
6472
6473     If fw2 = 1 Then fig2w$ = "D"
6474     If fw2 = 2 Then fig2w$ = "C"
6475
6476     If fb2 = 1 Then fig2b$ = "d"
6477     If fb2 = 2 Then fig2b$ = "c"
6478
6479     If fw3 = 1 Then fig3w$ = "D"
6480     If fw3 = 2 Then fig3w$ = "C"
6481
6482     If fb3 = 1 Then fig3b$ = "d"
6483     If fb3 = 2 Then fig3b$ = "c"
6484
6485     If fw4 = 1 Then fig4w$ = "D"
6486     If fw4 = 2 Then fig4w$ = "C"
6487
6488     If fb4 = 1 Then fig4b$ = "d"
6489     If fb4 = 2 Then fig4b$ = "c"
6490
6491     Dim table(10, 10) As String
6492    table(fw1y, fw1x) = fig1w$
6493    table(fb1y, fb1x) = fig1b$
6494    table(fw2y, fw2x) = fig2w$
6495    table(fb2y, fb2x) = fig2b$
6496    table(fw3y, fw3x) = fig3w$
6497    table(fb3y, fb3x) = fig3b$
6498    table(fw4y, fw4x) = fig4w$
6499    table(fb4y, fb4x) = fig4b$
6500     For row = 1 To 10: For col = 1 To 10
6501         If table(row, col) = "" Then table(row, col) = "+"
6502     Next col: Next row
6503
6504    mas1$ = table(1, 1) + table(1, 2) + table(1, 3) + table(1, 4) + table(1, 5) + table(1, 6) + table(1, 7) + table(1, 8) + table(1, 9) + table(1, 10)
6505    lin1$ = ""
6506    count = 0
6507     For index = 1 To 10
6508         If index = 10 And Mid$(mas1$, index, 1) = "+" Then
6509             count = count + 1
6510             lin1$ = lin1$ + LTrim$(Str$(count))
6511         End If
6512         If index < 10 And Mid$(mas1$, index, 1) = "+" Then
6513             count = count + 1
6514         End If
6515         If Mid$(mas1$, index, 1) <> "+" And count = 0 Then
6516             lin1$ = lin1$ + Mid$(mas1$, index, 1)
6517         End If
6518         If Mid$(mas1$, index, 1) <> "+" And count > 0 Then
6519             lin1$ = lin1$ + LTrim$(Str$(count))
6520             lin1$ = lin1$ + Mid$(mas1$, index, 1)
6521            count = 0
6522         End If
6523     Next index
6524
6525    mas2$ = table(2, 1) + table(2, 2) + table(2, 3) + table(2, 4) + table(2, 5) + table(2, 6) + table(2, 7) + table(2, 8) + table(2, 9) + table(2, 10)
6526    lin2$ = ""
6527    count = 0
6528     For index = 1 To 10
6529         If index = 10 And Mid$(mas2$, index, 1) = "+" Then
6530             count = count + 1
6531             lin2$ = lin2$ + LTrim$(Str$(count))
6532         End If
6533         If index < 10 And Mid$(mas2$, index, 1) = "+" Then
6534             count = count + 1
6535         End If
6536         If Mid$(mas2$, index, 1) <> "+" And count = 0 Then
6537             lin2$ = lin2$ + Mid$(mas2$, index, 1)
6538         End If
6539         If Mid$(mas2$, index, 1) <> "+" And count > 0 Then
6540             lin2$ = lin2$ + LTrim$(Str$(count))
6541             lin2$ = lin2$ + Mid$(mas2$, index, 1)
6542            count = 0
6543         End If
6544     Next index
6545
6546    mas3$ = table(3, 1) + table(3, 2) + table(3, 3) + table(3, 4) + table(3, 5) + table(3, 6) + table(3, 7) + table(3, 8) + table(3, 9) + table(3, 10)
6547    lin3$ = ""
6548    count = 0
6549     For index = 1 To 10
6550         If index = 10 And Mid$(mas3$, index, 1) = "+" Then
6551             count = count + 1
6552             lin3$ = lin3$ + LTrim$(Str$(count))
6553         End If
6554         If index < 10 And Mid$(mas3$, index, 1) = "+" Then
6555             count = count + 1
6556         End If
6557         If Mid$(mas3$, index, 1) <> "+" And count = 0 Then
6558             lin3$ = lin3$ + Mid$(mas3$, index, 1)
6559         End If
6560         If Mid$(mas3$, index, 1) <> "+" And count > 0 Then
6561             lin3$ = lin3$ + LTrim$(Str$(count))
6562             lin3$ = lin3$ + Mid$(mas3$, index, 1)
6563            count = 0
6564         End If
6565     Next index
6566
6567    mas4$ = table(4, 1) + table(4, 2) + table(4, 3) + table(4, 4) + table(4, 5) + table(4, 6) + table(4, 7) + table(4, 8) + table(4, 9) + table(4, 10)
6568    lin4$ = ""
6569    count = 0
6570     For index = 1 To 10
6571         If index = 10 And Mid$(mas4$, index, 1) = "+" Then
6572             count = count + 1
6573             lin4$ = lin4$ + LTrim$(Str$(count))
6574         End If
6575         If index < 10 And Mid$(mas4$, index, 1) = "+" Then
6576             count = count + 1
6577         End If
6578         If Mid$(mas4$, index, 1) <> "+" And count = 0 Then
6579             lin4$ = lin4$ + Mid$(mas4$, index, 1)
6580         End If
6581         If Mid$(mas4$, index, 1) <> "+" And count > 0 Then
6582             lin4$ = lin4$ + LTrim$(Str$(count))
6583             lin4$ = lin4$ + Mid$(mas4$, index, 1)
6584            count = 0
6585         End If
6586     Next index
6587
6588    mas5$ = table(5, 1) + table(5, 2) + table(5, 3) + table(5, 4) + table(5, 5) + table(5, 6) + table(5, 7) + table(5, 8) + table(5, 9) + table(5, 10)
6589    lin5$ = ""
6590    count = 0
6591     For index = 1 To 10
6592         If index = 10 And Mid$(mas5$, index, 1) = "+" Then
6593             count = count + 1
6594             lin5$ = lin5$ + LTrim$(Str$(count))
6595         End If
6596         If index < 10 And Mid$(mas5$, index, 1) = "+" Then
6597             count = count + 1
6598         End If
6599         If Mid$(mas5$, index, 1) <> "+" And count = 0 Then
6600             lin5$ = lin5$ + Mid$(mas5$, index, 1)
6601         End If
6602         If Mid$(mas5$, index, 1) <> "+" And count > 0 Then
6603             lin5$ = lin5$ + LTrim$(Str$(count))
6604             lin5$ = lin5$ + Mid$(mas5$, index, 1)
6605            count = 0
6606         End If
6607     Next index
6608
6609    mas6$ = table(6, 1) + table(6, 2) + table(6, 3) + table(6, 4) + table(6, 5) + table(6, 6) + table(6, 7) + table(6, 8) + table(6, 9) + table(6, 10)
6610    lin6$ = ""
6611    count = 0
6612     For index = 1 To 10
6613         If index = 10 And Mid$(mas6$, index, 1) = "+" Then
6614             count = count + 1
6615             lin6$ = lin6$ + LTrim$(Str$(count))
6616         End If
6617         If index < 10 And Mid$(mas6$, index, 1) = "+" Then
6618             count = count + 1
6619         End If
6620         If Mid$(mas6$, index, 1) <> "+" And count = 0 Then
6621             lin6$ = lin6$ + Mid$(mas6$, index, 1)
6622         End If
6623         If Mid$(mas6$, index, 1) <> "+" And count > 0 Then
6624             lin6$ = lin6$ + LTrim$(Str$(count))
6625             lin6$ = lin6$ + Mid$(mas6$, index, 1)
6626            count = 0
6627         End If
6628     Next index
6629
6630    mas7$ = table(7, 1) + table(7, 2) + table(7, 3) + table(7, 4) + table(7, 5) + table(7, 6) + table(7, 7) + table(7, 8) + table(7, 9) + table(7, 10)
6631    lin7$ = ""
6632    count = 0
6633     For index = 1 To 10
6634         If index = 10 And Mid$(mas7$, index, 1) = "+" Then
6635             count = count + 1
6636             lin7$ = lin7$ + LTrim$(Str$(count))
6637         End If
6638         If index < 10 And Mid$(mas7$, index, 1) = "+" Then
6639             count = count + 1
6640         End If
6641         If Mid$(mas7$, index, 1) <> "+" And count = 0 Then
6642             lin7$ = lin7$ + Mid$(mas7$, index, 1)
6643         End If
6644         If Mid$(mas7$, index, 1) <> "+" And count > 0 Then
6645             lin7$ = lin7$ + LTrim$(Str$(count))
6646             lin7$ = lin7$ + Mid$(mas7$, index, 1)
6647            count = 0
6648         End If
6649     Next index
6650
6651    mas8$ = table(8, 1) + table(8, 2) + table(8, 3) + table(8, 4) + table(8, 5) + table(8, 6) + table(8, 7) + table(8, 8) + table(8, 9) + table(8, 10)
6652    lin8$ = ""
6653    count = 0
6654     For index = 1 To 10
6655         If index = 10 And Mid$(mas8$, index, 1) = "+" Then
6656             count = count + 1
6657             lin8$ = lin8$ + LTrim$(Str$(count))
6658         End If
6659         If index < 10 And Mid$(mas8$, index, 1) = "+" Then
6660             count = count + 1
6661         End If
6662         If Mid$(mas8$, index, 1) <> "+" And count = 0 Then
6663             lin8$ = lin8$ + Mid$(mas8$, index, 1)
6664         End If
6665         If Mid$(mas8$, index, 1) <> "+" And count > 0 Then
6666             lin8$ = lin8$ + LTrim$(Str$(count))
6667             lin8$ = lin8$ + Mid$(mas8$, index, 1)
6668            count = 0
6669         End If
6670     Next index
6671
6672    mas9$ = table(9, 1) + table(9, 2) + table(9, 3) + table(9, 4) + table(9, 5) + table(9, 6) + table(9, 7) + table(9, 8) + table(9, 9) + table(9, 10)
6673    lin9$ = ""
6674    count = 0
6675     For index = 1 To 10
6676         If index = 10 And Mid$(mas9$, index, 1) = "+" Then
6677             count = count + 1
6678             lin9$ = lin9$ + LTrim$(Str$(count))
6679         End If
6680         If index < 10 And Mid$(mas9$, index, 1) = "+" Then
6681             count = count + 1
6682         End If
6683         If Mid$(mas9$, index, 1) <> "+" And count = 0 Then
6684             lin9$ = lin9$ + Mid$(mas9$, index, 1)
6685         End If
6686         If Mid$(mas9$, index, 1) <> "+" And count > 0 Then
6687             lin9$ = lin9$ + LTrim$(Str$(count))
6688             lin9$ = lin9$ + Mid$(mas9$, index, 1)
6689            count = 0
6690         End If
6691     Next index
6692
6693    mas0$ = table(10, 1) + table(10, 2) + table(10, 3) + table(10, 4) + table(10, 5) + table(10, 6) + table(10, 7) + table(10, 8) + table(10, 9) + table(10, 10)
6694    lin0$ = ""
6695    count = 0
6696     For index = 1 To 10
6697         If index = 10 And Mid$(mas0$, index, 1) = "+" Then
6698             count = count + 1
6699             lin0$ = lin0$ + LTrim$(Str$(count))
6700         End If
6701         If index < 10 And Mid$(mas0$, index, 1) = "+" Then
6702             count = count + 1
6703         End If
6704         If Mid$(mas0$, index, 1) <> "+" And count = 0 Then
6705             lin0$ = lin0$ + Mid$(mas0$, index, 1)
6706         End If
6707         If Mid$(mas0$, index, 1) <> "+" And count > 0 Then
6708             lin0$ = lin0$ + LTrim$(Str$(count))
6709             lin0$ = lin0$ + Mid$(mas0$, index, 1)
6710            count = 0
6711         End If
6712     Next index
6713
6714    fen$ = lin0$ + "/" + lin9$ + "/" + lin8$ + "/" + lin7$ + "/" + lin6$ + "/" + lin5$ + "/" + lin4$ + "/" + lin3$ + "/" + lin2$ + "/" + lin1$
6715
6716     Color 10
6717     Locate 2, 1: Print "              Press any key to display the Forsyth-Edwards notation                    "
6718     Do
6719     Loop Until InKey$ <> ""
6720     Locate 2, 1: Print "                                                                                       "
6721     Color 12
6722     Locate 2, 23: Print fen$
6723
6724     Do
6725     Loop Until InKey$ <> ""
6726
6727     SetTextClpbrd (fen$)
6728
6729     System
6730 End Sub
6731
6732 Sub message ()
6733     Locate 2, 1: Color 9: Print "    SPACEBAR - next pair"; "       ENTER - display notation       "; "ESCAPE - exit    "
6734     Locate 2, 5: Color 5: Print "SPACEBAR": Locate 2, 32: Color 5: Print "ENTER": Locate 2, 63: Color 5: Print "ESCAPE"
6735 End Sub
6736
6737 SUB SetTextClpbrd (Text AS STRING)
6738
6739  IF OpenClipboard(0) THEN
6740    DIM Dln AS INTEGER  
6741    DIM ClpID AS HANDLE
6742    DIM PtToDat AS HGLOBAL
6743
6744     Dln = len(Text) + 1
6745     PtToDat = GlobalAlloc(GMEM_MOVEABLE, Dln)
6746   
6747     memcpy(GlobalLock(PtToDat), SADD(Text), Dln)
6748     GlobalUnlock(PtToDat)
6749
6750     EmptyClipboard ()
6751     ClpID = SetClipboardData (CF_OEMTEXT, PtToDat)
6752
6753     CloseClipboard ()
6754     GlobalFree(PtToDat)
6755  END IF
6756
6757 END SUB