home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.whtech.com
/
ftp.whtech.com.tar
/
ftp.whtech.com
/
compuserve
/
Basic
/
ELIZA.XB
< prev
next >
Wrap
Text File
|
2006-10-19
|
7KB
|
177 lines
150 CALL CLEAR
160 DIM S(36),R(36),N(36)
170 N1=36 :: N2=14 :: N3=112 :: I1$="abcdefghijklmnopqrstuvwxyz "
180 RESTORE 1690 :: FOR X=1 TO N1 :: READ S(X),L :: R(X)=S(X):: N(X)=S(X)+L-1 ::
NEXT X
190 M$=" Please shift-down to lowercase " :: FOR I=1 TO 32 :: A=ASC(SEG$(M$,I,1)
):: CALL HCHAR(15,I,A):: NEXT I
200 DISPLAY "Hello.":" The Doctor is out today.": :" I'm Eliza his computer.": :
: : :"What's your problem?"
205 PRINT "(Use 'stop' to stop)":
210 PRINT
220 DISPLAY AT(23,1):">" :: ACCEPT AT(23,2)VALIDATE(I1$)SIZE(28)BEEP:I$
225 IF I$="stop" THEN STOP
230 IF I$=P$ THEN DISPLAY :"Try not to repeat yourself." :: GOTO 210
240 RESTORE 420 :: FOR K=1 TO N1 :: READ K$ :: IF POS(I$,K$,1)>0 THEN F$=K$ :: G
OTO 270
250 NEXT K
260 K=36 :: GOTO 340
270 Z=POS(I$,F$,1):: IF LEN(F$)=LEN(I$)THEN PRINT :"Please finish your sentence.
": : : :: GOTO 210
280 C$=SEG$(I$,Z+LEN(F$),LEN(I$)-LEN(F$))
290 P1,P2=1 :: RESTORE 500 :: FOR X=1 TO N2/2 :: READ S$,R$
300 MD=POS(C$,S$,P1):: IF MD=0 THEN SN=POS(C$,R$,P2):: IF SN=0 THEN 330 ELSE 320
310 C$=SEG$(C$,1,MD-1)&R$&SEG$(C$,MD+LEN(S$),LEN(C$)-LEN(S$)):: P1=MD+LEN(R$)::
GOTO 330
320 C$=SEG$(C$,1,SN-1)&S$&SEG$(C$,SN+LEN(R$),LEN(C$)-LEN(R$)):: P2=SN+LEN(S$)
330 NEXT X
340 LN=R(K)*10+540 :: CALL VARI(LN):: READ F$
350 R(K)=R(K)+1 :: IF R(K)>N(K)THEN R(K)=S(K)
360 IF SEG$(F$,LEN(F$)-1,1)="*" THEN DISPLAY :SEG$(F$,1,LEN(F$)-2)&C$&SEG$(F$,LE
N(F$),1): : :: P$=I$ :: GOTO 210
370 DISPLAY :F$: : :: P$=I$ :: GOTO 210
380 REM + program data +
390 REM
400 REM keywords
420 DATA "can you","can i","you are","youre","i dont","i feel"
430 DATA "why dont you","why cant i","are you","i cant","i am","im"
440 DATA "you","i want","what","how","who","where","when","why"
450 DATA "name","cause","sorry","dream","hello","hi","maybe"
460 DATA "no","your","always","think","alike","yes","friend"
470 DATA "computer","nokeyfound"
490 REM data for conjugations
500 DATA " are "," am ","were"," was "," you "," i "," your "," my "
510 DATA " ive "," youve "," im "," youre "
520 DATA " me "," you "
540 REM replies
550 DATA "Don't you believe that I can*?"
560 DATA "Perhaps you would like to be able to*."
570 DATA "You want me to be able to*?"
580 DATA "Perhaps you don't want to*."
590 DATA "Do you want to be able to*?"
600 DATA "What makes you think I am*?"
610 DATA "Does it please you to believe I am*?"
620 DATA "Perhaps you would like to be*."
630 DATA "Do you sometimes wish you were*?"
640 DATA "I think you do*."
650 DATA "Why don't you*?"
660 DATA "Do you wish to be able to*?"
670 DATA "Does that trouble you?"
680 DATA "Tell me more about such feelings."
690 DATA "Do you often feel*?"
700 DATA "Do you enjoy feeling*?"
710 DATA "Do you believe I don't*?"
720 DATA "Perhaps in good time I will*."
730 DATA "Do you want me to*?"
740 DATA "Do you think you should be allowed to*?"
750 DATA "Why can't you*?"
760 DATA "Why are you interested in whether or not I am*?"
770 DATA "Would you prefer if I were not*?"
780 DATA "Perhaps in your fantasies I am*."
790 DATA "How do you know you can't*?"
800 DATA "Have you tried?"
810 DATA "Perhaps you can now*."
820 DATA "Did you come to me because you are*?"
830 DATA "How long have you been*?"
840 DATA "Do you believe it's normal to be*?"
850 DATA "Do you enjoy being*?"
860 DATA "We were discussing you... Not me..."
870 DATA "Hmmm....so I*."
880 DATA "Why???"
890 DATA "Do you think it's normal to want*?"
900 DATA "Why do you want*?"
910 DATA "Suppose you received*?"
920 DATA "What if you never got*?"
930 DATA "I sometimes also want*?"
940 DATA "Why do you ask?"
950 DATA "Does that question interest you?"
960 DATA "You tell me.."
970 DATA "Why do you think?"
980 DATA "Are such questions on your mind often?"
990 DATA "What is it that you really want to know?"
1000 DATA "Have you asked anyone else?"
1010 DATA "Have you asked such questions before?"
1020 DATA "What else comes to your mind when you ask that?"
1030 DATA "Names don't interest me."
1040 DATA "I don't care about names.... Please go on."
1050 DATA "Is that the real reason?"
1060 DATA "Don't any other reasons come to mind?"
1070 DATA "Does that reason explain anything else?"
1080 DATA "What other reasons might there be?"
1090 DATA "Please don't apologize... Go on. "
1100 DATA "Apologies aren't necesssary."
1110 DATA "What feelings do you have when you apologize."
1120 DATA "Don't be so defensive.."
1130 DATA "What does that dream suggest to you?"
1140 DATA "Do you dream often?"
1150 DATA "What persons appear in your dreams?"
1160 DATA "Are you disturbed by your dreams?"
1170 DATA "How do you do. Please state your problem."
1180 DATA "You don't seem quite certain."
1190 DATA "Why the uncertain tone?"
1200 DATA "Can't you be more positive?"
1210 DATA "You aren't sure?"
1220 DATA "Don't you know?"
1230 DATA "Are you saying no just to be negative?"
1240 DATA "That's a very creative answer."
1250 DATA "Why not?"
1260 DATA "Are you sure?"
1270 DATA "Why no? Explain..."
1280 DATA "Why are you concerned about my*?"
1290 DATA "What about your own*?"
1300 DATA "Can you think of a specific example?"
1310 DATA "When?"
1320 DATA "What are you thinking of?"
1330 DATA "Really..always?"
1340 DATA "Do you really think so?"
1350 DATA "But you are not so sure you*?"
1360 DATA "Do you doubt you*?"
1370 DATA "In what way?"
1380 DATA "What resemblance do you see?"
1390 DATA "What does the similarity suggest to you?"
1400 DATA "What other connections do you see?"
1410 DATA "Could there really be some connection?"
1420 DATA "How?"
1430 DATA "You seem quite positive."
1440 DATA "Are you sure?"
1450 DATA "Really...Hmmmm."
1460 DATA "I understand....Go on."
1470 DATA "Why do you mention friends?"
1480 DATA "Do your friends worry you?"
1490 DATA "Do your friends pick on you?"
1500 DATA "Are you sure you have any friends?"
1510 DATA "Do you really like your friends"
1520 DATA "Perhaps your love for your friends worries you?"
1530 DATA "What do you think computers have to do with your mental instability?"
1540 DATA "Are you talking about me in particular?"
1550 DATA "Do I frighten you?"
1560 DATA "Why do you bring up the topic of computers?"
1570 DATA "Do computers pick on you?"
1580 DATA "Don't you think computers can help you?"
1590 DATA "What is it about computers that make you so insecure?"
1600 DATA "I think you need my help."
1610 DATA "What does that suggest to you?"
1620 DATA "I see....Hmmmm."
1630 DATA "What do you mean by that?"
1640 DATA "Please try not to drift so."
1650 DATA "Can you elaborate on that?"
1660 DATA "That is quite interesting."
1670 REM
1680 REM data for finding proper replies
1690 REM
1700 DATA 1,3,4,2,6,4,6,4,10,4,14,3,17,3,20,2,22,3,25,3
1710 REM SPACER
1720 DATA 28,4,28,4,32,3,35,5,40,9,40,9,40,9,40,9,40,9,40,9
1730 REM SPACER
1740 DATA 49,2,51,4,55,4,59,4,63,1,63,1,64,5,69,5,74,2,76,4
1750 REM SPACER
1760 DATA 80,3,83,7,90,3,93,6,99,7,106,7
1765 SUB VARI(LN)
1770 LN$=CHR$(INT(LN/256))&CHR$(LN-256*INT(LN/256))
1780 CALL INIT :: CALL PEEK(-31952,A,B):: L=A*256+B-65534 :: CALL PEEK(L,A,B)::
L=A*256+B-65534
1790 CALL LOAD(L,ASC(SEG$(LN$,1,1))):: CALL LOAD(L+1,ASC(SEG$(LN$,2,1)))
1800 RESTORE 1640 :: SUBEND