home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG055.ARC
/
IQUEEN.BAS
< prev
next >
Wrap
BASIC Source File
|
1979-12-31
|
5KB
|
185 lines
100 REM CONVERTED TO U1106 DEC. 3, 1971 BY T.EDWARDS
110 REM NAME--1QUEEN
120 REM
130 REM DESCRIPTION--PLAYS GAME BASED ON CHESS MOVES.
140 REM
150 REM SOURCE--UNKNOWN
160 REM MODIFIED AUGUST 1970 BY RICHARD HART
170 REM
180 REM INSTRUCTIONS--TYPE "RUN" AND FOLLOW INSTRUCTIONS.
190 REM
200 REM
210 REM * * * * * * MAIN PROGRAM * * * * * * *
220 REM
230 PRINT "DO YOU WISH INSTRUCTIONS";
240 DIM S(64),T(158)
250 FOR I = 1 TO 64
260 X = (INT((I-1)/8)+1)*11+(I-INT((I-1)/8)*8-1)*10
270 S(I) = X
280 T(X) = I
290 NEXT I
300 INPUT W$
310 IF W$="NO" THEN 370
320 IF W$="YES" THEN 350
330 PRINT "INCORRECT ANSWER. PLEASE TYPE YES OR NO";
340 GOTO 300
350 GOSUB 1590
360 GOTO 380
370 GOSUB 1750
380 REM ERROR CHECKS.
390 PRINT "WHERE WOULD YOU LIKE TO START";
400 INPUT M1
410 IF M1 < 1 THEN 590
420 IF M1 > 64 THEN 480
430 M1 = S(M1)
440 T1 = INT(M1/10)
450 U1 = M1 - 10*T1
460 IF U1 = 1 THEN 520
470 IF U1 = T1 THEN 520
480 PRINT "PLEASE READ THE DIRECTIONS AGAIN."
490 PRINT "YOU HAVE BEGUN ILLEGALLY."
500 PRINT
510 GOTO 390
520 GOSUB 780
530 PRINT "MACHINE MOVES TO SQUARE";T(M)
540 IF M = 158 THEN 1330
550 PRINT "WHAT IS YOUR MOVE";
560 INPUT M1
570 IF M1 > 64 THEN 600
580 IF M1 >0 THEN 640
590 IF M1 < 0 THEN 480
600 PRINT
610 PRINT "IT LOOKS LIKE I HAVE WON BY FORFEIT."
620 PRINT
630 GOTO 1490
640 M1 = S(M1)
650 IF M1 <= M THEN 1200
660 T1 = INT(M1/10)
670 U1 = M1 - 10*T1
680 P = U1 - U
690 IF P <> 0 THEN 730
700 L = T1 - T
710 IF L <= 0 THEN 1200
720 GOTO 520
730 IF T1 - T <> P THEN 750
740 GOTO 520
750 IF T1 - T <> 2*P THEN 1200
760 GOTO 520
770 REM LOCATE MOVE FOR MACHINE.
780 IF M1 = 41 THEN 1010
790 IF M1 = 44 THEN 1010
800 IF M1 = 73 THEN 1010
810 IF M1 = 75 THEN 1010
820 IF M1 = 126 THEN 1010
830 IF M1 = 127 THEN 1010
840 IF M1 = 158 THEN 1240
850 C = 0
860 FOR K = 7 TO 1 STEP -1
870 U = U1
880 T = T1 + K
890 GOSUB 1390
900 IF C = 1 THEN 990
910 U = U + K
920 GOSUB 1390
930 IF C = 1 THEN 990
940 T = T + K
950 GOSUB 1390
960 IF C = 1 THEN 990
970 NEXT K
980 GOTO 1010
990 C = 0
1000 RETURN
1010 GOSUB 1040
1020 RETURN
1030 REM RANDOM MOVE.
1040 Z=RND(1)
1050 IF Z > .6 THEN 1150
1060 IF Z > .3 THEN 1110
1070 U = U1
1080 T = T1 + 1
1090 M = 10*T + U
1100 RETURN
1110 U = U1 + 1
1120 T = T1 + 2
1130 M = 10*T + U
1140 RETURN
1150 U = U1 + 1
1160 T = T1 + 1
1170 M = 10*T + U
1180 RETURN
1190 REM ILLEGAL MOVE MESSAGE.
1200 PRINT
1210 PRINT "Y O U C H E A T . . . TRY AGAIN";
1220 GOTO 560
1230 REM PLAYER WINS.
1240 PRINT
1250 PRINT "C O N G R A T U L A T I O N S . . . "
1260 PRINT
1270 PRINT "YOU HAVE WON--VERY WELL PLAYED."
1280 PRINT "IT LOOKS LIKE I HAVE MET MY MATCH."
1290 PRINT "THANKS FOR PLAYING--I CANNOT WIN ALL THE TIME."
1300 PRINT
1310 GOTO 1490
1320 REM MACHINE WINS.
1330 PRINT
1340 PRINT "NICE TRY, BUT IT LOOKS LIKE I HAVE WON."
1350 PRINT "THANKS FOR PLAYING."
1360 PRINT
1370 GOTO 1490
1380 REM TEST FOR MACHINE MOVE.
1390 M = 10*T + U
1400 IF M = 158 THEN 1460
1410 IF M = 127 THEN 1460
1420 IF M = 126 THEN 1460
1430 IF M = 75 THEN 1460
1440 IF M = 73 THEN 1460
1450 RETURN
1460 C = 1
1470 GOTO 1450
1480 REM ANOTHER GAME?
1490 PRINT "ANYONE ELSE CARE TO TRY";
1500 INPUT Q$
1510 PRINT
1520 IF Q$="YES" THEN390
1530 IF Q$="NO" THEN 1560
1540 PRINT "INCORRECT ANSWER. PLEASE TYPE YES OR NO";
1550 GOTO 1500
1560 PRINT "OK - - THANKS AGAIN."
1570 STOP
1580 REM DIRECTIONS, ETC. . .
1590 PRINT "WE ARE GOING TO PLAY A GAME BASED ON ONE OF THE CHESS MOVES."
1600 PRINT "OUR QUEEN WILL BE ABLE TO MOVE ONLY TO THE RIGHT,"
1610 PRINT "DOWN, AND DIAGONALLY DOWN TO THE RIGHT."
1620 PRINT
1630 PRINT "THE OBJECT OF THE GAME IS TO PLACE THE QUEEN IN THE"
1640 PRINT "LOWER RIGHT-HAND SQUARE BY ALTERNATING MOVES BETWEEN"
1650 PRINT "YOU AND THE MACHINE/ THE FIRST ONE TO PLACE THE QUEEN"
1660 PRINT "THERE, WINS. REMEMBER THAT WE ARE ONLY PLAYING WITH"
1670 PRINT "ONE QUEEN. THAT IS, WE ARE BOTH MOVING THE SAME QUEEN."
1680 PRINT
1690 PRINT "YOU GO FIRST AND PLACE THE QUEEN IN ANY ONE OF THE"
1700 PRINT "SQUARES ON THE TOP ROW OR THE LEFT-HAND COLUMN."
1710 PRINT "THAT WILL BE YOUR FIRST MOVE."
1720 PRINT "WE WILL THEN ALTERNATE MOVES."
1730 PRINT "YOU MAY FORFEIT ANY TIME BY TYPING - 0 - AS YOU MOVE!"
1740 PRINT "BESURE TO HIT THE RETURN KEY AFTER EACH RESPONSE."
1750 PRINT
1760 FOR A = 0 TO 7
1770 FOR B = 1 TO 8
1780 I = 8*A + B
1790 PRINT TAB(6*(B-1)+1);I;
1800 NEXT B
1810 PRINT
1820 PRINT
1830 PRINT
1840 NEXT A
1850 PRINT
1860 RETURN
1870 END
TAB(6*(B-1)+1);I;
1800 NEXT B
1810 PRINT
1820 PRINT
1830 PRINT
1840 NEXT A
1850 PRINT