0 ' exit on error
1 CLEAR ,,2048:KEY OFF
2 CLS:COLOR 0,7:LOCATE 1,6:PRINT SPACE$(68)
3 LOCATE 2,6:PRINT" ********* Chess *********   By: M. C. Rakaska, Ides of March, 1980 "
4 LOCATE 3,6:PRINT SPACE$(68):LOCATE 4,6:PRINT"      Adapted for the IBM PC by  S. W. Huggins, December, 1981      "
5 LOCATE 5,6:PRINT SPACE$(68)
6 LOCATE 6,6:PRINT"                                      "
12 LOCATE 7,6:PRINT SPACE$(68):LOCATE 8,6:PRINT"  PC-NET #1 of Denver, Co.   303-773-2699 or Voice at 303-694-9038  "
13 LOCATE 9,6:PRINT SPACE$(68)
20 DEFINT A-Z:A=0:B=0:X=0:Y=0:S=0:A0=0:T=0:A8=0:A1=0:A2=0:A3=0:A4=0:B1=0:B6!=0:           H=0:M=0:N=0:P=0:W=0:A5=0:I=1
22 DIM C(64), A(10,10), B(10,10), T(10,10), S(8,8)
25 COLOR 7,0:LOCATE 18,1:PRINT"Important:  Use Caps Lock key to shift to UPPER CASE before continuing...."
30 LOCATE 21,1:INPUT "DO YOU WANT INSTRUCTIONS ";IN$:IN$=LEFT$(IN$,1):             IF IN$="Y" THEN GOSUB 2220
40 CL$="N"
50 CLS:INPUT "YOUR NAME IS ";B$:IF B$="" THEN B$=" HUMAN " ELSE B$=LEFT$(B$,9)
60 CLS:PRINT "LEVEL OF PLAY";:INPUT B8!:IF B8!=0 THEN B8!=1:B7!=1+RND(0)/2:ELSE    B7!=(B8!+1)/2+RND(0)/2
70 CLS:PRINT "DO YOU WANT WHITE ";B$;" ";:INPUT C$:GOSUB 790:IF LEFT$(C$,1)<>"N"   THEN GOSUB 900:GOTO 190
80 GOSUB 890:IF CL$="Y" THEN LOCATE 25,6,0:                                        PRINT "START ";TIME$;
100 F!=-99:A0=0:FOR J=1 TO 8:FOR K=1 TO 8:IF A(J,K)=99 THEN A6=J:A7=K
110 NEXT:NEXT
120 FOR X=1 TO 8:FOR Y=1 TO 8:IF A(X,Y)<0 THEN GOSUB 270:                           IF F!>=B7! THEN GOTO 150
130 NEXT:NEXT:IF F!>=-9 THEN GOTO 150 ELSE GOSUB 900
140 LOCATE 25,62,0: PRINT "I CONCEED    ";:GOTO 2190
150 A(R,U)=A(E,Q):A(E,Q)=1:IF A(R,U)=-2 AND U=1 THEN A(R,U)=-9
160 X=R:Y=U:A0=4:GOSUB 270:LOCATE 25,62,0:PRINT "IS MY MOVE    ";:                  LOCATE 25,51,0:PRINT CHR$(E+64);Q;"- "CHR$(R+64);U;
170 IF CL$="Y" THEN LOCATE 25,31,0:PRINT "STOP ";TIME$;
180 X=E:Y=Q:GOSUB 910:X=R:Y=U:GOSUB 910:IF C=1 THEN LOCATE 24,1,1:                  PRINT "CHECK ";:C=0 ELSE LOCATE 24,1,1:PRINT "      ";
190 IF X$="S" THEN GOSUB 1830:B7!=3*RND(0):LOCATE 25,1,1:PRINT "SELF-PLAYING";: GOSUB 2480:GOTO 100
195 LOCATE 25,1,1:PRINT "MOVE "+CHR$(7);B$;:GOSUB 1590:D=0:B4=A:B9=B:B5=0:IF A(X,Y)=2 AND Y=5 AND B=6 AND A(A,B)=1 AND ABS(A-X)=1 THEN B5=1:GOTO 220
200 IF X$="K" OR X$="Q" THEN GOSUB 900:LOCATE 25,1,0:PRINT STRING$(14," ");:        GOTO 100
210 IF X$="S" THEN CL$="N":GOTO 190:ELSE A0=3:GOSUB 250:                            IF D=0 THEN LOCATE 25,31,0:PRINT "ILLEGAL       ";:GOTO 190
220 LOCATE 25,31,1:PRINT "OK            ";:A=B4:B=B9:A(A,B)=A(X,Y):A(X,Y)=1:        GOSUB 910:X=A:Y=B:GOSUB 910:IF N$="N" THEN GOSUB 900:N$=" "
230 IF A(A,B)=2 AND B=8 THEN LOCATE 25,31,1:PRINT "WHAT PIECE";:GOSUB 2100:         X=A:Y=B:GOSUB 910:LOCATE 25,31,1:PRINT "              ";
240 IF B5=1 THEN A(A,B-1)=1:X=A:Y=B-1:GOSUB 910:GOTO 100:ELSE GOTO 100
250 LOCATE 1,78,0:PRINT "$ ";:                                                      ON A(X,Y) GOTO 0, 480, 0, 380, 330, 0, 280, 0, 330:GOTO 460
270 ON -A(X,Y) GOTO 0, 530, 0, 380, 330, 0, 280, 0, 330:GOTO 460
280 B=Y:FOR A=X+1 TO 8:GOSUB 640:IF S=0 THEN NEXT ELSE GOTO 290
290 FOR A=X-1 TO 1 STEP -1:GOSUB 640:IF S=0 THEN NEXT ELSE GOTO 300
300 A=X:FOR B=Y+1 TO 8:GOSUB 640:IF S=0 THEN NEXT ELSE GOTO 310
310 FOR B=Y-1 TO 1 STEP -1:GOSUB 640:IF S=0 THEN NEXT:RETURN ELSE RETURN
330 B=Y:FOR A=X+1 TO 8:B=B+1:GOSUB 640:IF S=0 THEN NEXT ELSE GOTO 340
340 B=Y:FOR A=X-1 TO 1 STEP -1:B=B-1:GOSUB 640:IF S=0 THEN NEXT ELSE GOTO 350
350 B=Y:FOR A=X-1 TO 1 STEP -1:B=B+1:GOSUB 640:IF S=0 THEN NEXT ELSE GOTO 360
360 B=Y:FOR A=X+1 TO 8:B=B-1:GOSUB 640: IF S=0 THEN NEXT ELSE GOTO 370
370 IF ABS(A(X,Y))=9 THEN GOTO 280:ELSE RETURN
380 A=X+2:B=Y+1:IF A<9 AND B<9 THEN GOSUB 650 ELSE GOTO 390
390 B=B-2:IF B>0 AND A<9 THEN GOSUB 650 ELSE GOTO 400
400 A=A-4:IF A>0 AND B>0 THEN GOSUB 650 ELSE GOTO 410
410 B=B+2:IF B<9 AND A>0 THEN GOSUB 650 ELSE GOTO 420
420 A=A+1:B=B+1:IF A>0 AND A<9 AND B<9 THEN GOSUB 650 ELSE GOTO 430
430 B=B-4:IF B>0 AND A>0 AND A<9 THEN GOSUB 650 ELSE GOTO 440
440 A=A+2:IF A>0 AND A<9 AND B>0 THEN GOSUB 650 ELSE GOTO 450
450 B=B+4:IF B<9 AND A>0 AND A<9 THEN GOSUB 650:RETURN ELSE RETURN
460 FOR A=X-1 TO X+1:FOR B=Y-1 TO Y+1:IF A(A,B)<>0 THEN GOSUB 650
470 NEXT:NEXT:RETURN
480 A=X:IF Y>2 THEN GOTO 500 ELSE GOTO 490
490 B=Y+1:IF A(A,B)=1 THEN GOSUB 660:B=B+1:IF A(A,B)=1 THEN GOSUB 660:GOTO 510:     ELSE GOTO 510:ELSE GOTO 510
500 B=Y+1:IF A(A,B)=1 THEN GOSUB 660 ELSE GOTO 510
510 A=X+1:B=Y+1:IF A(A,B)<0 THEN GOSUB 660 ELSE GOTO 520
520 A=A-2:IF A(A,B)<0 THEN GOSUB 660:RETURN:ELSE RETURN
530 A=X:IF Y<7 THEN GOTO 550 ELSE GOTO 540
540 B=Y-1:IF A(A,B)=1 THEN GOSUB 660:B=B-1:IF A(A,B)=1 THEN GOSUB 660:GOTO 560:     ELSE GOTO 560:ELSE GOTO 560
550 B=Y-1:IF A(A,B)=1 THEN GOSUB 660 ELSE GOTO 560
560 A=X-1:B=Y-1:IF A(A,B)>1 THEN GOSUB 660 ELSE GOTO 570
570 A=A+2:IF A(A,B)>1 THEN GOSUB 660:RETURN:ELSE GOTO 590
580 T=A(A,B):IF T=-99 THEN B1=T:RETURN:ELSE GOTO 590
590 A5=S:IF ABS(T)<=A(X,Y) THEN A(A,B)=A(X,Y):A(X,Y)=1:GOTO 610:ELSE GOTO 600
600 IF T1 THEN GOSUB 250
740 NEXT:NEXT:X=N:Y=H:A0=1:GOSUB 270:A0=0:S=B3:X=W:Y=M:A=N:B=H:A(X,Y)=A(A,B):       A(A,B)=P
750 B6!=1/(ABS(4.5-A)+ABS(4.5-B)+1):IF A(X,Y)<-2 AND A(X,Y)>-9 THEN                 B6!=B6!+1/(ABS(A6-A)+ABS(A7-B)+5)+RND(0)/15
760 G!=P+B1+B6!:IF P=99 THEN GOSUB 900:                                             LOCATE 25,1,1:PRINT "MATE ";B$;:GOTO 2190
770 IF G!<=F! THEN RETURN
780 F!=G!:E=X:Q=Y:R=A:U=B:RETURN
790 CLS
800 Y=0:FOR J=896 TO 0 STEP -128:Y=Y+1:X=0:FOR K=J TO 42+J STEP 6:X=X+1:            T(X,Y)=K:NEXT:NEXT
810 Y=0:FOR J=960 TO 64 STEP -128:Y=Y+1:X=0:FOR K=J TO 42+J STEP 6:X=X+1:            B(X,Y)=K:NEXT:NEXT
820 DATA -7, -4, -5, -9, -99, -5, -4, -7
830 DATA -2, -2, -2, -2, -2, -2, -2, -2
840 DATA 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
850 DATA 2, 2, 2, 2, 2, 2, 2, 2
860 DATA 7, 4, 5, 9, 99, 5, 4, 7
870 FOR Y=8 TO 1 STEP -1:FOR X=1 TO 7 STEP 2:S(X,Y)=I:S(X+1,Y)=-I:NEXT:I=-I:NEXT
880 FOR Y=8 TO 1 STEP -1:FOR X=1 TO 8:READ A(X,Y):NEXT:NEXT:RETURN
890 I=-I:A(4,1)=99:A(5,1)=9:A(4,8)=-99:A(5,8)=-9
900 FOR Y=1 TO 8:FOR X=1 TO 8:GOSUB 910:NEXT:NEXT:RETURN
910 IF S(X,Y)>0 THEN GOTO 940
920 ON ABS(A(X,Y)) GOSUB 980, 1040, 0, 1340, 1440, 0, 1540, 0, 1140                   :IF ABS(A(X,Y))=99 THEN GOSUB 1240:RETURN ELSE RETURN
940 ON ABS(A(X,Y)) GOSUB 960, 990, 0, 1290, 1390, 0, 1490, 0, 1090                    :IF ABS(A(X,Y))=99 THEN GOSUB 1190:RETURN ELSE RETURN
960 IF S(X,Y)<0 THEN GOTO 980
970 LOCATE 25-Y*3,X*8+1,0
971 PRINT STRING$(8,CHR$(219));
972 LOCATE 26-Y*3,X*8+1,0
973 PRINT STRING$(8,CHR$(219));
974 LOCATE 27-Y*3,X*8+1,0
975 PRINT STRING$(8,CHR$(219));:RETURN
980 LOCATE 25-Y*3,X*8+1,0
981 PRINT STRING$(8," ");
982 LOCATE 26-Y*3,X*8+1,0
983 PRINT STRING$(8," ");
984 LOCATE 27-Y*3,X*8+1,0
985 PRINT STRING$(8," ");:RETURN
990 IF I*A(X,Y)<0 THEN GOTO 1020
1000 LOCATE 25-Y*3,X*8+1,0
1001 PRINT STRING$(8,CHR$(219));
1010 LOCATE 26-Y*3,X*8+1,0
1011 PRINT STRING$(3,CHR$(219));CHR$(2);STRING$(4,CHR$(219));
1012 LOCATE 27-Y*3,X*8+1,0
1013 PRINT STRING$(8,CHR$(219)):RETURN
1020 LOCATE 25-Y*3,X*8+1,0
1021 PRINT STRING$(8,CHR$(219));
1030 LOCATE 26-Y*3,X*8+1,0
1031 PRINT STRING$(3,CHR$(219));CHR$(1);STRING$(4,CHR$(219));
1032 LOCATE 27-Y*3,X*8+1,0
1033 PRINT STRING$(8,CHR$(219));:RETURN
1040 IF I*A(X,Y)<0 THEN GOTO 1070
1050 LOCATE 25-Y*3,X*8+1,0
1051 PRINT STRING$(8,CHR$(32));
1060 LOCATE 26-Y*3,X*8+1,0
1061 PRINT STRING$(3,CHR$(32));CHR$(2);STRING$(4,CHR$(32));
1062 LOCATE 27-Y*3,X*8+1,0
1063 PRINT STRING$(8,CHR$(32)):RETURN
1070 LOCATE 25-Y*3,X*8+1,0
1071 PRINT STRING$(8,CHR$(32));
1080 LOCATE 26-Y*3,X*8+1,0
1081 PRINT STRING$(3,CHR$(32));CHR$(1);STRING$(4,CHR$(32));
1082 LOCATE 27-Y*3,X*8+1,0
1083 PRINT STRING$(8,CHR$(32));:RETURN
1090 IF I*A(X,Y)<0 THEN GOTO 1120
1100 LOCATE 25-Y*3,X*8+1,0
1101 PRINT STRING$(2,CHR$(219));STRING$(3,CHR$(178));STRING$(3,CHR$(219));
1110 LOCATE 26-Y*3,X*8+1,0
1111 PRINT CHR$(219)+"QUEEN"+CHR$(219);CHR$(219);
1112 LOCATE 27-Y*3,X*8+1,0
1113 PRINT STRING$(2,CHR$(219));STRING$(3,CHR$(178));STRING$(3,CHR$(219));          :RETURN
1120 LOCATE 25-Y*3,X*8+1,0
1121 PRINT STRING$(2,CHR$(219));STRING$(3,CHR$(176));STRING$(3,CHR$(219));
1130 LOCATE 26-Y*3,X*8+1,0
1131 PRINT CHR$(219)+"QUEEN"+CHR$(219);CHR$(219);
1132 LOCATE 27-Y*3,X*8+1,0
1133 PRINT STRING$(2,CHR$(219));STRING$(3,CHR$(176));STRING$(3,CHR$(219));          :RETURN
1140 IF I*A(X,Y)<0 THEN GOTO 1170
1150 LOCATE 25-Y*3,X*8+1,0
1151 PRINT STRING$(2,CHR$(32));STRING$(3,CHR$(178));STRING$(3,CHR$(32));
1160 LOCATE 26-Y*3,X*8+1,0
1161 PRINT CHR$(32)+"QUEEN"+CHR$(32);CHR$(32);
1162 LOCATE 27-Y*3,X*8+1,0
1163 PRINT STRING$(2,CHR$(32));STRING$(3,CHR$(178));STRING$(3,CHR$(32));            :RETURN
1170 LOCATE 25-Y*3,X*8+1,0
1171 PRINT STRING$(2,CHR$(32));STRING$(3,CHR$(176));STRING$(3,CHR$(32));
1180 LOCATE 26-Y*3,X*8+1,0
1181 PRINT CHR$(32)+"QUEEN"+CHR$(32);CHR$(32);
1182 LOCATE 27-Y*3,X*8+1,0
1183 PRINT STRING$(2,CHR$(32));STRING$(3,CHR$(176));STRING$(3,CHR$(32));            :RETURN
1190 IF I*A(X,Y)<0 THEN GOTO 1220
1200 LOCATE 25-Y*3,X*8+1,0
1201 PRINT STRING$(2,CHR$(219));STRING$(4,CHR$(178));STRING$(2,CHR$(219));
1210 LOCATE 26-Y*3,X*8+1,0
1211 PRINT CHR$(219);CHR$(178)+"KING"+CHR$(178);CHR$(219);
1212 LOCATE 27-Y*3,X*8+1,0
1213 PRINT STRING$(2,CHR$(219));STRING$(4,CHR$(178));STRING$(2,CHR$(219));          :RETURN
1220 LOCATE 25-Y*3,X*8+1,0
1221 PRINT STRING$(2,CHR$(219));STRING$(4,CHR$(176));STRING$(2,CHR$(219));
1230 LOCATE 26-Y*3,X*8+1,0
1231 PRINT CHR$(219);CHR$(176)+"KING"+CHR$(176);CHR$(219);
1232 LOCATE 27-Y*3,X*8+1,0
1233 PRINT STRING$(2,CHR$(219));STRING$(4,CHR$(176));STRING$(2,CHR$(219));          :RETURN
1240 IF I*A(X,Y)<0 THEN GOTO 1270
1250 LOCATE 25-Y*3,X*8+1,0
1251 PRINT STRING$(2,CHR$(32));STRING$(4,CHR$(178));STRING$(2,CHR$(32));
1260 LOCATE 26-Y*3,X*8+1,0
1261 PRINT CHR$(32);CHR$(178)+"KING"+CHR$(178);CHR$(32);
1262 LOCATE 27-Y*3,X*8+1,0
1263 PRINT STRING$(2,CHR$(32));STRING$(4,CHR$(178));STRING$(2,CHR$(32));            :RETURN
1270 LOCATE 25-Y*3,X*8+1,0
1271 PRINT STRING$(2,CHR$(32));STRING$(4,CHR$(176));STRING$(2,CHR$(32));
1280 LOCATE 26-Y*3,X*8+1,0
1281 PRINT CHR$(32);CHR$(176)+"KING"+CHR$(176);CHR$(32);
1282 LOCATE 27-Y*3,X*8+1,0
1283 PRINT STRING$(2,CHR$(32));STRING$(4,CHR$(176));STRING$(2,CHR$(32));            :RETURN
1290 IF I*A(X,Y)<0 THEN GOTO 1320
1300 LOCATE 25-Y*3,X*8+1,0
1301 PRINT STRING$(3,CHR$(219));STRING$(2,CHR$(178));STRING$(3,CHR$(219));
1310 LOCATE 26-Y*3,X*8+1,0
1311 PRINT CHR$(219)+"KNIGHT"+CHR$(219);
1312 LOCATE 27-Y*3,X*8+1,0
1313 PRINT STRING$(3,CHR$(219));STRING$(2,CHR$(178));STRING$(3,CHR$(219));          :RETURN
1320 LOCATE 25-Y*3,X*8+1,0
1321 PRINT STRING$(3,CHR$(219));STRING$(2,CHR$(176));STRING$(3,CHR$(219));
1330 LOCATE 26-Y*3,X*8+1,0
1331 PRINT CHR$(219)+"KNIGHT"+CHR$(219);
1332 LOCATE 27-Y*3,X*8+1,0
1333 PRINT STRING$(3,CHR$(219));STRING$(2,CHR$(176));STRING$(3,CHR$(219));          :RETURN
1340 IF I*A(X,Y)<0 THEN GOTO 1370
1350 LOCATE 25-Y*3,X*8+1,0
1351 PRINT STRING$(3,CHR$(32));STRING$(2,CHR$(178));STRING$(3,CHR$(32));
1360 LOCATE 26-Y*3,X*8+1,0
1361 PRINT CHR$(32)+"KNIGHT"+CHR$(32);
1362 LOCATE 27-Y*3,X*8+1,0
1363 PRINT STRING$(3,CHR$(32));STRING$(2,CHR$(178));STRING$(3,CHR$(32));            :RETURN
1370 LOCATE 25-Y*3,X*8+1,0
1371 PRINT STRING$(3,CHR$(32));STRING$(2,CHR$(176));STRING$(3,CHR$(32));
1380 LOCATE 26-Y*3,X*8+1,0
1381 PRINT CHR$(32)+"KNIGHT"+CHR$(32);
1382 LOCATE 27-Y*3,X*8+1,0
1383 PRINT STRING$(3,CHR$(32));STRING$(2,CHR$(176));STRING$(3,CHR$(32));            :RETURN
1390 IF I*A(X,Y)<0 THEN GOTO 1420
1400 LOCATE 25-Y*3,X*8+1,0
1401 PRINT STRING$(3,CHR$(219));STRING$(2,CHR$(178));STRING$(3,CHR$(219));
1410 LOCATE 26-Y*3,X*8+1,0
1411 PRINT CHR$(219)+"BISHOP"+CHR$(219);
1412 LOCATE 27-Y*3,X*8+1,0
1413 PRINT STRING$(3,CHR$(219));STRING$(2,CHR$(178));STRING$(3,CHR$(219));          :RETURN
1420 LOCATE 25-Y*3,X*8+1,0
1421 PRINT STRING$(3,CHR$(219));STRING$(2,CHR$(176));STRING$(3,CHR$(219));
1430 LOCATE 26-Y*3,X*8+1,0
1431 PRINT CHR$(219)+"BISHOP"+CHR$(219);
1432 LOCATE 27-Y*3,X*8+1,0
1433 PRINT STRING$(3,CHR$(219));STRING$(2,CHR$(176));STRING$(3,CHR$(219));          :RETURN
1440 IF I*A(X,Y)<0 THEN GOTO 1470
1450 LOCATE 25-Y*3,X*8+1,0
1451 PRINT STRING$(3,CHR$(32));STRING$(2,CHR$(178));STRING$(3,CHR$(32));
1460 LOCATE 26-Y*3,X*8+1,0
1461 PRINT CHR$(32)+"BISHOP"+CHR$(32);
1462 LOCATE 27-Y*3,X*8+1,0
1463 PRINT STRING$(3,CHR$(32));STRING$(2,CHR$(178));STRING$(3,CHR$(32));            :RETURN
1470 LOCATE 25-Y*3,X*8+1,0
1471 PRINT STRING$(3,CHR$(32));STRING$(2,CHR$(176));STRING$(3,CHR$(32));
1480 LOCATE 26-Y*3,X*8+1,0
1481 PRINT CHR$(32)+"BISHOP"+CHR$(32);
1482 LOCATE 27-Y*3,X*8+1,0
1483 PRINT STRING$(3,CHR$(32));STRING$(2,CHR$(176));STRING$(3,CHR$(32));            :RETURN
1490 IF I*A(X,Y)<0 THEN GOTO 1520
1500 LOCATE 25-Y*3,X*8+1,0
1501 PRINT CHR$(219);CHR$(219);CHR$(178);CHR$(219);CHR$(219);CHR$(178);              CHR$(219);CHR$(219);
1510 LOCATE 26-Y*3,X*8+1,0
1511 PRINT CHR$(219);CHR$(219)+"ROOK"+CHR$(219);CHR$(219);
1512 LOCATE 27-Y*3,X*8+1,0
1513 PRINT STRING$(2,CHR$(219));STRING$(4,CHR$(178));STRING$(2,CHR$(219));          :RETURN
1520 LOCATE 25-Y*3,X*8+1,0
1521 PRINT CHR$(219);CHR$(219);CHR$(176);CHR$(219);CHR$(219);CHR$(176);              CHR$(219);CHR$(219);
1530 LOCATE 26-Y*3,X*8+1,0
1531 PRINT CHR$(219);CHR$(219)+"ROOK"+CHR$(219);CHR$(219);
1532 LOCATE 27-Y*3,X*8+1,0
1533 PRINT STRING$(2,CHR$(219));STRING$(4,CHR$(176));STRING$(2,CHR$(219));          :RETURN
1540 IF I*A(X,Y)<0 THEN GOTO 1570
1550 LOCATE 25-Y*3,X*8+1,0
1551 PRINT CHR$(32);CHR$(32);CHR$(178);CHR$(32);CHR$(32);CHR$(178);                  CHR$(32);CHR$(32);
1560 LOCATE 26-Y*3,X*8+1,0
1561 PRINT CHR$(32);CHR$(32)+"ROOK"+CHR$(32);CHR$(32);
1562 LOCATE 27-Y*3,X*8+1,0
1563 PRINT STRING$(2,CHR$(32));STRING$(4,CHR$(178));STRING$(2,CHR$(32));            :RETURN
1570 LOCATE 25-Y*3,X*8+1,0
1571 PRINT CHR$(32);CHR$(32);CHR$(176);CHR$(32);CHR$(32);CHR$(176);                  CHR$(32);CHR$(32);
1580 LOCATE 26-Y*3,X*8+1,0
1581 PRINT CHR$(32);CHR$(32)+"ROOK"+CHR$(32);CHR$(32);
1582 LOCATE 27-Y*3,X*8+1,0
1583 PRINT STRING$(2,CHR$(32));STRING$(4,CHR$(176));STRING$(2,CHR$(32));            :RETURN
1590 LOCATE 25,31,1:PRINT STRING$(10," ");
1600 X$=INKEY$:IF X$="N" THEN N$=X$
1610 IF X$>="A" AND X$<="H" THEN X=VAL(CHR$(ASC(X$)-16)):GOTO 1730
1620 IF X$="N" THEN GOSUB 2030
1630 IF X$="K" AND A(5,1)=99 AND A(8,1)=7 THEN A(5,1)=1:A(8,1)=1:A(7,1)=99          :A(6,1)=7:GOTO 1800
1640 IF X$="Q" AND A(5,1)=99 AND A(1,1)=7 THEN A(5,1)=1:A(1,1)=1:A(3,1)=99          :A(4,1)=7:GOTO 1800
1650 IF X$="K" AND A(4,1)=99 AND A(1,1)=7 THEN A(4,1)=1:A(1,1)=1:A(2,1)=99          :A(3,1)=7:GOTO 1800
1660 IF X$="Q" AND A(4,1)=99 AND A(8,1)=7 THEN A(4,1)=1:A(8,1)=1:A(6,1)=99          :A(5,1)=7:GOTO 1800
1670 IF X$="X" THEN GOSUB 1830:LOCATE 25,1,0:PRINT "EXCHANGING         ";           :GOSUB 2480:IF CL$="Y" THEN LOCATE 25,50,0:PRINT "START ";TIME$;:GOTO 100       :ELSE:GOTO 100
1680 IF X$="S" THEN GOTO 1820
1690 IF X$="M" THEN GOSUB 1840
1700 IF X$="I" THEN GOSUB 2220:CLS:GOSUB 900:LOCATE 25,1,1                          :PRINT "MOVE "+CHR$(7);B$;
1710 IF X$="L" THEN GOSUB 2040
1720 GOTO 1600
1730 LOCATE 25,21,1:PRINT X$;:LOCATE 25,31,1:PRINT "            ";
1740 Y=VAL(INKEY$):IF Y=0 THEN GOTO 1740
1750 LOCATE 25,22,1:PRINT Y;:LOCATE 25,25,1:PRINT "-";
1760 IF A(X,Y)<2 OR A(X,Y)>99 THEN LOCATE 25,31,1:PRINT "ENTRY ERROR ";             :GOTO 1590
1770 A$=INKEY$:IF A$<"A" OR A$>"H" THEN GOTO 1770 ELSE A=VAL(CHR$(ASC(A$)-16))
1780 LOCATE 25,27,1:PRINT A$;
1790 B=VAL(INKEY$):IF B=0 THEN GOTO 1790 ELSE LOCATE 25,28,1:PRINT B;
1800 IF X$="K" OR X$="Q" THEN LOCATE 25,20,1:PRINT "CSTL. ";X$;"-SIDE";             :GOSUB 1830 ELSE GOSUB 1830
1810 IF CL$="Y" THEN LOCATE 25,50,0:PRINT "START ";TIME$;
1820 RETURN
1830 LOCATE 25,1,1:PRINT STRING$(79," ");:RETURN
1840 GOSUB 1830:LOCATE 25,1,1:PRINT "MODIFYING          ";
1850 GOSUB 2010:IF M$<"A" OR M$>"H" THEN GOTO 1850
1860 X=VAL(CHR$(ASC(M$)-16)):LOCATE 25,21,1:PRINT M$;
1870 M$=INKEY$:IF M$<"1" OR M$>"8" THEN GOTO 1870
1880 Y=VAL(M$):LOCATE 25,23,1:PRINT M$;" = ";
1890 M$=INKEY$:IF M$="C" OR M$="P" OR M$="E" THEN S1$=M$:LOCATE 25,27,1             :PRINT M$;:ELSE GOTO 1890
1900 M$=INKEY$:IF M$="S" OR M$="P" OR M$="N" OR M$="B" OR M$="R" OR M$="Q" OR        M$="K" THEN V$=M$:LOCATE 25,29,1:PRINT M$; ELSE GOTO 1900
1910 IF V$="P" THEN V1=2
1920 IF V$="N" THEN V1=4
1930 IF V$="B" THEN V1=5
1940 IF V$="R" THEN V1=7
1950 IF V$="Q" THEN V1=9
1960 IF V$="K" THEN V1=99
1970 IF V$="S" THEN V1=1
1980 IF S1$="C" AND V1<>1 THEN V1=-V1
1990 A(X,Y)=V1:IF S1$="E" THEN A(X,Y)=1
2000 GOSUB 910:GOTO 1840
2010 M$=INKEY$:IF M$="N" THEN GOSUB 2030:GOTO 2010:ELSE IF M$="Z" THEN               GOSUB 1830:LOCATE 25,20,1:PRINT "         ";:GOSUB 900:ELSE RETURN
2020 IF CL$="Y" THEN LOCATE 25,51,0:PRINT "START ";TIME$;:GOTO 100 ELSE GOTO 100
2030 FOR J=1 TO 8:FOR K=1 TO 8:K$=STR$(K)
2031 LOCATE 27-K*3,J*8+1,0
2032 PRINT CHR$(J+64);RIGHT$(K$,1);:NEXT:NEXT:RETURN
2040 GOSUB 1830:LOCATE 25,20,1:PRINT "LEVEL=";B8!;:PRINT "CHANGE LEVELS?";
2050 C$=INKEY$:IF C$="N" THEN GOTO 2090 ELSE IF C$="Y" THEN LOCATE 25,27,1          :PRINT "       ";:GOSUB 1830:ELSE GOTO 2050
2060 L1$=INKEY$:IF L1$="" THEN GOTO 2060 ELSE IF L1$>="0" AND L1$<="9" THEN          LOCATE 25,27,1:PRINT L1$;:ELSE GOTO 2060
2070 L2$=INKEY$:IF L2$="" THEN GOTO 2070 ELSE IF L2$<"0" OR L2$>"9" THEN L2$=L1$    :L1$="0"
2080 B8!=VAL(L1$)*10+VAL(L2$):B7!=B8!/2:LOCATE 25,27,0:PRINT L1$;L2$;
2090 GOSUB 1830:LOCATE 25,20,0:PRINT "              ";:LOCATE 25,1,1                :PRINT "MOVE ";B$;:RETURN
2100 REM *** PROMOTION ROUTINE ***
2110 LOCATE 2,1,1:PRINT "P, N, B, R, Q ";
2120 Z$=INKEY$:IF Z$="P" THEN A(A,B)=2:GOTO 2180
2130 IF Z$="N" THEN A(A,B)=4:GOTO 2180
2140 IF Z$="B" THEN A(A,B)=5:GOTO 2180
2150 IF Z$="R" THEN A(A,B)=7:GOTO 2180
2160 IF Z$="Q" THEN A(A,B)=9:GOTO 2180
2170 GOTO 2120
2180 RETURN
2190 IF CL$="Y" THEN LOCATE 25,61,1:PRINT "STOP ";TIME$;
2200 LOCATE 25,1,1:PRINT "HIT (P) TO PLAY OR HIT (B) FOR BASIC";
2210 A$=INKEY$:IF A$="" THEN GOTO 2210 ELSE IF A$="B" THEN CLS:END                   ELSE IF A$="P" THEN RUN ELSE GOTO 2210
2220 CLS
2221 PRINT "1. USE LIST TO INSURE LOADED RIGHT, THE LAST LINE IS 65529 "
2230 PRINT "2. ALSE NOTE MEMORY SIZE AS A DOUBLE CHECK "
2240 PRINT "3. SPECIAL COMMANDS DURING PLAYER'S MOVE ARE:"
2250 PRINT "   TYPE 'N' - TO NUMBER THE BOARD "
2260 PRINT "        'K' - TO CASTLE KING SIDE "
2270 PRINT "        'Q' - TO CASTLE QUEEN SIDE "
2280 PRINT "        'X' - TO EXCHANGE PIECES AND LET COMPUTER MOVE"
2290 PRINT "        'S' - TO LET THE COMPUTER PLAY BY ITSELF "
2300 PRINT "        'M' - TO MODIFY THE BOARD, ENTER THE SQUARE FOLLOWED BY"
2310 PRINT "                 C, P, OR E  FOR COMPUTER, PLAYER, OR EMPTY"
2320 PRINT "                 AND S,P,N,B,R,Q,K  FOR SQUARE,PAWN, ETC..."
2330 PRINT "        'Z' - TO ESCAPE MODIFY AND LET COMPUTER MOVE"
2340 PRINT "        'I' - TO GET INSTRUCTIONS AGAIN"
2350 PRINT "        'L' - TO LOOK AT OR CHANGE LEVEL OF PLAY"
2360 REM ********************************************************************
2370 INPUT "HIT ENTER TO CONTINUE";EN$:PRINT
2380 PRINT "4. TO PROMOTE TO P,N,B,R,Q ENTER THE LETTER WHEN PROMOTED"
2390 PRINT "5. TO CAPTURE 'EN PASSANT' SPECIFY THE 'FROM' - 'TO' SQUARES"
2400 PRINT "6. LEVELS OF PLAY ARE FROM 01 TO 24"
2410 PRINT "7. COMPUTER ASSUMES MATE IF KING IS LEFT IN CHECK SO BE SURE TO "
2411 PRINT "    WATCH FOR CHECK MESSAGE"
2420 PRINT "8. IF A MOVE IS ILLEGAL OR AN ENTRY ERROR IS MADE SIMPLY TYPE IN"
2421 PRINT "    A NEW MOVE.  A MOVE MAY BE STARTED OVER BY FORCING AN ERROR. (E.G. '9')."
2430 PRINT "9. IF  IS HIT DURING THE GAME, TYPE 'GOSUB 900:CONT' TO"
2435 PRINT "    DRAW BOARD AND CONTINUE"
2440 PRINT "10. YOU HAVE A CHOICE OF BLACK OR WHITE, THE COMPUTER WILL ALWAYS"
2441 PRINT "     BE AT THE TOP OF THE SCREEN"
2450 PRINT:PRINT:INPUT "HIT ENTER TO CONTINUE GAME";EN$
2460 RETURN
2480 I=-I:GOSUB 2490:GOSUB 900:RETURN
2490 L=0:FOR J=1 TO 8:FOR K=1 TO 8:L=L+1:IF A(J,K)<>1 THEN C(L)=-A(J,K)             :ELSE C(L)=A(J,K)
2500 NEXT:NEXT
2510 L=65:FOR J=1 TO 8: FOR K=1 TO 8:L=L-1:A(J,K)=C(L):NEXT:NEXT
2520 RETURN
65529 END