10 'PEOPLE LEARNING PROGRAM
20 'BY R.D.PRESSON  11/15/81
30 'LAST MODIFIED   12/02/81
40 '
50 '
60 GOTO 640
70 CUR=2:CLS:LOCATE 5,1
80 GET #1,CUR
90 GOSUB 920
100 ENDOFQ=INSTR(QUE$,"    ")
110 QUES$=LEFT$(QUE$,ENDOFQ-1)
120 IF RTPTR=0 THEN 210
130 PRINT QUES$;:COLOR 31:PRINT"?   ";:COLOR 7
140 GOSUB 930:LOCATE CSRLIN-2,1+LEN(QUES$):PRINT"?";:LOCATE 2+CSRLIN,1
150 IF YN=2 THEN INPUT"Enter new question: ",QUES$:LSET QUE$=QUES$:PUT 1,CUR:GOTO 130
160 PREV=CUR
170 IF YN=1 THEN CUR=RTPTR ELSE CUR=WRNGPTR
180 SAVEANS=YN
190 GOTO 80
200 END
210 'Have reached an entry. Is it correct?
220 PRINT"Are you ";QUES$;:COLOR 31:PRINT"?   ";:COLOR 7
230 GOSUB 930:LOCATE CSRLIN-2,9+LEN(QUES$):PRINT"?";:LOCATE 2+CSRLIN,1
240 IF YN=2 THEN INPUT"Enter new name: ",QUES$:LSET QUE$=QUES$:PUT 1,CUR:GOTO 220
250 IF YN=1 THEN 520
260 PRINT
270 PRINT"I give up.  Who are you";:COLOR 31:PRINT"?   ";:COLOR 7
280 INPUT " ",ANIM$:LOCATE CSRLIN-1,24:PRINT"?";:LOCATE 2+CSRLIN,1
290 PRINT:PRINT"Please type a yes or no question that will distinguish between ";QUES$
300 PRINT " and ";ANIM$;"."
310 PRINT
320 INPUT Q$:PRINT
330 PRINT "What is the correct answer for ";ANIM$;"?"
340 GOSUB 930
350 GET #1,1
360 CNT=CVI(L$):LAST=CVI(R$)
370 CNT=CNT+1:LAST=LAST+2
380 LSET L$=MKI$(CNT):LSET R$=MKI$(LAST)
390 PUT #1,1
400 GET #1,PREV
410 IF SAVEANS=0 THEN LSET L$=MKI$(LAST-1):ELSE LSET R$=MKI$(LAST-1)
420 PUT #1,PREV
430 GET #1,LAST-1
440 LSET QUE$=Q$:IF YN=1 THEN RTPTR=LAST:WRNGPTR=CUR
450 ELSE RTPTR=CUR:WRNGPTR=LAST
460 LSET L$=MKI$(WRNGPTR):LSET R$=MKI$(RTPTR)
470 PUT #1,LAST-1:GET #1,LAST
480 GOSUB 910
490 LSET QUE$=ANIM$:PUT #1,LAST
500 PRINT "I now know ";CNT;" people."
510 GOTO 570
520 'correct
530 FOR L=1 TO 10:PRINT:NEXT L
540 BEEP
550 PRINT"You are uniquely identified by your fingerprints."
560 PRINT
570 PRINT "Does anyone else want to test my powers";:COLOR 31:PRINT "?   ";:COLOR 7
580 GOSUB 930
590 IF YN=1 THEN 70
600 CLS:LOCATE 12,37:PRINT"Be yourself.":LOCATE 23,1
610 CLOSE #1
620 KEY ON
630 END
640 DIM NW$(70),ANIM$(70),Q$(70),A$(70),RF$(20),WF$(20),AN$(10),CL$(20),OP$(40)
650 RF$="READ PEOPLEFILE,R":WF$="WRITE PEOPLEFILE,R":CL$="CLOSE"
660 OPEN "PEOPLEF" AS #1 LEN=80
670 FIELD #1,76 AS QUE$,2 AS L$,2 AS R$
680 KEY OFF:CLS:LOCATE 5,1
690 PRINT " ***** PEOPLE LEARNING PROGRAM *****": PRINT:PRINT"Do you need instructions? (Y/N): ";: GOSUB 930:IF YN=0 THEN 70
700 PRINT:PRINT "Instructions:":PRINT
710 PRINT"     I will try to determine your identity by asking questions.
720 PRINT "Please respond by pressing the Y or N key."
730 PRINT "If I don't know you, I will ask you for information so that
740 PRINT "I will know you in the future.":PRINT
750 PRINT "     Shall we begin? (Y/N): ":GOSUB 930:IF YN=1 THEN 70
760 INPUT "NEWFILE?",A$:IF A$<>"NEWFILE" THEN END
770 PRINT "CHOSE TO MAKE NEW FILE":END
780 IF A$<>"NEWFILE" THEN 70
790 LSET L$=MKI$(2):LSET R$=MKI$(4)
800 PUT 1,1
810 LSET QUE$="Do you work for IBM"
820 LSET L$=MKI$(3):LSET R$=MKI$(4)
830 PUT 1,2
840 GOSUB 910
850 LSET QUE$="Tim from Computerland"
860 PUT 1,3
870 LSET QUE$="Rick Presson"
880 GOSUB 910
890 PUT 1,4
900 GOTO 70
910 LSET L$=MKI$(0):LSET R$=MKI$(0):RETURN
920 RTPTR=CVI(R$):WRNGPTR=CVI(L$):RETURN
930 YN$=INKEY$: IF YN$="" THEN 930
940 YN=3
950 IF (YN$="Y") OR (YN$="y") THEN YN=1:PRINT"Yes"
960 IF (YN$="N") OR (YN$="n") THEN YN=0:PRINT"No"
970 IF (YN$="E") OR (YN$="e") THEN YN=2:PRINT"Edit"
980 IF YN=3 THEN 930
990 PRINT
1000 RETURN