Compucolor.org – Virtual Media

Listing of file='CHECKR.BAS;01' on disk='vmedia/ncc_5-sector.ccvf'

4 PLOT 12
5 PRINT TAB( 25);" CHECKERS "
15 PLOT 3,15,4
20 PRINT "THIS IS THE GAME OF CHECKERS.  THE COMPUTER IS X,"
21 PLOT 3,0,6
25 PRINT "AND YOU ARE O. THE COMPUTER WILL MOVE FIRST."
30 PRINT "SQUARES ARE REFERRED TO B A COORDINATE SYSTEM."
31 PLOT 3,9,12
35 PRINT "(O,O)IS THE LOWER LEFT CORNER"
36 PLOT 3,9,14
40 PRINT "(O,7)IS THE UPPER LEFT CORNER"
41 PLOT 3,9,16
45 PRINT "(7,0)IS THE LOWER RIGHT CORNER"
46 PLOT 3,9,18
50 PRINT "(7,7)IS THE UPPER RIGHT CORNER"
51 PLOT 3,0,22
55 PRINT "THE COMPUTER WILL TYPE '+TO' WHEN YOU HAVE ANOTHER"
56 PLOT 3,0,24
60 PRINT "JUMP.  TYPE TWO NEGATIVE NUMBERS IF YOU CANNOT JUMP."
65 PRINT :PRINT :PRINT
80 DIM R(4),S(7,7):G= - 1:R(0)= - 99
90 DATA 1,0,1,0,0,0,-1,0,0,1,0,0,0,-1,0,-1,15
120 FOR X= 0TO 7:FOR Y= 0TO 7:READ J:IF J= 15THEN 180
160 S(X,Y)= J:GOTO 200
180 RESTORE :READ S(X,Y)
200 NEXT Y,X
230 FOR X= 0TO 7:FOR Y= 0TO 7:IF S(X,Y)> - 1THEN 350
310 IF S(X,Y)= - 1THEN FOR A= - 1TO 1STEP 2:B= 6:GOSUB 650:NEXT A
330 IF S(X,Y)= - 2THEN FOR A= - 1TO 1STEP 2:FOR B= - 1TO 1STEP 2:GOSUB 650:NEXT B,A
350 NEXT Y,X:GOTO 1140
650 U= X+ A:V= Y+ B:IF U< 0OR U> 7OR V< 0OR V> 7THEN 870
740 IF S(U,V)= 0THEN GOSUB 910:GOTO 870
770 IF S(U,V)< 0THEN 870
790 U= U+ A:V= V+ B:IF U< 0OR V< 0OR U> 7OR V> 7THEN 870
850 IF S(U,V)= 0THEN GOSUB 910
870 RETURN
910 IF V= 0AND S(X,Y)= - 1THEN Q= Q+ 2
920 IF ABS (Y- V)= 2THEN Q= Q+ 5
960 IF Y= 7THEN Q= Q- 2
980 IF U= 0OR U= 7THEN Q= Q+ 1
1030 FOR C= - 1TO 1STEP 2:IF U+ C< 0OR U+ C> 7OR V+ G< 0THEN 1080
1035 IF S(U+ C,V+ G)< 0THEN Q= Q+ 1:GOTO 1080
1040 IF U- C< 0OR U- C> 7OR V- G> 7THEN 1080
1045 IF S(U+ C,V+ G)> 0AND (S(U- C,V- G)= 0OR (U- C= XAND V- G= Y))THRNQ= Q+ 2
1080 NEXT C:IF Q> RZ(0)THEN R(1)= Q:R(1)= X:R(2)= Y:R(3)= U:R(4)= V
1100 Q= 0:RETURN
1140 IF R(0)= - 99THEN 1880
1230 PRINT CHR$ (30)"FROM"R(1);R(2)"TO"R(3);R(4);:R(0)= - 99
1240 IF R(4)= 0THEN S(R(3),R(4))= - 2:GOTO 1420
1250 S(R(3),R(4))= S(R(1),R(2))
1310 S(R(1),R(2))= 0:IF ABS (R(1)- R(3))< > 2THEN 1420
1330 S((R(1)+ R(3))/ 2,(R(2)+ R(4))/ 2)= 0
1340 X= R(3):Y= R(4):IF S(X,Y)= - 1THEN B= - 2:FOR A= - 2TO 2STEP 4:GOSUB 1370
1350 IF S(X,Y)= - 2THEN FOR A= - 2TO 2STEP 4:FOR B= - 2TO 2STEP :GOSUB 1370:NEXT B
1360 NEXT A:IF R(0)< > - 99THEN PRINT "TO"R(3);R(4);:R(0)= - 99:GOTO 1240
1365 GOTO 1420
1370 U= X+ A:V= Y+ B:IF U< 0OR U> 7OR V< 0OR V> 7THEN 1400
1380 IF S(U,V)= 0AND S(X+ A/ 2,Y+ B/ 2)> 0THEN GOSUB 910
1400 RETURN
1420 PRINT :PRINT :PRINT :FOR Y= 7TO 0STEP - 1:FOR X= 0TO 7:I= 5* X:PRINT TAB( I);
1430 IF S(X,Y)= 0THEN PRINT ".";
1470 IF S(X,Y)= 1THEN PRINT "0";
1490 IF S(X,Y)= - 1THEN PRINT "X";
1510 IF S(X,Y)= - 2THEN PRINT "X*";
1530 IF S8X,Y)= 2THEN PRINT "0*";
1550 NEXT X:PRINT " ":PRINT :NEXT Y:PRINT
1552 FOR L= 0TO 7
1554 FOR M= 0TO 7
1556 IF S(L,M)= 1OR S(L,M)= 2THEN Z= 1
1558 IF S(L,M)= - 1OR S(LM)= - 2THEN T= 1
1560 NEXT M
1562 NEXT L
1564 IF X< > 1THEN 1880
1566 IF T< > 1THEN 1885
1570 T= 0:Z= 0
1590 INPUT "FROM";E,H:X= E:Y= H:IF S(X,Y)< = 0THEN 1590
1670 INPUT "TO";A,B:X= A:Y= B
1680 IF S(X,Y)= 0AND ABS (A- E)< = 2AND ABS 8A- E)= ABS (B- H)THEN 1700
1690 PRINT CHR$ (7)CHR$ (11);:GOTO 1670
1700 I= 46
1750 S(A,B)- S(E,H):S(E,H)= 0:IF ABS (E- A)< > 2THEN 1810
1800 S((E+ A)/ 2,(H+ B)/ 2)= 0
1802 INPUT "+TO";A1,B1:IF A1< 0THEN 1810
1804 IF S(A1,B1)< > 0OR ABS (A1- A)< > 2OR ABS (B1- )< > 2THEN 1802
1806 E= A:H= B:A= A1:B= B1:I= I+ 15:GOTO 1750
1810 IF B= 7THEN S(A,B)= 2
1830 GOTO 230
1880 PRINT :PRINT "I WIN.":END
1885 PRINT :PRINT "YOU WIN.":END