8-Bit Software Online Conversion

Eliza - Listing

10REM Eliza 20REM (C) 1996 Jon Ripley 30REM This program is PD 40DEFFNS="Eliza" 50MODE 7 60FORX=1TO2:PRINTTAB(8,X)CHR$141;CHR$ (127+2*X)"Eliza (C) Jon Ripley":NEXT 70VDU28,0,24,39,4 80CLS 90PROCinit 100ONERRORMODE7:PRINT"Goodbye!":END 110PRINT"Welcome to Eliza." 120INPUT"What is your first name:"n$ 130IF n$="" n$="Mr. Nobody" 140PRINT'"HELLO ";n$"." 150A%=RND(-TIME) 160PRINT'"OK ";n$" WHAT SEEMS TO BE TH E PROBLEM?" 170REPEAT 180INPUTLINEa$ 190IF a$="" PRINT" >Pardon...":GOTO380 200PRINT" >"; 210b$="" 220FORx=1TOLENa$ 230c$=MID$(a$,x,1) 240IFc$>="a"ANDc$<="z"b$=b$+CHR$(ASC(c $)-32)ELSEb$=b$+c$ 250NEXT 260a$=b$ 270IFINSTR(a$,"BYE")PRINT''"Goodbye fo r now, ";n$".":END 280IFLEFT$(a$,7)="BECAUSE" a$=RIGHT$(a $,LENa$-7) 290a$=" "+a$+" " 300z=0 310REPEAT 320z=z+1 330d=INSTR(a$,d$(z)) 340UNTILd<>0ORz=t1 350IFd<>0 PROCprocess:UNTIL. 360PRINTh$(RND(t3)) 370PRINT 380UNTIL. 390END 400DEFPROCinit 410t1=35 420t2=11 430t3=11 440DIMd$(t1),e$(t1),f$(t2),g$(t2),h$(t 3) 450FORx=1TOt1 460READd$(x),e$(x) 470NEXT 480FORx=1TOt2 490READf$(x),g$(x) 500NEXT 510FORx=1TOt3 520READh$(x) 530NEXT 540READa$ 550IFa$<>"ZZZZ"VDU7:PRINT"Error in dat a!":END 560ENDPROC 570DEFPROCprocess 580PRINTe$(z)" "; 590IFRIGHT$(e$(z),1)<"A"PRINT:ENDPROC 600h=LENa$-(d+LEN(d$(z))) 610IFh>0a$=RIGHT$(a$,h) 620z=0 630REPEAT 640z=z+1 650d=INSTR(a$,f$(z)) 660IFz>=t2 PRINTa$:UNTILTRUE:ENDPROC 670UNTILd<>0 680j$=LEFT$(a$,(d-1))+" "+g$(z) 690z=LEN(a$)-LEN(LEFT$(a$,(d-1)))-LEN( g$(z)) 700PRINTj$ 710IFz>2 l$=RIGHT$(a$,(z-2)):IFINSTR(j $,l$)=0ENDPROC:REM ****K$???*** 720IFz>2PRINTRIGHT$(a$,(z-2)) 730IFz<2 PRINT 740ENDPROC 750REM Keywords, Replies 760DATA " CAN YOU","PERHAPS YOU WOULD LIKE TO BE ABLE TO" 770DATA " DO YOU","YES, I" 780DATA " CAN I","PERHAPS YOU DON'T WA NT TO BE ABLE TO" 790DATA " YOU ARE","WHAT MAKES YOU THI NK I AM" 800DATA " YOU'RE","WHAT IS YOUR REACTI ON TO ME BEING" 810DATA " I DON'T","WHAT DON'T YOU" 820DATA " I FEEL","TELL ME MORE ABOUT FEELING" 830DATA " WHY DON'T YOU","WHY WOULD YO U WANT ME TO" 840DATA " WHY CAN'T I","WHAT MAKES YOU THINK YOU SHOULD BE ABLE TO" 850DATA " ARE YOU","WHY ARE YOU INTERE STED IN WHETHER OR NOT I AM" 860DATA " I CAN'T","HOW DO YOU KNOW YO U CAN'T" 870DATA " SEX","I FEEL YOU SHOULD REAL LY DISCUSS THIS WITH A HUMAN?" 880DATA " I AM","HOW LONG HAVE YOU BEE N" 890DATA " I'M","WHY ARE YOU TELLING ME YOU'RE" 900DATA " I WANT","WHY DO YOU WANT" 910DATA " WHAT","WHAT DO YOU THINK?" 920DATA " HOW","WHAT ANSWER WOULD PLEA SE YOU MOST?" 930DATA " WHO","HOW OFTEN DO YOU THINK OF SUCH QUESTIONS?" 940DATA " WHERE","WHY DID YOU ASK ME T HAT?" 950DATA " WHEN","WHAT WOULD YOUR BEST FRIEND SAY TO THAT QUESTION?" 960DATA " WHY","WHAT IS IT THAT YOU RE ALLY WANT TO KNOW" 970DATA " PERHAPHS","YOU'RE NOT VERY F IRM ON THAT!" 980DATA " DRINK","MODERATION IN ALL TH INGS SHOULD BE THE RULE." 990DATA " SORRY","WHY ARE YOU APOLOGOZ ING?" 1000DATA " DREAM","WHY DID YOU BRING UP THE SUBJECT OF DREAMS?" 1010DATA " I LIKE","IS IT GOOD THAT YOU LIKE" 1020DATA " MAYBE","AREN'T YOU BEING A B IT NEGATIVE" 1030DATA " NO","WHY ARE YOU BEING NEGAT IVE?" 1040DATA " YOUR","WHY ARE YOU CONCERNED ABOUT MY" 1050DATA " ALWAYS","CAN YOU THINK OF A SPECIFIC EXAMPLE" 1060DATA " THINK","DO YOU DOUBT" 1070DATA " YES","YOU SEEM QUITE CERTAIN . WHY IS THIS SO?" 1080DATA " COMPUTER","WHY DO YOU MENTIO N COMPUTERS" 1090DATA " FRIEND","WHY DO YOU BRING UP THE SUBJECT OF FRIENDS" 1100DATA " I AM","YOU ARE" 1110REM CONJUGATE 1120DATA " I","YOU" 1130DATA " ARE","AM" 1140DATA " WERE","WAS" 1150DATA " YOU","ME" 1160DATA " YOUR","MY" 1170DATA " I'VE","YOU'VE" 1180DATA " I'M","YOU'RE" 1190DATA " ME","YOU" 1200DATA " AM I","YOU ARE" 1210DATA " AM ","ARE" 1220DATA " MY","YOUR" 1230REM Random Replies 1240DATA "WHAT DOES THAT SUGGEST TO YOU ?" 1250DATA "I SEE..." 1260DATA "I'M NOT SURE I UNDERSTAND YOU FULLY." 1270DATA "CAN YOU ELABORATE ON THAT?" 1280DATA "THAT'S QUITE INTERESTING!" 1290DATA "THAT'S SO...PLEASE CONTINUE.. ." 1300DATA "I UNDERSTAND..." 1310DATA "WELL, WELL...DO GO ON." 1320DATA "WHY ARE YOU SAYING THAT?" 1330DATA "PLEASE EXPLAIN THE BACKGROUND TO THAT REMARK." 1340DATA "COULD YOU SAY THAT AGAIN, IN A DIFFERENT WAY?" 1350REM End 1360DATA "ZZZZ"