Apple-1-Mini/code/programs/BASIC/BATNUM.TXT

100 lines
2.3 KiB
Plaintext

10 TAB(16): PRINT "BATNUM"
20 TAB(5):PRINT "CREATIVE COMPUTING, NEW JERSEY"
25 TAB(1):PRINT "MODIFIED BY PHILIP LORD FOR THE APPLE 1"
30 PRINT:PRINT:PRINT
110 PRINT "THIS PROGRAM IS A 'BATTLE OF NUMBERS'"
120 PRINT "GAME, WHERE THE COMPUTER IS YOUR "
125 PRINT "OPPONENT."
130 PRINT
140 PRINT "THE GAME STARTS WITH AN ASSUMED PILE OF"
150 PRINT "OBJECTS. YOU AND YOUR OPPONENT "
160 PRINT "ALTERNATELY TAKE OBJECTS FROM THE PILE."
170 PRINT "WINNING IS DEFINED IN ADVANCE AS TAKING"
175 PRINT "THE LAST OBJECT OR NOT. YOU CAN ALSO"
178 PRINT "SET SOME OTHER BEGINNING CONDITIONS."
180 PRINT "DON'T USE ZERO, HOWEVER, IN PLAYING THE"
190 PRINT "GAME. ENTER A NEGATIVE NUMBER FOR NEW "
195 PRINT "PILE SIZE TO STOP PLAYING."
200 PRINT
210 GOTO 330
220 FOR I=1 TO 10
230 PRINT
240 NEXT I
330 PRINT"ENTER PILE SIZE": INPUT N: PRINT
350 IF N>=1 THEN 370
360 GOTO 330
370 IF N<>N THEN 220
380 IF N<1 THEN 220
390 PRINT "ENTER WIN OPTION"
390 PRINT "1 TO TAKE LAST, 2 TO AVOID LAST: ": INPUT M: PRINT
410 IF M=1 THEN 430
420 IF M<>2 THEN 390
430 PRINT "ENTER MIN AND MAX ": INPUT A,B: PRINT
450 IF A>B THEN 430
460 IF A<1 THEN 430
470 IF A<>A THEN 430
480 IF B<>B THEN 430
490 PRINT "ENTER START OPTION"
490 PRINT "1 COMPUTER FIRST, 2 YOU FIRST ": INPUT S
500 PRINT:PRINT
510 IF S=1 THEN 530
520 IF S<>2 THEN 490
530 C=A+B
540 IF S=2 THEN 570
550 GOSUB 600
560 IF W=1 THEN 220
570 GOSUB 810
580 IF W=1 THEN 220
590 GOTO 550
600 Q=N
610 IF M=1 THEN 630
620 Q=Q-1
630 IF M=1 THEN 680
640 IF N>A THEN 720
650 W=1
660 PRINT "COMPUTER TAKES ";N;" AND LOSES."
670 RETURN
680 IF N>B THEN 720
690 W=1
700 PRINT "COMPUTER TAKES ";N;" AND WINS."
710 RETURN
720 P=Q-C*(Q/C)
730 IF P>=A THEN 750
740 P=A
750 IF P<=B THEN 770
760 P=B
770 N=N-P
780 PRINT "COMPUTER TAKES ";P;" AND LEAVES ";N
790 W=0
800 RETURN
810 PRINT:PRINT "YOUR MOVE ";
820 INPUT P
830 IF P<>0 THEN 870
840 PRINT: PRINT "I TOLD YOU NOT TO USE ZERO!"
845 PRINT "COMPUTER WINS BY FORFEIT."
850 W=1
860 RETURN
870 IF P<>P THEN 920
880 IF P>=A THEN 910
890 IF P=N THEN 960
900 GOTO 920
910 IF P<=B THEN 940
920 PRINT "ILLEGAL MOVE, REENTER IT ";
930 GOTO 820
940 N=N-P
950 IF N<>0 THEN 1030
960 IF M=1 THEN 1000
970 PRINT "TOUGH LUCK, YOU LOSE."
980 W=1
990 RETURN
1000 PRINT "CONGRATULATIONS, YOU WIN."
1010 W=1
1020 RETURN
1030 IF N>=0 THEN 1060
1040 N=N+P
1050 GOTO 920
1060 W=0
1070 RETURN
1080 END
RUN