5 PRINT CHR$(26)
10 PRINT TAB(33);"BATNUM":PRINT
20 PRINT TAB(15);"CREATIVE COMPUTING  MORRISTOWN, NEW JERSEY"
30 PRINT:PRINT:PRINT
110 PRINT "   This program is a 'Battle of Numbers' game, where the"
120 PRINT "computer is your opponent."
130 PRINT 
140 PRINT "   The game starts with an assumed pile of objects. You"
150 PRINT "and your opponent alternately remove objects from the pile."
160 PRINT "Winning is defined in advance as taking the last object or"
170 PRINT "not. You can also specify some other beginning conditions."
180 PRINT "Don't use zero, however, in playing the game.":PRINT
190 PRINT "Enter a negative number for new pile size to stop playing."
200 PRINT:PRINT
210 GOTO 330
220 FOR I=1 TO 10
230 PRINT
240 NEXT I
330 INPUT "ENTER PILE SIZE";N
350 IF N>=1 THEN 370
360 PRINT:PRINT:PRINT:RUN "MENU"
370 IF N<>INT(N) THEN 220
380 IF N<1 THEN 220
390 INPUT "ENTER WIN OPTION - 1 TO TAKE LAST, 2 TO AVOID LAST: ";M
410 IF M=1 THEN 430
420 IF M<>2 THEN 390
430 INPUT "ENTER MIN AND MAX ";A,B
450 IF A>B THEN 430
460 IF A<1 THEN 430
470 IF A<>INT(A) THEN 430
480 IF B<>INT(B) THEN 430
490 INPUT "ENTER START OPTION - 1 COMPUTER FIRST, 2 YOU FIRST ";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:PRINT "COMPUTER TAKES";N;"AND LOSES."
670 RETURN
680 IF N>B THEN 720
690 W=1
700 PRINT:PRINT "COMPUTER TAKES";N;"AND WINS."
710 RETURN
720 P=Q-C*INT(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: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:PRINT "I TOLD YOU NOT TO USE ZERO! COMPUTER WINS BY FORFEIT."
850 W=1
860 RETURN
870 IF P<>INT(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:PRINT "TOUGH LUCK, YOU LOSE."
980 W=1
990 RETURN
1000 PRINT:PRINT: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 RUN "MENU"
