5 PRINT TAB(23);"MASTERBAGELS" 6 PRINT TAB(20);"CREATIVE COMPUTING" 7 PRINT TAB(18);"MORRISTOWN, NEW JERSEY" 10 DIM F(9),M(9),T(9),H(18,3) 20 INPUT "TEACH";S\$ 30 IF LEFT\$(S\$,1)="N" THEN 130 50 PRINT " HI, THIS IS A LOGIC GAME DESIGNED TO TEST YOUR DEDUCTIVE" 60 PRINT "ABILITY. I WILL CHOOSE A RANDOM NUMBER AND YOU ISOLATE IT." 70 PRINT "WHEN PROMPTED, ENTER A VALID NUMBER, AND I WILL THEN RESPOND" 80 PRINT "WITH THE # OF DIGITS THAT ARE RIGHT AND IN THE RIGHT POSITION" 90 PRINT "AND THE # RIGHT BUT IN THE WRONG POSITION. IF I THINK YOU" 100 PRINT "ARE HOPELESSLY LOST, I WILL TELL YOU THE ANSWER AND WE" 110 PRINT "WILL GO ON TO THE NEXT NUMBER. TO RECAP YOUR ENTRIES" 120 PRINT "ENTER A 0, TO QUIT ON A NUMBER ENTER 1, AND TO STOP ENTER 2" 130 S=0 140 PRINT 150 PRINT "HOW MANY #'S(1-100), # DIGITS(2-6), AND MAX VALUE(2-9)"; 160 INPUT J,A,B 180 IF A<=0 THEN 220 190 IF A>6 THEN 220 200 IF B<2 THEN 220 210 IF B<10 THEN 240 220 PRINT "ILLEGAL RANGE, RE-ENTER RUN PARAMETERS" 230 GOTO 160 240 IF J<100 THEN 260 250 J=100 260 FOR X=0 TO J+A+B 270 I=RND(1) 280 NEXT X 290 FOR N=1 TO J 300 FOR X=0 TO A 310 T(X)=INT(RND(1)*B+1) 320 NEXT X 330 FOR I=1 TO A+B+1 340 FOR X=1 TO A 350 F(X)=0 360 NEXT X 370 F1=0 380 F2=0 390 INPUT "GUESS";V 400 IF V<> 0 THEN 450 410 FOR X=1 TO I-1 420 PRINT H(X,1)","H(X,2)"="H(X,3) 430 NEXT X 440 GOTO 390 450 IF V=1 THEN 750 460 IF V=2 THEN 920 470 T1=V 480 FOR X=1 TO A 490 M(X)=INT(T1/(10^(A-X))) 500 T1=T1-M(X)*(10^(A-X))+((SGN(A-(X+1))-1)*-.5) 510 IF M(X)<1 THEN 530 520 IF M(X)T(X) THEN 580 560 F(X)=1 570 F1=F1+1 580 NEXT X 590 IF F1=A THEN 810 600 FOR Y=1 TO A 610 IF T(Y)=M(Y) THEN 690 620 FOR X=1 TO A 630 IF M(Y)<>T(X) THEN 680 640 IF F(X)=1 THEN 680 650 F(X)=1 660 F2=F2+1 670 GOTO 690 680 NEXT X 690 NEXT Y 700 PRINT F1","F2 710 H(I,1)=F1 720 H(I,2)=F2 730 H(I,3)=V 740 NEXT I 750 I=A-1+B+1 760 V=0 770 FOR X=1 TO A 780 V=V+T(X)*(10^(A-X)) 790 NEXT X 800 PRINT "ANSWER IS"V 810 S=S+I 820 PRINT I"TRIES,"S/N"AVERAGE FOR"N"NUMBERS" 830 Y=INT(RND(R)*I) 840 Y=INT(H(Y,2)/1024+4*RND(1)) 850 FOR X=1 TO Y+1 860 I=RND(1) 870 NEXT X 880 NEXT N 890 INPUT "RUN AGAIN";S\$ 900 IF LEFT\$(S\$,1)="Y" THEN 130 920 END