5 DIM N(10),A(10)
10 PRINT:PRINT:PRINT"THE BAGELS GAME:"
60 PRINT
70 INPUT "WOULD YOU LIKE THE RULES";A$
80 IF A$="N" OR A$="NO" THEN 160
90 PRINT"I AM THINKING OF A 3 DIGIT NUMBER.  YOU CAN GUESS WHAT"
100 PRINT"NUMBER I HAVE IN MIND AND I WILL TELL YOU:"
120 PRINT"PICO - ONE DIGIT IS IN THE WRONG PLACE"
130 PRINT"FERMI - ONE DIGIT IS IN THE CORRECT PLACE"
140 PRINT"BAGELS - NO DIGIT IS CORRECT"
160 RANDOMIZE TIMER
165 N(3)=INT(RND*9+1)
170 N(2)=INT(RND *10)
180 IF N(2)=N(3) THEN 170
190 N(1)=INT(RND *10)
200 IF N(1)=N(2) THEN 190
210 IF N(1)=N(3) THEN 190
220 PRINT: PRINT "OK, I HAVE A NUMBER."
240 G=0
260 PRINT:PRINT:PRINT "YOUR GUESS";
290 INPUT X
300 G=G+1
310 A(3)=INT(X/100)
320 A(2)=INT(X/10)-A(3)*10
330 A(1)=X-INT(X/10)*10
340 IF A(3)>9 THEN 410
350 IF A(3)<1 THEN 410
360 IF INT(X)<>X THEN 410
370 IF A(1)=A(2) THEN 410
380 IF A(2)=A(3) THEN 410
390 IF A(1)=A(3) THEN 410
400 GOTO 450
410 PRINT "   PICK A 3 DIGIT NUMBER FROM 102 TO 987"
420 PRINT "   HINT: IN MY NUMBER ALL THE DIGITS ARE DIFFERENT"
430 GOTO 260
450 F=0:P=0
460 FOR I=1 TO 3
470 FOR J=1 TO 3
480 IF A(I)=N(J) THEN 540
490 NEXT J
500 NEXT I
510 IF F+P<>0 THEN 590
520 PRINT"BAGELS ";
530 GOTO 260
540 IF I=J THEN 570
550 P=P+1
560 GOTO 490
570 F=F+1
580 GOTO 490
590 IF P=0 THEN 630
600 FOR K=1 TO P
610 PRINT "PICO ";
620 NEXT K
630 IF F=0 THEN 260
640 IF F=3 THEN 700
650 FOR K=1 TO F
660 PRINT "FERMI  ";
670 NEXT K
680 GOTO 260
700 PRINT "YOU GOT IT IN ";G;"GUESSES!!!"
750 PRINT:INPUT "ANOTHER GAME";A$
760 IF LEFT$(A$,1)="Y" THEN 160
770 END
