Compucolor.org – Virtual Media

Listing of file='CHESS.BAS;01' on disk='vmedia/chip_138-sideB-sector.ccvf'

20 REM  "CHESS"
30 REM  CHESS C.4 BY M.C.RAKASKA
40 REM  'CREATIVE COMPUTING' DEC 1981, P.276
50 REM  VERSION 16 (NOV. 1985)
70 REM  NOTE: NO JUMPS TO 'REM' STATEMENTS!
75 REM
80 REM  ---- TITLE PAGE
90 PLOT 6,1,14,12:PRINT TAB( 18);"CHESS C.4 BY M.C.RAKASKA":PRINT
100 PLOT 6,6,15:PRINT "EXTENSIVELY MODIFIED FOR COMPUCOLOR BY WALLACE R. RUST, 1985"
140 REM  ---- HOUSEKEEPING
150 CLEAR 200
160 DIM PN$(10),NF$(8)
170 DIM A(8,8),S(8,8),C(64),PC(3),PS(10),PA(8),PB(8)
180 REM  ---- CONSTANTS
190 D$= "                      ":REM  22
200 VE= 0:VP= 1:VN= 3:VB= 4:VR= 5:VQ= 9:VK= 99:REM  INTEGERS, BUT NOT 10
210 CV= 0
211 DATA P,-,N,B,R,-,-,-,Q,K
212 DATA QR,QN,QB,Q,K,KB,KN,KR
213 RESTORE 211:FOR J= 1TO 10:READ PN$(J):NEXT
214 RESTORE 212:FOR J= 1TO 8:READ NF$(J):NEXT
220 REM  PIECE PLOT POSITIONS
230 FOR J= 1TO 8:PA(J)= 21+ 5* J:PB(J)= 35- 4* J:NEXT
240 REM  PIECE ASCII CODES (P,N,B,R,Q,K)
250 PS(VP)= 112:PS(VN)= 97:PS(VB)= 115
260 PS(VR)= 114:PS(VQ)= 113:PS(10)= 107
270 REM  PIECE/SQUARE COLOR CODES (B/B; B/W; W/B; W/W)
280 PC(0)= 1:PC(1)= 33:PC(2)= 7:PC(3)= 39
290 REM  SQUARE COLORS
300 FW= 1:FOR B= 8TO 1STEP - 1:FOR A= 1TO 7STEP 2
310 S(A,B)= FW:S(A+ 1,B)= - FW:NEXT :FW= - FW:NEXT
320 REM  ---- INITIALIZE GAME
330 FW= 1
340 REM  BOARD SETUP
350 DATA -5,-3,-4,-9,-99,-4,-3,-5
360 DATA -1,-1,-1,-1,-1,-1,-1,-1
370 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
380 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
390 DATA 1,1,1,1,1,1,1,1
400 DATA 5,3,4,9,99,4,3,5
410 RESTORE 350
420 FOR B= 8TO 1STEP - 1:FOR A= 1TO 8:READ A(A,B):NEXT :NEXT
430 REM  ---- INPUT OPTIONS
440 PRINT :PRINT :PLOT 6,3,15
460 PLOT  6,3:PRINT "TURN ON PRINTER IF YOU WANT A RECORD OF THE GAME."
462 INPUT "ENTER PRINTER BAUD RATE CODE (1 TO 7): ";BR
470 PLOT 6,2,3,0,13
480 INPUT "DO YOU WANT INSTRUCTIONS (Y OR N)? ";Q$
490 IF Q$= "Y"THEN GOSUB 3190
500 PLOT 6,3,12
510 INPUT "ENTER LEVEL OF PLAY (1 TO 24): ";LI
520 IF LI< 1OR LI> 24THEN 500
530 GOSUB 3560
540 MC= 1
550 PLOT 6,7:PRINT
560 INPUT "DO YOU WANT TO PLAY WHITE (Y OR N)? ";E1$:GOSUB 3650
570 IF E1$= "Y"THEN GOSUB 2140:GOTO 580
575 GOSUB 2120
580 POKE 33211,0:POKE 33210,0:POKE 33209,0:IF E1$= "Y"THEN 810
590 REM
600 REM  ---- COMPUTER'S MOVE ROUTINE
610 GOSUB 2670:PLOT 6,1,3,0,9:PRINT "COMPUTER THINKING..."
620 VH= - VK:FG= 1
630 FOR K= 1TO 8:FOR J= 1TO 8
640 IF A(J,K)= VKTHEN KA= J:KB= K:GOTO 660
650 NEXT :NEXT
660 FOR B= 1TO 8:FOR A= 1TO 8
661 PLOT 6,4,3,0,11:PRINT "CONSIDERING ";CHR$ (A+ 64);STR$ (B)
662 IF A(A,B)< VETHEN GOSUB 1050:IF VH> = LAGOTO 710
670 NEXT :NEXT :IF VH> = - VQGOTO 710
680 GOSUB 2140
690 P$= "COMPUTER RESIGNS!     "
700 PLOT 6,69,14,3,0,11:PRINT P$:GOSUB 3610:GOTO 3150
710 P4= A(TA,TB):P5= A(TC,TD)
711 A(TC,TD)= A(TA,TB):A(TA,TB)= VE
720 IF A(TC,TD)= - VPAND TD= 1THEN A(TC,TD)= - VQ:REM  QUEENING
730 A= TC:B= TD:FG= 5:GOSUB 1050
740 PLOT 6,2,3,0,13:PRINT "IS COMPUTER'S MOVE    "
750 P$= CHR$ (TA+ 64)+ RIGHT$ (STR$ (TB),1)+ "-"
760 P$= P$+ CHR$ (TC+ 64)+ RIGHT$ (STR$ (TD),1)
770 PLOT 6,6,14,3,0,11:PRINT D$:PLOT 3,0,11:PRINT P$
775 A= TA:B= TB:C= TC:D= TD:GOSUB 3610:PLOT 14
780 A= TA:B= TB:GOSUB 2180:A= TC:B= TD:GOSUB 2180
790 IF FC= 1THEN PLOT 3,0,15:PRINT "PLAYER IN CHECK!      ":FC= 0
800 REM  ---- PLAYER'S MOVE ROUTINE
810 GOSUB  2671:IF E2$= "S"GOTO 860
815 PLOT 6,1,3,0,9:PRINT D$
820 PLOT 6,3,3,0,21:PRINT "PLAYER'S MOVE:      ":GOSUB 2310
830 FL= 0:UC= C:UD= D:FE= 0
840 IF A(A,B)= VPAND B= 5AND D= 6AND A(C,D)= VEAND ABS (C- A)= 1THEN FE= 1:GOTO 930:REM  EN PASSANT?
850 GOTO 880
860 GOSUB 2671:PLOT 6,5,3,0,5:PRINT "SELF-PLAYING GAME     "
870 GOSUB 3500:GOTO 610
880 IF E2$= "K"OR E2$= "Q"THEN GOSUB 2140:PLOT 3,0,7:PRINT D$:GOTO 610
890 IF E2$= "S"GOTO 810
900 FG= 4:GOSUB 1030
910 IF FL= 0THEN 810
930 PLOT 6,3,3,0,25:PRINT "YOUR MOVE ACCEPTED"
940 C= UC:D= UD:P4= A(A,B):P5= A(C,D):GOSUB 3580
945 A(C,D)= A(A,B):A(A,B)= VE
950 GOSUB 2180:A= C:B= D:GOSUB 2180
960 IF A(C,D)= VPAND D= 8GOTO 980
970 GOTO 1000
980 GOSUB 3050:A= C:B= D:GOSUB 2180
990 PLOT 3,0,21:PRINT D$:PRINT D$
1000 IF FE= 1THEN A(C,D- 1)= VE:A= C:B= D- 1:GOSUB 2180
1010 GOTO 610
1020 REM  ---- CHOOSE PLAYER'S PIECE MOVE
1030 ON A(A,B)GOTO 1430,20,1290,1190,1080,20,20,20,1080:GOTO 1390
1040 REM  ---- CHOOSE COMPUTER'S PIECE MOVE
1050 ON - A(A,B)GOTO 1570,20,1290,1190,1080,20,20,20,1080:GOTO 1390
1060 REM  ---- QUEEN MOVE
1070 REM  ---- ROOK MOVE
1080 D= B:IF A= 1GOTO 1100
1090 FOR C= A- 1TO 1STEP - 1:GOSUB 1810:IF FS= 0THEN NEXT
1100 IF A= 8GOTO 1120
1110 FOR C= A+ 1TO 8:GOSUB 1810:IF FS= 0THEN NEXT
1120 C= A:IF B= 1GOTO 1140
1130 FOR D= B- 1TO 1STEP - 1:GOSUB 1810:IF FS= 0THEN NEXT
1140 IF B= 8GOTO 1160
1150 FOR D= B+ 1TO 8:GOSUB 1810:IF FS= 0THEN NEXT
1160 IF ABS (A(A,B))= VQGOTO 1190
1170 RETURN
1180 REM  ---- BISHOP MOVE
1190 D= B:FOR C= A+ 1TO 8:D= D- 1:IF C> 8OR D< 1GOTO 1210
1200 GOSUB 1810:IF FS= 0THEN NEXT
1210 D= B:FOR C= A- 1TO 1STEP - 1:D= D- 1:IF C< 1OR D< 1GOTO 1230
1220 GOSUB 1810:IF FS= 0THEN NEXT
1230 D= B:FOR C= A- 1TO 1STEP - 1:D= D+ 1:IF C< 1OR D> 8GOTO 1250
1240 GOSUB 1810:IF FS= 0THEN NEXT
1250 D= B:FOR C= A+ 1TO 8:D= D+ 1:IF C> 8OR D> 8GOTO 1270
1260 GOSUB 1810:IF FS= 0THEN NEXT
1270 RETURN
1280 REM  ---- KNIGHT MOVE
1290 C= A+ 2:D= B+ 1:IF C< 9AND D< 9THEN GOSUB 1840
1300 D= D- 2:IF D> 0AND C< 9THEN GOSUB 1840
1310 C= C- 4:IF C> 0AND D> 0THEN GOSUB 1840
1320 D= D+ 2:IF D< 9AND C> 0THEN GOSUB 1840
1330 C= C+ 1:D= D+ 1:IF C> 0AND C< 9AND D< 9THEN GOSUB 1840
1340 D= D- 4:IF D> 0AND C> 0AND C< 9THEN GOSUB 1840
1350 C= C+ 2:IF C> 0AND C< 9AND D> 0THEN GOSUB 1840
1360 D= D+ 4:IF D< 9AND C> 0AND C< 9THEN GOSUB 1840
1370 RETURN
1380 REM  ---- KING MOVE
1390 FOR D= B- 1TO B+ 1:FOR C= A- 1TO A+ 1
1400 IF C> 0AND C< 9AND D> 0AND D< 9THEN GOSUB 1840
1410 NEXT :NEXT :RETURN
1420 REM  ---- PLAYER PAWN MOVE
1430 C= A:IF B> 2GOTO 1490
1440 D= B+ 1:IF A(C,D)= VEGOTO 1460
1450 GOTO 1510
1460 GOSUB 1870:D= B+ 2:IF A(C,D)= VEGOTO 1480
1470 GOTO 1510
1480 GOSUB 1870:GOTO 1510
1490 D= B+ 1:IF D> 8GOTO 1510
1500 IF A(C,D)= VETHEN GOSUB 1870
1510 C= A+ 1:D= B+ 1:IF C> 8OR D> 8GOTO 1530
1520 IF A(C,D)< VETHEN GOSUB 1870
1530 C= A- 1:IF C> 8OR D> 8GOTO 1550
1540 IF A(C,D)< VETHEN GOSUB 1870
1550 RETURN
1560 REM  ---- COMPUTER PAWN MOVE
1570 C= A:IF B< 7GOTO 1630
1580 D= B- 1:IF A(C,D)< > VEGOTO 1650
1600 GOSUB 1870:D= B- 2:IF A(C,D)< > VEGOTO 1650
1620 GOSUB 1870:GOTO 1650
1630 D= B- 1:IF D< 1GOTO 1650
1640 IF A(C,D)= VETHEN GOSUB 1870
1650 C= A- 1:D= B- 1:IF C< 1OR D< 1GOTO 1670
1660 IF A(C,D)> VETHEN GOSUB 1870
1670 C= A+ 1:IF C> 8OR D< 1THEN  RETURN
1680 IF A(C,D)> VETHEN GOSUB 1870
1690 RETURN
1700 REM  ---- PROTECT
1710 V1= A(C,D):IF V1= - VKTHEN V3= V1:RETURN
1720 FP= FS:IF ABS (V1)< = A(A,B)THEN A(C,D)= A(A,B):A(A,B)= VE:GOTO 1760
1730 IF V3> V1THEN V3= V1:FS= FP:RETURN
1750 FS= FP:RETURN
1760 RA= A:RB= B:RC= C:RD= D:V2= V1:FG= 3
1770 FOR A= 1TO 8:FOR B= 1TO 8:IF A(A,B)< VETHEN GOSUB 1050:IF V1= CVGOTO 1790
1780 NEXT :NEXT
1790 A= RA:B= RB:C= RC:D= RD:FG= 6:A(A,B)= A(C,D):A(C,D)= V2:GOTO 1730
1800 REM  ---- LEGALITY & MOVE GEN. USEAGE
1810 FS= 0:IF A(C,D)= VEGOTO 1870
1820 FS= 1:GOTO  1850
1840 IF A(C,D)= VEGOTO 1870
1850 IF SGN (A(C,D))= SGN (A(A,B))THEN RETURN
1870 ON FGGOTO 1990,1880,1900,1920,1940,1970
1880 IF KA= CAND KB= DTHEN V3= V3+ 1
1890 RETURN
1900 IF RC= CAND RD= DTHEN V1= CV
1910 RETURN
1920 IF UC= CAND UD= DTHEN FL= 1
1930 RETURN
1940 IF KA= CAND KB= DTHEN FC= 1
1950 RETURN
1960 REM  ---- LOOK AHEAD
1970 IF A(C,D)< VEGOTO 1710
1980 RETURN
1990 FT= FS:SA= A:SB= B:SC= C:SD= D:V4= A(C,D):A(C,D)= A(A,B):A(A,B)= VE:V3= CV
2000 FG= 6:FOR A= 1TO 8:FOR B= 1TO 8:IF A(A,B)> VETHEN GOSUB 1030
2010 NEXT :NEXT :A= SC:B= SD:FG= 2:GOSUB 1050
2020 FG= 1:FS= FT:A= SA:B= SB:C= SC:D= SD:A(A,B)= A(C,D):A(C,D)= V4
2030 REM  ---- EVALUATE
2040 V6= 1/ (ABS (4.5- C)+ ABS (4.5- D)+ 1)
2050 IF A(A,B)< - VPAND A(A,B)> - VQTHEN V6= V6+ 1/ (ABS (KA- C)+ ABS (KB- D)+ 5)+ RND (1)/ 15
2060 VM= V4+ V3+ V6:IF V4< > VKGOTO 2080
2070 GOSUB 2140:PLOT 6,1,3,0,15:PRINT "PLAYER IS MATED!":GOTO 3150
2080 IF VM< = VHTHEN RETURN
2090 VH= VM:TA= A:TB= B:TC= C:TD= D:RETURN
2110 REM  ---- PLAYER IS BLACK
2120 FW= - FW:A(4,1)= VK:A(5,1)= VQ:A(4,8)= - VK:A(5,8)= - VQ
2130 REM  ---- DRAW ENTIRE BOARD
2140 PLOT 27,24,15,6,2,12,3,14,0:PRINT "COMPUTER"
2150 PLOT 3,16,31:PRINT "PLAYER"
2155 PLOT 6,4,3,0,31:PRINT "('I' FOR HELP)"
2160 FOR B= 1TO 8:FOR A= 1TO 8:GOSUB 2180:NEXT :NEXT :PLOT  6,3:RETURN
2170 REM  ---- DRAW SQUARE (A,B)
2180 X1= PA(A)- 2:Y1= PB(B)- 2
2190 CC= 32:IF S(A,B)= - 1THEN CC= 4
2200 PLOT 14,6,CC,3,X1,Y1:PRINT "     ":PLOT 3,X1,Y1+ 2:PRINT "     "
2230 PLOT 15,3,X1,Y1- 1,6,CC:PRINT CHR$ (A+ 64);RIGHT$ (STR$ (B),1)
2240 REM  ---- DRAW PIECE (A,B)
2250 V7= ABS (A(A,B)):IF V7= VETHEN RETURN
2260 IF V7= VKTHEN V7= 10
2270 CC= (S(A,B)+ 1)/ 2+ FW* SGN (A(A,B))+ 1
2280 PLOT 14,3,PA(A),PB(B),6,PC(CC),PS(V7):RETURN
2300 REM  ---- INPUT PLAYER COMMAND
2310 PLOT 6,3,3,0,5:PRINT D$
2320 PLOT 3,0,23:INPUT E2$
2330 E4$= LEFT$ (E2$,1):IF E4$> = "A"AND E4$< = "H"GOTO 2530
2340 IF E4$= "K"AND A(5,1)= VKAND A(8,1)= VRGOTO 2440
2350 IF E4$= "Q"AND A(5,1)= VKAND A(1,1)= VRGOTO 2450
2360 IF E4$= "K"AND A(4,1)= VKAND A(1,1)= VRGOTO 2460
2370 IF E4$= "Q"AND A(4,1)= VKAND A(8,1)= VRGOTO 2470
2380 IF E4$= "S"GOTO 2650
2390 IF E4$= "M"THEN GOSUB 2690
2400 IF E4$= "I"GOTO 2480
2410 IF E4$= "L"THEN GOSUB 2950
2420 IF E4$= "X"GOTO 2500
2430 GOTO 2320
2440 A(5,1)= VE:A(8,1)= VE:A(7,1)= VK:A(6,1)= VR:GOTO 2630
2450 A(5,1)= VE:A(1,1)= VE:A(3,1)= VK:A(4,1)= VR:GOTO 2630
2460 A(4,1)= VE:A(1,1)= VE:A(2,1)= VK:A(3,1)= VR:GOTO 2630
2470 A(4,1)= VE:A(8,1)= VE:A(6,1)= VK:A(5,1)= VR:GOTO 2630
2480 GOSUB 3190:PLOT 6,3,14,12:GOSUB 2140
2490 PLOT 3,0,21:PRINT "PLAYER'S MOVE":GOTO 2320
2500 PLOT 6,3,3,0,5:PRINT "EXCHANGING   ";:GOSUB 3500
2510 GOTO 610
2520 REM  ---- PLAYER MOVE
2530 IF LEN (E2$)< > 5GOTO 2320
2540 A= ASC (E4$)- 64
2550 E4$= MID$ (E2$,2,1):IF E4$< "1"OR E4$> "8"GOTO 2320
2560 B= ASC (E4$)- 48
2570 IF A(A,B)< VPOR A(A,B)> VKTHEN PLOT 3,0,25:PRINT "ENTRY ERROR           ":GOTO 2310
2580 E4$= MID$ (E2$,4,1):IF E4$< "A"OR E4$> "H"GOTO 2320
2590 C= ASC (E4$)- 64
2600 E4$= MID$ (E2$,5,1):IF E4$< "1"OR E4$> "8"GOTO 2320
2610 D= ASC (E4$)- 48
2620 P$= E2$:PLOT 14:GOTO 2650
2630 P$= "CASTLE "+ E4$+ "-SIDE         "
2640 PLOT 6,6,14,3,0,5:PRINT P$:GOSUB 3580:PLOT 14
2650 RETURN
2660 REM  ---- CLEAR MSG AREAS
2670 PLOT 6,3,14:FOR J= 7TO 17:PLOT 3,0,J:PRINT D$:NEXT :RETURN
2671 PLOT 6,3,14:FOR J= 18TO 29:PLOT 3,0,J:PRINT D$:NEXT :RETURN
2680 REM  ---- MODIFY BOARD
2690 GOSUB 2670:PLOT 6,7,3,0,5:PRINT "MODIFYING"
2700 PLOT 6,2,3,0,7:PRINT "WHAT SQUARE? (Z = NONE)"
2710 INPUT E3$:IF E3$< > "Z"GOTO 2730
2720 PLOT 3,0,5:PRINT D$:GOSUB 2140:GOTO 610
2730 IF LEN (E3$)< > 2GOTO 2690
2740 E4$= LEFT$ (E3$,1):IF E4$< "A"OR E4$> "J"GOTO 2690
2750 A= ASC (E4$)- 64
2760 E4$= RIGHT$ (E3$,1):IF E4$< "1"OR E4$> "8"GOTO 2690
2770 B= ASC (E4$)- 48
2780 PLOT 3,0,11:PRINT "WHOSE PIECE? (C,P,E)"
2790 K= VE
2800 INPUT E5$:IF E5$= "E"GOTO 2910
2810 IF E5$< > "C"AND E5$< > "P"GOTO 2780
2820 PLOT 3,0,15:PRINT "WHAT PIECE? (P,N,...)"
2830 INPUT E6$:E6$= LEFT$ (E6$,1)
2840 IF E6$= "P"THEN K= VP
2850 IF E6$= "N"THEN K= VN
2860 IF E6$= "B"THEN K= VB
2870 IF E6$= "R"THEN K= VR
2880 IF E6$= "Q"THEN K= VQ
2890 IF E6$= "K"THEN K= VK
2900 IF K= VEGOTO 2820
2910 IF E5$= "C"AND K< > VETHEN K= - K
2920 A(A,B)= K
2930 GOSUB 2180:GOTO 2690
2940 REM  ---- LEVEL OF PLAY
2950 GOSUB 2670:PLOT 6,3,3,0,5:PRINT D$:PLOT 3,0,5:PRINT "LEVEL =";LI
2960 PLOT 6,2,3,0,7:PRINT "CHANGE LEVEL?"
2970 PRINT "ENTER N, OR NEW LEVEL"
2980 INPUT Q$:IF Q$= "N"GOTO 3020
2990 LI= VAL (Q$):IF LI< 1THEN LI= 1
3000 IF LI> 24THEN LI= 24
3010 GOSUB 3560
3020 GOSUB 2670:PLOT 3,0,5:PRINT D$
3030 PLOT 6,3,3,0,7:PRINT "PLAYER'S MOVE":RETURN
3040 REM  ---- PAWN PROMOTION
3050 PLOT 3,0,21:PRINT "PROMOTE TO WHAT:"
3060 PRINT "P, N, B, R, Q"
3070 INPUT Q$:IF Q$= "P"THEN A(C,D)= VP:GOTO 3130
3080 IF Q$= "N"THEN A(C,D)= VN:GOTO 3130
3090 IF Q$= "B"THEN A(C,D)= VB:GOTO 3130
3100 IF Q$= "R"THEN A(C,D)= VR:GOTO 3130
3110 IF Q$= "Q"THEN A(C,D)= VQ:GOTO 3130
3120 GOTO 3070
3130 RETURN
3140 REM  ---- END OF GAME
3150 PLOT 6,2,3,0,5:INPUT "PLAY AGAIN? (Y OR NB) ";A$
3160 IF A$= "Y"GOTO 330
3170 PLOT 12:END
3180 REM M ---- INSTRUCTIONS
3190 PLOT 6,3,15,12
3200 PRINT "1. LEVELS OF PLAY ARE FROM 1 TO 24."
3210 PRINT :PLOT 6,6
3220 PRINT "2. YOU CAN PLAY WHITE OR BLACK.  COMPUTER WILL ALWAYS BE AT THE"
3230 PRINT "   TOP OF THE SCREEN."
3240 PRINT :PLOT 6,2
3250 PRINT "3. TO MOVE, SPECIFY THE 'FROM' AND 'TO' SQUARES, SUCH AS B2-D3."
3260 PRINT :PLOT 6,1
3270 PRINT "4. IF A MOVE IS ILLEGAL, OR AN ENTRY ERROR IS MADE, SIMPLY TYPE"
3280 PRINT "   A NEW ENTRY.  A MOVE MAY BE STARTED OVER BY FORCING AN ERROR"
3290 PRINT "   (E.G. '999')."
3300 PRINT :PLOT 6,3
3310 PRINT "5. COMPUTER ASSUMES MATE IF YOU LEAVE YOUR KING IN CHECK."
3320 PRINT :PLOT 6,7
3330 PRINT "6. TO CAPTURE 'EN PASSANT', SIMPLY SPECIFY THE FROM-TO SQUARES."
3340 PRINT :PLOT 6,3
3350 PRINT "7. SPECIAL COMMANDS DURING PLAYER'S MOVE ARE:"
3360 PRINT
3370 PRINT "   TYPE 'K' TO CASTLE KING-SIDE."
3380 PRINT "        'Q' TO CASTLE QUEEN-SIDE."
3390 PRINT "        'S' TO LET COMPUTER PLAY ITSELF."
3400 PRINT "        'X' TO EXCHANGE PIECES WITH THE COMPUTER."
3410 PRINT "        'M' TO MODIFY PIECES ON THE BOARD."
3420 PRINT "        'L' TO LOOK AT OR CHANGE LEVEL OF PLAY."
3430 PRINT "        'I' TO GET THESE INSTRUCTIONS AGAIN."
3440 PRINT :PLOT 6,5
3450 PRINT "8. TO HALT GAME, PRESS 'BREAK'; TO RESUME, PRESS 'RETURN'."
3460 PRINT :PLOT 6,1
3470 INPUT "PRESS 'RETURN' TO PLAY GAME";Q$
3480 PLOT 14:RETURN
3490 REM  ---- EXCHANGE
3500 FW= - FW:GOSUB 3510:GOSUB 2140:RETURN
3510 I= 0:FOR J= 1TO 8:FOR K= 1TO 8:I= I+ 1:C(I)= - A(J,K):NEXT :NEXT
3530 I= 65:FOR J= 1TO 8:FOR K= 1TO 8:I= I- 1:A(J,K)= C(I):NEXT :NEXT
3540 RETURN
3550 REM  ---- ADJUST LEVEL OF PLAY
3560 LA= LI* 13/ 24:RETURN
3570 REM  ---- PRINT PLAYER MOVE ON PRINTER
3580 GOSUB 3700:PRINT "PLAYER MOVE  ";MC;TAB( 20);P$;
3585 GOSUB 3810:PRINT TAB( 28);P1$;
3587 PRINT TAB( 38);PEEK (33211);PEEK (33210);PEEK (33209)
3588 IF FW= - 1THEN MC= MC+ 1
3590 GOSUB 3720:RETURN
3600 REM  ---- PRINT COMPUTER MOVE ON PRINTER
3610 GOSUB 3700:PRINT "COMPUTER MOVE";MC;TAB( 20);P$;
3615 GOSUB 3810:PRINT TAB( 28);P1$;
3620 PRINT TAB( 38);PEEK (33211);PEEK (33210);PEEK (33209);
3625 PRINT TAB( 51);VH
3630 IF FW= 1THEN MC= MC+ 1
3635 GOSUB 3720:RETURN
3640 REM  ---- PRINT HEADING ON PRINTER
3650 GOSUB 3700:P$= "BLACK.":IF E1$= "Y"THEN P$= "WHITE."
3660 PRINT "PLAYER IS ";P$
3670 PRINT "LEVEL OF PLAY:";LI;" (INPUTED);";LA;" (ADJUSTED)"
3675 PRINT :PRINT TAB( 38);"CLOCK H:M:S  MOVE VALUE":PRINT
3680 GOSUB 3720:RETURN
3690 REM  ---- OUTPUT TO PRINTER
3700 POKE 33289,80:PLOT 15,27,18,BR,27,13:OUT 8,4
3702 RETURN
3710 REM  ---- OUTPUT TO SCREEN
3720 OUT 8,255:POKE 33265,0:POKE 33289,64:RETURN
3800 REM  ---- DESCRIPTIVE NOTATION
3810 P1$= "":IF LEN (P$)< > 5THEN RETURN
3820 IF ABS (P5)= VKTHEN P1$= "MATE!":RETURN
3830 P1$= "K":IF ABS (P4)< VKTHEN P1$= PN$(ABS (P4))
3860 P2$= "x":IF P5= VETHEN P2$= "-":GOTO 3920
3870 P3$= PN$(ABS (P5)):GOTO 3960
3920 J= 0:IF P4< VETHEN J= 9
3925 K= C:IF FW= - 1THEN K= 9- C
3930 P3$= NF$(K)+ RIGHT$ (STR$ (J- D),1)
3960 P1$= P1$+ P2$+ P3$:IF FC= 1THEN P1$= P1$+ "ch"
3970 RETURN
5000 REM  ---- END OF CHESS PROGRAM