0010 REM *** FOX AND HOUNDS *** 0020 REM *** A CHECKER GAME *** 0030 REM *** PROGRAM BY JACK A. INMAN *** 0040 REM *** OCTOBER 1977 WRITTEN IN SWTPC 8K BASIC *** 0050 PRINT "WANT INSTRUCTIONS"; 0055 PRINT "TYPE YES OR NO"; 0060 INPUT A$ 0070 IF A$="YES" GOSUB 1500 0100 REM *** SET LIMITS *** 0110 DIM L(9,9) 0200 REM *** GENERATE BOARD *** 0205 REM *** GENERATE LINE 1 *** 0210 FOR C=1 TO 8 STEP 2 0220 L(1,C)=1 0230 L(1,C+1)=2 0240 NEXT C 0245 REM *** GENERATE LINES 2 THROUGH 8 *** 0250 FOR C=1 TO 8 STEP 2 0255 L(2,C)=4 0260 L(2,C+1)=1 0265 L(3,C+1)=4 0270 L(3,C)=1 0275 L(4,C)=4 0280 L(4,C+1)=1 0285 L(5,C)=1 0290 L(5,C+1)=4 0295 L(6,C)=4 0300 L(6,C+1)=1 0305 L(7,C)=1 0310 L(7,C+1)=4 0312 L(8,C)=4 0315 L(8,C+1)=1 0320 NEXT C 0325 REM *** SET UP FOX INITIAL POSITION *** 0330 L(8,5)=3 0335 REM *** LOCATION HOLDERS *** 0340 X=8 0350 Y=5 0360 A=X 0370 B=Y 0400 REM *** CLEAR SCREEN AND PRINT BOARD ** 0405 PRINT CHR$(16);CHR$(22) 0406 GOSUB 1400 0410 FOR L=1 TO 8 0420 FOR C=1 TO 8 0430 IF L(L,C)=1 PRINT"X "; 0440 IF L(L,C)=2 PRINT"H "; 0450 IF L(L,C)=3 PRINT"F "; 0460 IF L(L,C)=4 PRINT"O "; 0470 NEXT C 0480 PRINT " L";L 0490 NEXT L 0500 FOR K=1 TO 8 0510 PRINT K; 0520 NEXT K 0530 PRINT 0535 REM *** TEST FOR COMPUTER WIN *** 0540 IF X=1 GOTO 1350 0550 REM *** TEST FOR HUMAN WIN *** 0560 IF Z=1 GOTO 1300 0600 REM *** HUMAN MOVES *** 0610 PRINT "YOUR MOVE FROM(LINE,COLUMN)"; 0620 INPUT F,F1 0630 PRINT "TO "; 0640 INPUT T,T1 0645 REM *** TEST FOR VALID MOVE ** 0650 IF T<F PRINT"YOU CAN’T MOVE BACKWARDS" 0655 IF T<F GOTO 600 0660 IF T-F<>1 GOTO 700 0680 IF L(F,F1)<>2 GOTO 700 0690 IF L(T,T1)=4 IF L(F,F1)=2 GOTO 720 0700 PRINT "INVALID MOVE" 0710 GOTO 600 0715 REM *** MOVE IS VALID-MOVE PLAYER *** 0720 L(T,T1)=2 0730 L(F,F1)=4 0900 REM *** COMPUTER MOVES **** 0903 Q=0 0905 K=INT(RND(0)*2) 0910 IF K>2 GOTO 905 0930 IF K=1 GOTO 950 0940 IF K=0 GOTO 1060 0945 REM *** TEST (1) FORWARD:(1) LEFT *** 0950 Q=Q+1 0953 X=A-1 0955 Y=B-1 0960 IF L(X,Y)=4 L(X,Y)=3 0970 IF L(X,Y)<>3 IF Q<>2 GOTO 1060 0975 IF L(X,Y)<>3 IF Q=2 GOTO 1100 0980 IF L(X,Y)=3 L(X+1,Y+1)=4 0990 IF L(X,Y)=3 GOTO 400 1050 REM *** TEST (1) FORWARD (1) RIGHT *** 1060 X=A-1 1062 Y=B+1 1065 Q=Q+1 1070 IF L(X,Y)=4 L(X,Y)=3 1080 IF L(X,Y)<>3 IF Q<2 GOTO 950 1082 IF L(X,Y)<>3 IF Q=2 GOTO 1100 1085 IF L(X,Y)=3 L(X+1,Y-1)=4 1090 IF L(X,Y)=3 GOTO 400 1100 REM *** COMPUTER MOVES BACKWARDS *** 1101 IF K=0 GOTO 1105 1102 IF K=1 GOTO 1200 1104 REM *** TEST (1) BACK (1) RIGHT *** 1105 Q=Q+1 1110 X=A+1 1115 Y=B+1 1120 IF L(X,Y)=4 L(X,Y)=3 1130 IF L(X,Y)<>3 IF Q<4 GOTO 1200 1150 IF L(X,Y)=3 L(X-1,Y-1)=4 1160 IF L(X,Y)=3 GOTO 400 1170 IF L(X,Y)<>3 Z=1 1180 GOTO 400 1200 REM *** TEST (1)BACK (1) LEFT *** 1210 Y=B-1 1211 X=A+1 1215 Q=Q+1 1220 IF L(X,Y)=4 L(X,Y)=3 1230 IF L(X,Y)<>3 IF Q<4 GOTO 1105 1240 IF L(X,Y)=3 L(X-1,Y+1)=4 1250 IF L(X,Y)=3 GOTO 400 1260 IF L(X,Y)<>3 Z=1 1270 GOTO 400 1300 REM *** HUMAN WINS ** * 1310 PRINT "YOU WIN...WANT TO PLAY AGAIN"; 1320 GOTO 1370 1350 REM *** COMPUTER WINS *** 1360 PRINT "I WIN...WANT TO PLAY AGAIN"; 1370 INPUT A$ 1380 IF A$="YES" GOTO 200 1390 END 1400 REM *** PRINT COMPUTER MOVE *** 1405 IF A=X GOTO 1440 1406 IF Z=1 PRINT"I CAN’T MOVE" 1407 IF Z=1 GOTO 1440 1410 PRINT "I MOVED FROM ";A;" ";B;"TO ";X;" ";Y 1420 A=X 1430 B=Y 1440 RETURN 1500 REM *** INSTRUCTIONS *** 1505 PRINT CHR$(16);CHR$(22) 1510 PRINT "YOU ARE THE HOUNDS." 1520 PRINT "YOU HAVE 4 PLAYERS (H)." 1530 PRINT "YOU CAN MOVE FORWARD ONLY." 1535 PRINT 1540 PRINT "THE COMPUTER IS THE FOX (F)." 1550 PRINT "THE FOX CAN MOVE BACK AND FORWARD." 1555 PRINT 1560 PRINT "IF YOU TRAP THE FOX YOU WIN." 1570 PRINT "IF THE FOX GETS TO LINE 1" 1580 PRINT "THE COMPUTER WINS." 1590 PRINT "TYPE A RETURN TO CONTINUE"; 1600 INPUT A$ 1610 PRINT CHR$(16);CHR$(22) 1620 PRINT "TO PLAY. .WHEN IT IS YOUR MOVE" 1630 PRINT "TYPE IN THE LINE NUMBER" 1640 PRINT "COMMA COLUMN NUMBER OF THE" 1650 PRINT "MAN YOU WANT TO MOVE." 1655 PRINT 1660 PRINT "THEN WHEN I ASK TO?" 1670 PRINT "TYPE IN LINE NUMBER" 1680 PRINT "COMMA COLUMN YOU WANT TO" 1690 PRINT "MOVE TO. GOOD LUCK" 1700 PRINT "TYPE A RETURN WHEN READY"; 1710 INPUT A$ 1720 RETURN