Eliza

Here is the original Eliza program circa 1979. To use this program in RunBASIC just copy and paste the code into the RunBASIC editor and you are all set.

code ' ELIZA' LAST MOD. JULY 1979' ' CONVERTED TO LIBERTY/JUST/RUN BASIC BY NOBLE D. BELL' HTTP://WWW.NOBLEBELL.COM '[MAIN]   CLS    PRINT ""    GOSUB [START]    DIM C$(72)    DIM I$(72) DIM K$(72)   DIM F$(72)    DIM S$(72)    DIM R$(72)    DIM P$(72) DIM Z$(72)   DIM S(37)    DIM R(37)    DIM N(37) N1 = 37 : N2 = 14 : N3 = 117   FOR X = 1 TO N1 + N2 + N3        READ Z$    NEXT X    FOR X = 1 TO N1        READ Z,L        S(X) = Z        R(X) = S(X) N(X) = S(X) + L - 1   NEXT X    PRINT "HI! I'M ELIZA. WHAT'S YOUR PROBLEM?"[USER.INPUT]    INPUT I$    I$ = " " + I$ + " "    ' REMOVE APPOSTROPHIES    FOR L = 1 TO LEN(I$)[L260] IF MID$(I$, L, 1) <> "'" THEN [L290] I$ = MID$(I$, 1, L - 1) + MID$(I$, L + 1, LEN(I$) - L)   GOTO [L260][L290] IF L + 4 >= LEN(I$) THEN [L330] IF UPPER$(MID$(I$, L, 4)) <> "SHUT" THEN [L330] PRINT "IF THAT'S HOW YOU FEEL--GOODBYE..." END[L330]   NEXT L    IF I$ = P$ THEN        PRINT "PLEASE DON'T REPEAT YOURSELF!" GOTO [USER.INPUT]   END IF    RESTORE    S=0    FOR K = 1 TO N1        READ K$        IF S > 0 THEN [L510] FOR L = 1 TO LEN(I$) - LEN(K$) + 1 IF MID$(I$,L,LEN(K$)) <> K$ THEN [L500]           S = K            T = L            F$ = K$[L500]    NEXT L[L510]    NEXT K    IF S <=0 THEN        K = 37 ' NO KEYWORDS        GOTO [GET.REPLY] END IF   K = S    L = T    ' TAKE RIGHT PART OF STRINGS AND CONJUGATE IT USING THE LIST OF STRINGS TO BE SWAPPED RESTORE   FOR X = 1 TO N1        READ Z$    NEXT X[CONJUGATE] IF (LEN(I$) - LEN(F$) - L + 1) > 0 THEN [CONJ1]   L = L - 1 GOTO [CONJUGATE][CONJ1] C$ = " " + MID$(I$, LEN(F$) + L, LEN(I$) - (LEN(F$) + L - 1)) FOR X = 1 TO N2 / 2       READ S$, R$        FOR L = 1 TO LEN(C$) IF L + LEN(S$) > LEN(C$) THEN [CONJ2] IF MID$(C$, L, LEN(S$)) <> S$ THEN [CONJ2] C$ = MID$(C$, 1, K - 1) + R$ + MID$(C$, L + LEN(S$), LEN(C$) - (L + LEN(S$) - 1)) [CONJ2]   IF L + LEN(R$) > LEN(C$) THEN [CONJ3] IF MID$(C$, L, LEN(R$)) <> R$ THEN [CONJ3] C$ = MID$(C$, 1, K - 1) + S$ + MID$(C$, L + LEN(R$), LEN(C$) - (L + LEN(R$) - 1)) L = L + LEN(S$)[CONJ3]   NEXT L    NEXT X    IF MID$(C$, 2, 1) = " " THEN C$ = MID$(C$, 2, LEN(C$) - 1) ' NOW USING THE KEYWORD NUMBER (K) GET REPLY[GET.REPLY]   RESTORE FOR X = 1 TO N1 + N2       READ Z$    NEXT X    FOR X = 1 TO R(K) ' READ RIGHT REPLY        READ F$    NEXT X    R(K) = R(K) + 1    IF R(K) > N(K) THEN R(K) = S(K) IF MID$(F$,LEN(F$),1) = "*" THEN       PRINT MID$(F$,1,LEN(F$) - 1); C$        P$ = I$        GOTO [USER.INPUT]    END IF    PRINT F$    P$=I$ GOTO [USER.INPUT][START]   CALL CENTERTEXT "*** ELIZA ***" CALL CENTERTEXT "IN BASIC" CALL CENTERTEXT "MODIFIED FROM CYBER 175 AT UNIVERSITY OF ILLINOIS AT CHAMPAGNE" CALL CENTERTEXT "JANUARY 1985"   CALL CENTERTEXT "HAVE ANY PROBLEMS ?" CALL CENTERTEXT "LET ELIZA HELP YOU !" PRINT "" CALL CENTERTEXT "TO STOP ELIZA TYPE 'SHUT UP'" CALL CENTERTEXT "THIS VERSION WILL NOT RECORD YOUR CONVERSATIONS" CALL CENTERTEXT "PLEASE SEND SUGGESTIONS FOR IMPROVEMENTS TO JOHN SCHUGG" PRINT "" CALL CENTERTEXT "MODIFIED FOR LIBERTY/RUN/JUST BASIC BY NOBLE D. BELL" CALL CENTERTEXT "HTTP://WWW.NOBLEBELL.COM"   PRINT "" CALL CENTERTEXT "< PRESS RETURN TO CONTINUE...>"   RETURN[DATA1] ' KEYWORDS   DATA "CAN YOU","CAN I","YOU ARE","YOURE","I DONT","I FEEL" DATA "WHY DONT YOU","WHY CANT I","ARE YOU","I CANT","I AM", "IM " DATA "YOU ","I WANT","WHAT","HOW","WHO","WHERE","WHEN","WHY" DATA "NAME","CAUSE","SORRY","DREAM","HELLO","HI ","MAYBE" DATA " NO","YOUR","ALWAYS","THINK","ALIKE","YES","FRIEND" DATA "COMPUTER","CAR","NOKEYFOUND"   ' STRING DATA FOR CONJUGATIONS DATA " ARE "," AM ","WERE ","WAS "," YOU "," I ","YOUR ","MY " DATA " IVE "," YOUVE "," IM "," YOURE "," YOU "," ME "   ' REPLIES DATA "DON'T YOU BELIEVE THAT I CAN*" DATA "PERHAPS YOU WOULD LIKE TO BE ABLE TO*" DATA "YOU WANT ME TO BE ABLE TO*"   DATA "PERHAPS YOU DON'T WANT ME TO*" DATA "DO YOU WANT ME TO BE ABLE TO*"   DATA "WHAT MAKES YOU THINK I AM*" DATA "DOES IT PLEASE YOU TO BELIEVE I AM*" DATA "PERHAPS YOU WOULD LIKE TO BE*" DATA "DO YOU SOMETIMES WISH YOU WERE*"   DATA "DON'T YOU REALLY*" DATA "WHY DON'T YOU*"   DATA "DO YOU WISH TO BE ABLE TO*" DATA "DOES THAT TROUBLE YOU?" DATA "TELL ME MORE ABOUT SUCH FEELINGS." DATA "DO YOU OFTEN FEEL*"   DATA "DO YOU ENJOY FEELING*" DATA "DO YOU REALLY BELIEVE I DON'T*"   DATA "PERHAPS IN GOOD TIME I WILL*" DATA "DO YOU WANT ME TO*"   DATA "DO YOU THINK YOU SHOULD BE ABLE TO*" DATA "WHY CAN'T YOU*" DATA "WHY ARE YOU INTERESTED IN WHETHER OR NOT I AM*" DATA "WOULD YOU PREFER IF I WERE NOT*" DATA "PERHAPS IN YOUR FANTASIES I AM*"   DATA "HOW DO YOU KNOW YOU CAN'T*" DATA "HAVE YOU TRIED?" DATA "PERHAPS YOU CAN NOW*" DATA "DID YOU COME TO ME BECAUSE YOU ARE*"   DATA "HOW LONG HAVE YOU BEEN*" DATA "DO YOU BELIEVE IT IS NORMAL TO BE*"   DATA "DO YOU ENJOY BEING*" DATA "WE ARE DISCUSSING YOU-- NOT ME." DATA "OH, I*" DATA "YOU'RE NOT REALLY TALKING ABOUT ME, ARE YOU?" DATA "WHAT WOULD IT MEAN TO YOU IF YOU GOT*"   DATA "WHY DO YOU WANT*" DATA "SUPPOSE YOU SOON GOT*"   DATA "WHAT IF YOU NEVER GOT*" DATA "I SOMETIMES ALSO WANT*"   DATA "WHY DO YOU ASK?" DATA "DOES THAT QUESTION INTEREST YOU?" DATA "WHAT ANSWER WOULD PLEASE YOU THE MOST?" DATA "WHAT DO YOU THINK?" DATA "ARE SUCH QUESTIONS ON YOUR MIND OFTEN?" DATA "WHAT IS IT THAT YOU REALLY WANT TO KNOW?" DATA "HAVE YOU ASKED ANYONE ELSE?" DATA "HAVE YOU ASKED SUCH QUESTIONS BEFORE?" DATA "WHAT ELSE COMES TO MIND WHEN YOU ASK THAT?" DATA "NAMES DON'T INTEREST ME." DATA "I DON'T CARE ABOUT NAMES-- PLESE GO ON." DATA "IS THAT THE REAL REASON?" DATA "DON'T ANY OTHER REASONS COME TO MIND?" DATA "DOES THAT REASON EXPLAIN ANYTHING ELSE?" DATA "WHAT OTHER REASONS MIGHT THERE BE?" DATA "PLEASE DON'T APOLOGIZE." DATA "APOLOGIES ARE NOT NECESSARY." DATA "WHAT FEELINGS DO YOU HAVE WHEN YOU APOLOGIZE?" DATA "DON'T BE SO DEFENSIVE!" DATA "WHAT DOES THAT DREAM SUGGEST TO YOU?" DATA "DO YOU DREAM OFTEN?" DATA "WHAT PERSONS APPEAR IN YOUR DREAMS?" DATA "ARE YOU DISTURBED BY YOUR DREAMS?" DATA "HOW DO YOU DO--PLEASE STATE YOUR PROBLEM." DATA "YOU DON'T SEEM QUITE CERTAIN." DATA "WHY THE UNCERTAIN TONE?" DATA "CAN'T YOU BE MORE POSITIVE?" DATA "YOU AREN'T SURE?" DATA "DON'T YOU KNOW?" DATA "ARE YOU SAYING NO JUST TO BE NEGATIVE?" DATA "YOU ARE BEING A BIT NEGATIVE." DATA "WHY NOT?" DATA "ARE YOU SURE?" DATA "WHY NO?" DATA "WHY ARE YOU CONCERNED ABOUT MY*"   DATA "WHAT ABOUT YOUR OWN*" DATA "CAN YOU THINK OF A SPECIFIC EXAMPLE?" DATA "WHEN?" DATA "WHAT ARE YOU THINKING OF?" DATA "REALLY, ALWAYS?" DATA "DO YOU REALLY THINK SO?" DATA "BUT YOU ARE NOT SURE YOU*" DATA "DO YOU DOUBT YOU*"   DATA "IN WHAT WAY?" DATA "WHAT RESEMBLANCE DO YOU SEE?" DATA "WHAT DOES THE SIMILARITY SUGGEST TO YOU?" DATA "WHAT OTHER CONNECTIONS DO YOU SEE?" DATA "COULD THERE REALLY BE SOME CONNECTION?" DATA "HOW?" DATA "YOU SEEM QUITE POSITIVE." DATA "ARE YOU SURE?" DATA "I SEE." DATA "I UNDERSTAND." DATA "WHY DO YOU BRING UP THE TOPIC OF FRIENDS?" DATA "DO YOUR FRIENDS WORRY YOU?" DATA "DO YOUR FRIENDS PICK ON YOU?" DATA "ARE YOU SURE YOU HAVE ANY FRIENDS?" DATA "DO YOU IMPOSE ON YOUR FRIENDS?" DATA "PERHAPS YOUR LOVE FOR FRIENDS WORRIES YOU?" DATA "DO COMPUTERS WORRY YOU?" DATA "ARE YOU TALKING ABOUT ME IN PARTICULAR?" DATA "ARE YOU FRIGHTENED BY MACHINES?" DATA "WHY DO YOU MENTION COMPUTERS?" DATA "WHAT DO YOU THINK MACHINES HAVE TO DO WITH YOUR PROBLEM?" DATA "DON'T YOU THINK COMPUTERS CAN HELP PEOPLE?" DATA "WHAT IS IT ABOUT MACHINES THAT WORRIES YOU?" DATA "OH, DO YOU LIKE CARS?" DATA "MY FAVORITE CAR IS A LAMBORGINI COUNTACH. WHAT IS YOUR FAVORITE CAR?" DATA "MY FAVORITE CAR COMPANY IS FERRARI. WHAT IS YOURS?" DATA "DO YOU LIKE PORSCHES?" DATA "DO YOU LIKE PORSCHE TURBO CARRERAS?" DATA "SAY, DO YOU HAVE ANY PSYCHOLOGICAL PROBLEMS?" DATA "WHAT DOES THAT SUGGEST TO YOU?" DATA "I SEE." DATA "I'M NOT SURE I UNDERTAND YOU FULLY." DATA "COME COME ELUCIDATE YOUR THOUGHTS." DATA "CAN YOU ELABORATE ON THAT?" DATA "THAT IS QUITE INTERESTING." ' DATA FOR FINDING RIGHT REPLIES DATA 1,3,4,2,6,4,6,4,20,4,14,3,17,3,20,2,22,3,25,3 DATA 28,4,28,4,32,3,35,5,40,9,40,9,40,9,40,9,40,9,40,9 DATA 49,2,51,4,55,4,59,4,63,1,63,1,64,5,69,5,74,2,76,4 DATA 80,3,83,7,90,3,93,6,99,7,106,5,111,6   ENDSUB CENTERTEXT TXT$ PRINT SPACE$(40-LEN(TXT$) / 2); TXT$   PRINT " "END SUB code