10 DIM T(10)
20 DIM L(307)
101 PRINT
104 PRINT"HI, I'M THE TAXMAN"
106 PRINT"DO YOU WANT THE REGULATIONS ( Y  OR  N )";
108 INPUT R$
110 IF R$="Y" THEN 900
120 REM ***INITIALZATION
122 GOSUB 800
124 REM ***THE HUMAN TAKES A NUMBER
126 GOSUB 500
128 REM *** COMPUTE THE HUMAN'S AND TAXMANS TOTLES
130 GOSUB 570
132 REM *** PRINT THE NEW LIST
134 GOSUB 600
136 REM *** CHECK IF ANY NUMBERS STILL HAVE FACTORS
138 GOSUB 650
140 IF M=1 THEN 126
142 REM *** FIND THE WINNER
144 GOSUB 700
146 REM *** AGAIN?
148 GOTO 750
496 REM 
497 REM *** THE HUMAN MOVES
498 REM
500 PRINT
502 PRINT
504 PRINT"YOU TAKE";
506 INPUT K
508 K=INT(K)
510 IF K <= 0 THEN 750
512 IF K <=N THEN 518
514 PRINT K;"IS NOT IN THE LIST  --  TRY AGAIN."
516 GOTO 502
518 IF L(K)=0 THEN 514
520 REM  FIND ALL THE FACTORS
522 IF K>1 THEN 530
524 PRINT"THERE ARE NO FACTORS OF";K;"FOR ME."
526 PRINT"ARE YOU TRYING TO SHORT-CHANGE THE TAXMAN?"
528 GOTO 502
530 M=0
532 FOR I=1 TO K/2
534 IF L(I)=0 THEN 544
536 IF K <> I*INT(K/I) THEN 544
538 M=M+1
540 T(M)=I
542 L(I)=0
544 NEXT I
546 REM CHECK WETHER THERE WERE ANY FACTORS
548 IF M=0 THEN 524
550 L(K)=0
552 RETURN
566 REM
567 REM *** COMPUTE THE HUMAN'S AND TAXMAN'S TOTALS
568 REM
570 Y=Y+K
572 PRINT"YOUR TOTAL IS";Y
574 PRINT"I GET";
576 FOR I=1 TO M
578 PRINT T(I);
580 Z=Z+T(I)
582 NEXT I
584 PRINT
586 PRINT"MY TOTAL IS";Z
588 RETURN
596 REM
597 REM *** PRINT THE NEW LIST
598 REM
600 PRINT
602 PRINT"NEW LIST:";
604 M=0
606 FOR I=1 TO N
608 IF L(I)=0 THEN 614
610 PRINT I;
612 M=1
614 NEXT I
616 RETURN
646 REM
647 REM *** CHECK IF ANY NUMBERS STILL HAVE FACTORS
648 REM
649 REM CHECK IF THE LIST IS EMPTY
650 IF M=0 THEN 690
652 FOR I=N TO 4 STEP -1
654 FOR J=2 TO I/2
656 IF L(J)=0 THEN 664
658 IF I<> J*INT(I/J) THEN 664
660 M=1
662 RETURN
664 NEXT J
666 NEXT I
668 REM  THE TAXMAN GETS THE REST OF THE NUMBERS
670 PRINT
672 PRINT"I GET";
674 FOR I=1 TO N
676 IF L(I)=0 THEN 682
678 PRINT I;
680 Z=Z+I
682 NEXT I
684 PRINT"BECAUSE NO FACTORS OF ANY NUMBER ARE LEFT."
686 PRINT"MY TOTAL IS";Z
688 M=0
690 RETURN
696 REM
697 REM *** FIND THE WINNER
698 REM
700 PRINT
702 IF Z>Y THEN 708
704 PRINT"YOU";Y;"     TAXMAN";Z;"    YOU WIN!!!"
706 RETURN
708 PRINT"TAXMAN";Z;"    YOU";Y;"    THE TAXMAN WINS."
710 RETURN
746 REM 
747 REM *** AGAIN?
748 REM
750 PRINT 
752 PRINT
754 PRINT"AGAIN ( Y  OR  N )";
756 INPUT R$
759 IF R$="N" THEN 999
760 GOTO 122
796 REM
797 REM *** INITIALATION
798 REM
800 PRINT
802 PRINT"HOW MANY NUMBERS DO YOU WANT IN THE LIST";
804 INPUT N
806 N=INT(N)
808 IF N <= 0 THEN 999
810 IF N<=307 THEN 818
812 PRINT"AT THIS TIME, REGULATIONS ALLOW A MAXIMUM OF 307 NUMBERS."
814 GOTO 800
818 Y=0
820 Z=0
822 PRINT
824 PRINT"THE LIST IS:";
826 FOR I=1 TO N
828 PRINT I;
830 L(I)=1
832 NEXT I
834 IF N>1 THEN 844
836 PRINT
838 PRINT"HOW VERY GENEROUS OF YOU TO FORFEIT ALL TO THE TAXMAN."
840 PRINT"TAXMAN  1    YOU  0       THE TAXMAN WINS."
842 GOTO 750
844 RETURN
896 REM
897 REM *** INSTRUCTIONS
898 REM
900 PRINT
901 PRINT"YOU TRY TO BEAT THE TAXMAN."
902 PRINT
904 PRINT"WE START WITH A LIST OF WHOLE NUMBERS IN NUMERICAL"
906 PRINT"ORDER (YOU DECIDE HOW MANY)."
908 PRINT
910 PRINT"YOU TAKE A NUMBER FROM THE LIST -- THE TAXMAN GETS"
912 PRINT"ALL THE FACTORS OF YOUR NUMBER THAT ARE STILL LEFT"
914 PRINT"YOUR NUMBER AND ALL OF ITS FACTORS ARE THEN DELETED"
916 PRINT"FROM THE LIST."
918 PRINT
920 PRINT"FOR EXAMPLE, SUPPOSE YOU WANT TEN NUMBERS TO BE IN THE LIST."
922 PRINT"THEN THE LIST WOULD BE: 1 2 3 4 5 6 7 8 9 10"
924 PRINT
926 PRINT"IF YOU TOOK 8, THE TAXMAN WOULD GET: 1, 2, AND 4"
928 PRINT"AND THE NEW LIST WOULD BE: 3 5 6 7 9 10"
929 INPUT"TYPE G THEN (RETURN) TO GO ON";W$
930 IF W$<>"G" THEN 929
932 PRINT"THE TAXMAN MUST GET SOMTHING EVERY TIME SO YOU CAN"
934 PRINT"ONLY PICK A NUMBER THAT HAS FACTORS LEFT,"
936 PRINT
938 PRINT"WHEN NONE OF THE REMAINING FACTORS,"
940 PRINT"THE TAXMAN GETS THEM!!!"
942 PRINT
944 PRINT"YOUR SCORE IS THE SUM OF NUMBERS YOU TAKE."
946 PRINT"IF YOU WANT TO GIVE UP, TAKE 0."
948 PRINT"GOOD LUCK !!!"
950 GOTO 122
999 END
