home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
8bitfiles.net/archives
/
archives.tar
/
archives
/
commodore-users-of-norman
/
CUON_02_(08-1984).d64
/
eliza.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2019-04-13
|
6KB
|
193 lines
1 REM *** ELIZA
2 REM SUBMITTED BY DENNIS CUMBERTON
3 REM
4 REM *** PET USER GROUP
5 REM SOFTWARE EXCHANGE
6 REM PO BOX 371
7 REM MONTGOMERYVILLE, PA 18936
8 REM
100 DIMS(36):DIMR(36):DIMN(36)
110 N1=36:N2=12:N3=112
120 FOR X=1 TO N1+N2+N3:READZ$:NEXT X
125 FOR X=1 TO N1
130 READS(X),L:R(X)=S(X):N(X)=S(X)+L-1
135 NEXT X
160 PRINT"[147]":PRINT:PRINT:PRINT"HI! I'M ELIZA. WHAT'S YOUR PROBLEM?"
200 INPUT" >[157][157][157]";I$:I$=" "+I$+" "
220 FOR L=1 TO LEN(I$)
230 IFMID$(I$,L,1)="'"THENI$=LEFT$(I$,L-1)+RIGHT$(I$,LEN(I$)-L):GOTO230
240 IFL+4<=LEN(I$)THENIFMID$(I$,L,4)="SHUT"THENPRINT"SHUT UP INDEED":GOSUB2600:RUN
250 NEXT L
255 IF I$=P$ THEN PRINT"PLEASE DON'T REPEAT YOURSELF!":GOTO200
290 RESTORE
295 S=0
300 FORK=1 TO N1
310 READK$:IF S>0 THEN 360
320 FORL=1TOLEN(I$)-LEN(K$)+1
340 IF MID$(I$,L,LEN(K$))=K$THENS=K:T=L:F$=K$
350 NEXT L
360 NEXT K
365 IF S>0THENK=S:L=T:GOTO420
370 K=36:GOTO590:REM-NO KEYWORD
420 RESTORE:FORX=1TON1:READZ$:NEXT X:REM SKIP OVER KEYWORDS
430 C$=" "+RIGHT$(I$,LEN(I$)-LEN(F$)-L+1)
440 FOR X=1 TO N2/2
450 READS$,R$
460 FORL=1TOLEN(C$)
470 IF L+LEN(S$)>LEN(C$)THEN510
480 IF MID$(C$,L,LEN(S$))<>S$ THEN 510
490 C$=LEFT$(C$,L-1)+R$+RIGHT$(C$,LEN(C$)-L-LEN(S$)+1)
495 L=L+LEN(R$)
500 GOTO540
510 IF L+LEN(R$)>LEN(C$)THEN540
520 IFMID$(C$,L,LEN(R$))<>R$THEN540
530 C$=LEFT$(C$,L-1)+S$+RIGHT$(C$,LEN(C$)-L-LEN(R$)+1)
535 L=L+LEN(S$)
540 NEXT L
550 NEXTX
555 IFMID$(C$,2,1)=" "THENC$=RIGHT$(C$,LEN(C$)-1):REM ONLY ONE SPACE
590 RESTORE:FOR X=1 TO N1+N2:READ Z$:NEXT X
600 FORX=1TOR(K):READF$:NEXT X:REM READ RIGHT REPLY
610 R(K)=R(K)+1:IFR(K)>N(K) THEN R(K)=S(K)
620 IF RIGHT$(F$,1)<>"*" THEN PRINT F$:P$=I$:GOTO200
630 PRINTLEFT$(F$,LEN(F$)-1);C$
640 P$=I$:GOTO200
1000 REM
1010 REM----PROGRAM DATA FOLLOWS----
1050 DATA"CAN YOU","CAN I","YOU ARE","YOURE","I DONT","I FEEL"
1060 DATA"WHY DONT YOU","WHY CANT I","ARE YOU","I CANT","I AM","IM "
1070 DATA"YOU ","I WANT","WHAT","HOW","WHO","WHERE","WHEN","WHY"
1080 DATA"NAME","CAUSE","SORRY","DREAM","HELLO"," HI ","MAYBE"
1090 DATA" NO ","YOUR ","ALWAYS","THINK","ALIKE","YES","FRIEND"
1100 DATA"COMPUTER","NOKEYFOUND"
1200 REM
1210 REM STRING DATA FOR CONJUGATIONS
1220 REM
1230 DATA" ARE "," AM ","WERE ","WAS "," YOU "," I "," MY "," YOUR "
1235 DATA" IVE "," YOUVE "," IM "," YOURE "
1300 REM
1310 REM REPLIES
1320 REM
1330 DATA"DON'T YOU BELIEVE THAT I CAN*"
1340 DATA"PERHAPS YOU WOULD LIKE TO BE ABLE TO*"
1350 DATA"YOU WANT ME TO BE ABLE TO*"
1360 DATA"PERHAPS YOU DON'T WANT TO*"
1365 DATA"DO YOU WANT TO BE ABLE TO*"
1370 DATA"WHAT MAKES YOU THINK I AM*"
1380 DATA"DOES IT PLEASE YOU TO BELIEVE I AM*"
1390 DATA"PERHAPS YOU WOULD LIKE TO BE*"
1400 DATA"DO YOU SOMETIMES WISH YOU WERE*"
1410 DATA"DON'T YOU REALLY*"
1420 DATA"WHY DON'T YOU*"
1430 DATA"DO YOU WISH TO BE ABLE TO*"
1440 DATA"DOES THAT TROUBLE YOU*"
1450 DATA"TELL ME MORE ABOUT SUCH FEELINGS*"
1460 DATA"DO YOU OFTEN FEEL*"
1470 DATA"DO YOU ENJOY FEELING*"
1480 DATA"DO YOU REALLY BELIEVE I DON'T*"
1490 DATA"PERHAPS IN GOOD TIME I WILL*"
1500 DATA"DO YOU WANT ME TO*"
1510 DATA"DO YOU THINK YOU SHOULD BE ABLE TO*"
1520 DATA"WHY CAN'T YOU*"
1530 DATA"WHY ARE YOU INTERESTED IN WHETHER OR NOT I AM*"
1540 DATA"WOULD YOU PREFER IF I WERE NOT*"
1550 DATA"PERHAPS IN YOUR FANTASIES I AM*"
1560 DATA"HOW DO YOU KNOW YOU CAN'T*"
1570 DATA"HAVE YOU TRIED?"
1580 DATA"PERHAPS YOU CAN NOW*"
1590 DATA"DID YOU COME TO ME BECAUSE YOU ARE*"
1600 DATA"HOW LONG HAVE YOU BEEN*"
1610 DATA"DO YOU BELIEVE IT IS NORMAL TO BE*"
1620 DATA"DO YOU ENJOY BEING*"
1630 DATA"WE WERE DISCUSSING YOU-- NOT ME."
1640 DATA"OH, I*"
1650 DATA"YOURE NOT REALLY TALKING ABOUT ME, ARE YOU?"
1660 DATA"WHAT WOULD IT MEAN TO YOU IF YOU GOT*"
1670 DATA"WHY DO YOU WANT*"
1680 DATA"SUPPOSE YOU SOON GOT*"
1690 DATA"WHAT IF YOU NEVER GOT*"
1700 DATA"I SOMETIMES ALSO WANT*"
1710 DATA"WHY DO YOU ASK?"
1720 DATA"DOES THAT QUESTION INTEREST YOU?"
1730 DATA"WHAT ANSWER WOULD PLEASE YOU THE MOST?"
1740 DATA"WHAT DO YOU THINK?"
1750 DATA"ARE SUCH QUESTIONS ON YOUR MIND OFTEN?"
1760 DATA"WHAT IS IT THAT YOU REALLY WANT TO KNOW
1770 [131]"HAVE YOU ASKED ANYONE ELSE?"
1780 [131]"HAVE YOU ASKED SUCH QUESTIONS BEFORE?"
1790 [131]"WHAT ELSE COMES TO MIND WHEN YOU ASK THAT?"
1800 [131]"NAMES DON'T INTEREST ME."
1810 [131]"I DON'T CARE ABOUT NAMES-- PLEASE GO ON."
1820 [131]"IS THAT THE REAL REASON?"
1830 [131]"DON'T ANY OTHER REASONS COME TO MIND?"
1840 [131]"DOES THAT REASON EXPLAIN ANYTHING ELSE?"
1850 [131]"WHAT OTHER REASONS MIGHT THERE BE?"
1860 [131]"PLEASE DON'T APOLOGISE!"
1870 [131]"APOLOGIES ARE NOT NECESSARY."
1880 [131]"WHAT FEELINGS DO YOU HAVE WHEN YOU APOLOGISE?"
1890 [131]"DON'T BE SO DEFENSIVE!"
1900 [131]"WHAT DOES THAT DREAM SUGGEST TO YOU?"
1910 [131]"DO YOU DREAMOFTEN?"
1920 [131]"WHAT PERSONS APPEAR IN YOUR DREAMS?"
1930 [131]"ARE YOU DISTURBED BY YOUR DREAMS?"
1940 [131]"HOW DO YOU DO..PLEASE STATE YOUR PROBLEM"
1950 [131]"YOU DON'T SEEM QUITE CERTAIN."
1960 [131]"WHY THE UNCERTAIN TONE?"
1970 [131]"CAN'T YOU BE MORE POSITIVE?"
1980 [131]"YOU AREN'T SURE?"
1990 [131]"DON'T YOU KNOW?"
2000 [131]"ARE YOU SAYING NO JUST TO BE NEGATIVE?"
2010 [131]"YOU ARE BEING A BIT NEGATIVE."
2020 [131]"WHY NOT?"
2030 [131]"ARE YOU SURE?"
2040 [131]"WHY NO?"
2050 [131]"WHY ARE YOU CONCERNED ABOUT MY*"
2060 [131]"WHAT ABOUT YOUR OWN*"
2070 [131]"CAN YOU THINK OF A SPECIFIC EXAMPLE?"
2080 [131]"WHEN?"
2090 [131]"WHAT ARE YOU THINKING OF?"
2100 [131]"REALLY, ALWAYS?"
2110 [131]"DO YOU REALLY THINK SO?"
2120 [131]"BUT YOU ARE NOT SURE *"
2130 [131]"DO YOU DOUBT YOU*"
2140 [131]"IN WHAT WAY?"
2150 [131]"WHAT RESEMBLANCE DO YOU SEE?"
2160 [131]"WHAT DOES THE SIMILARITY SUGGEST TO YOU?"
2170 [131]"WHAT OTHER CONNECTIONS DO YOU SEE?"
2180 [131]"COULD THERE REALLY BE SOME CONNECTION?"
2190 [131]"HOW?"
2200 [131]"YOU SEEM QUITE POSITIVE."
2210 [131]"ARE YOU SURE?"
2220 [131]"I SEE."
2230 [131]"I UNDERSTAND."
2240 [131]"WHY DO YOU BRING UP THE TOPIC OF FRIENDS?"
2250 [131]"DO YOUR FRIENDS WORRY YOU?"
2260 [131]"DO YOUR FRIENDS PICK ON YOU?"
2270 [131]"ARE YOU SURE YOU HAVE ANY FRIENDS?"
2280 [131]"DO YOU IMPOSE ON YOUR FRIENDS?"
2290 [131]"PERHAPS YOUR LOVE FOR FRIENDS WORRIES YOU."
2300 [131]"DO COMPUTERS WORRY YOU?"
2310 [131]"ARE YOU TALKING ABOUT ME IN PARTICULAR?"
2320 [131]"ARE YOU FRIGHTENED BY MACHINES?"
2330 [131]"WHY DO YOU MENTION COMPUTERS?"
2340 [131]"WHAT DO YOU THINK MACHINES HAVE TO DO WITH YOUR PROBLEMS?"
2350 [131]"DON'T YOU THINK COMPUTERS CAN HELP PEOPLE?"
2360 [131]"WHAT IS IT ABOUT MACHINES THAT WORRIES YOU?"
2370 [131]"SAY,DO YOU HAVE ANY PSYCHOLOGICAL PROBLEMS?"
2380 [131]"WHAT DOES THAT SUGGEST TO YOU?"
2390 [131]"I SEE."
2400 [131]"I'M NOT SURE I UNDERSTAND YOU FULLY."
2410 [131]"COME COME, ELUCIDATE!"
2420 [131]"CAN YOU ELABORATE ON THAT?"
2430 [131]"THAT IS QUITE INTERESTING."
2500 [143]
2510 [143] DATA FOR FINDING RIGHT REPLIES
2520 [143]
2530 [131] 1,3,4,2,6,4,6,4,10,4,14,3,17,3,20,2,22,3,25,3
2540 [131] 28,4,28,4,32,3,35,5,40,9,40,9,40,9,40,9,40,9,40,9
2550 [131] 49,2,51,4,55,4,59,4,63,1,63,1,64,5,69,5,74,2,76,4
2560 [131] 80,3,83,7,90,3,93,6,99,7,106,6
2600 [129] Q[178]1[164]2700:[130]
2605 [142]
2700 [143]-BEST 24 JUN,381