10 REM *** FOX AND HOUNDS *** 20 REM *** A CHECKER GAME *** 30 REM *** PROGRAM BY JACK A. INMAN *** 40 REM *** OCTOBER 1977 WRITTEN IN SWTPC 8K BASIC *** 50 PRINT "WANT INSTRUCTIONS - "; 55 PRINT "TYPE YES OR NO"; 60 INPUT A$ 70 IF A$="YES" THEN GOSUB 1500 100 REM *** SET LIMITS *** 110 DIM L(9,9) 200 REM *** GENERATE BOARD *** 205 REM *** GENERATE LINE 1 *** 210 FOR C=1 TO 8 STEP 2 220 L(1,C)=1 230 L(1,C+1)=2 240 NEXT C 245 REM *** GENERATE LINES 2 THROUGH 8 *** 250 FOR C=1 TO 8 STEP 2 255 L(2,C)=4 260 L(2,C+1)=1 265 L(3,C+1)=4 270 L(3,C)=1 275 L(4,C)=4 280 L(4,C+1)=1 285 L(5,C)=1 290 L(5,C+1)=4 295 L(6,C)=4 300 L(6,C+1)=1 305 L(7,C)=1 310 L(7,C+1)=4 312 L(8,C)=4 315 L(8,C+1)=1 320 NEXT C 325 REM *** SET UP FOX INITIAL POSITION *** 330 L(8,5)=3 335 REM *** LOCATION HOLDERS *** 340 X=8 350 Y=5 360 A=X 370 B=Y 400 REM *** CLEAR SCREEN AND PRINT BOARD ** 405 REM *** PRINT CHR$(16);CHR$(22) 406 GOSUB 1400 410 FOR L=1 TO 8 420 FOR C=1 TO 8 430 IF L(L,C)=1 THEN PRINT"X "; 440 IF L(L,C)=2 THEN PRINT"H "; 450 IF L(L,C)=3 THEN PRINT"F "; 460 IF L(L,C)=4 THEN PRINT"O "; 470 NEXT C 480 PRINT " L";USING"#";L 490 NEXT L 500 FOR K=1 TO 8 510 PRINT USING"#";K; 515 PRINT " "; 520 NEXT K 530 PRINT 535 REM *** TEST FOR COMPUTER WIN *** 540 IF X=1 THEN GOTO 1350 550 REM *** TEST FOR HUMAN WIN *** 560 IF Z=1 THEN GOTO 1300 600 REM *** HUMAN MOVES *** 610 PRINT "YOUR MOVE FROM(LINE,COLUMN)"; 620 INPUT F,F1 630 PRINT "TO "; 640 INPUT T,T1 645 REM *** TEST FOR VALID MOVE ** 650 IF T1 THEN GOTO 700 680 IF L(F,F1)<>2 THEN GOTO 700 690 IF L(T,T1)=4 THEN IF L(F,F1)=2 THEN GOTO 720 700 PRINT "INVALID MOVE" 710 GOTO 600 715 REM *** MOVE IS VALID-MOVE PLAYER *** 720 L(T,T1)=2 730 L(F,F1)=4 900 REM *** COMPUTER MOVES **** 903 Q=0 905 K=INT(RND(0)*2) 910 IF K>2 THEN GOTO 905 930 IF K=1 THEN GOTO 950 940 IF K=0 THEN GOTO 1060 945 REM *** TEST (1) FORWARD:(1) LEFT *** 950 Q=Q+1 953 X=A-1 955 Y=B-1 960 IF L(X,Y)=4 THEN L(X,Y)=3 970 IF L(X,Y)<>3 THEN IF Q<>2 THEN GOTO 1060 975 IF L(X,Y)<>3 THEN IF Q=2 THEN GOTO 1100 980 IF L(X,Y)=3 THEN L(X+1,Y+1)=4 990 IF L(X,Y)=3 THEN 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 THEN L(X,Y)=3 1080 IF L(X,Y)<>3 THEN IF Q<2 THEN GOTO 950 1082 IF L(X,Y)<>3 THEN IF Q=2 THEN GOTO 1100 1085 IF L(X,Y)=3 THEN L(X+1,Y-1)=4 1090 IF L(X,Y)=3 THEN GOTO 400 1100 REM *** COMPUTER MOVES BACKWARDS *** 1101 IF K=0 THEN GOTO 1105 1102 IF K=1 THEN 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 THEN L(X,Y)=3 1130 IF L(X,Y)<>3 THEN IF Q<4 THEN GOTO 1200 1150 IF L(X,Y)=3 THEN L(X-1,Y-1)=4 1160 IF L(X,Y)=3 THEN GOTO 400 1170 IF L(X,Y)<>3 THEN 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 THEN L(X,Y)=3 1230 IF L(X,Y)<>3 THEN IF Q<4 THEN GOTO 1105 1240 IF L(X,Y)=3 THEN L(X-1,Y+1)=4 1250 IF L(X,Y)=3 THEN GOTO 400 1260 IF L(X,Y)<>3 THEN 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" THEN GOTO 200 1390 END 1400 REM *** PRINT COMPUTER MOVE *** 1405 IF A=X THEN GOTO 1440 1406 IF Z=1 THEN PRINT"I CAN'T MOVE" 1407 IF Z=1 THEN GOTO 1440 1410 PRINT "I MOVED FROM ";A;" ";B;"TO ";X;" ";Y 1420 A=X 1430 B=Y 1440 RETURN 1500 REM *** INSTRUCTIONS *** 1505 REM *** 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 REM *** 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