home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.tar / ftp.whtech.com / compuserve / Basic / ELIZA.XB < prev    next >
Text File  |  2006-10-19  |  7KB  |  177 lines

  1.  
  2. 150 CALL CLEAR
  3. 160 DIM S(36),R(36),N(36)
  4. 170 N1=36 :: N2=14 :: N3=112 :: I1$="abcdefghijklmnopqrstuvwxyz "
  5. 180 RESTORE 1690 :: FOR X=1 TO N1 :: READ S(X),L :: R(X)=S(X):: N(X)=S(X)+L-1 ::
  6.  NEXT X
  7. 190 M$=" Please shift-down to lowercase " :: FOR I=1 TO 32 :: A=ASC(SEG$(M$,I,1)
  8. ):: CALL HCHAR(15,I,A):: NEXT I
  9. 200 DISPLAY "Hello.":" The Doctor is out today.": :" I'm Eliza his computer.": :
  10.  : : :"What's your problem?"
  11. 205 PRINT "(Use 'stop' to stop)":
  12. 210 PRINT
  13. 220 DISPLAY AT(23,1):">" :: ACCEPT AT(23,2)VALIDATE(I1$)SIZE(28)BEEP:I$
  14. 225 IF I$="stop" THEN STOP
  15. 230 IF I$=P$ THEN DISPLAY :"Try not to repeat yourself." :: GOTO 210
  16. 240 RESTORE 420 :: FOR K=1 TO N1 :: READ K$ :: IF POS(I$,K$,1)>0 THEN F$=K$ :: G
  17. OTO 270
  18. 250 NEXT K
  19. 260 K=36 :: GOTO 340
  20. 270 Z=POS(I$,F$,1):: IF LEN(F$)=LEN(I$)THEN PRINT :"Please finish your sentence.
  21. ": : : :: GOTO 210
  22. 280 C$=SEG$(I$,Z+LEN(F$),LEN(I$)-LEN(F$))
  23. 290 P1,P2=1 :: RESTORE 500 :: FOR X=1 TO N2/2 :: READ S$,R$
  24. 300 MD=POS(C$,S$,P1):: IF MD=0 THEN SN=POS(C$,R$,P2):: IF SN=0 THEN 330 ELSE 320
  25. 310 C$=SEG$(C$,1,MD-1)&R$&SEG$(C$,MD+LEN(S$),LEN(C$)-LEN(S$)):: P1=MD+LEN(R$):: 
  26. GOTO 330
  27. 320 C$=SEG$(C$,1,SN-1)&S$&SEG$(C$,SN+LEN(R$),LEN(C$)-LEN(R$)):: P2=SN+LEN(S$)
  28. 330 NEXT X
  29. 340 LN=R(K)*10+540 :: CALL VARI(LN):: READ F$
  30. 350 R(K)=R(K)+1 :: IF R(K)>N(K)THEN R(K)=S(K)
  31. 360 IF SEG$(F$,LEN(F$)-1,1)="*" THEN DISPLAY :SEG$(F$,1,LEN(F$)-2)&C$&SEG$(F$,LE
  32. N(F$),1): : :: P$=I$ :: GOTO 210
  33. 370 DISPLAY :F$: : :: P$=I$ :: GOTO 210
  34. 380 REM + program data +
  35. 390 REM
  36. 400 REM      keywords
  37. 420 DATA "can you","can i","you are","youre","i dont","i feel"
  38. 430 DATA "why dont you","why cant i","are you","i cant","i am","im"
  39. 440 DATA "you","i want","what","how","who","where","when","why"
  40. 450 DATA "name","cause","sorry","dream","hello","hi","maybe"
  41. 460 DATA "no","your","always","think","alike","yes","friend"
  42. 470 DATA "computer","nokeyfound"
  43. 490 REM      data for                  conjugations
  44. 500 DATA " are "," am ","were"," was "," you "," i "," your "," my "
  45. 510 DATA " ive "," youve "," im "," youre "
  46. 520 DATA " me "," you "
  47. 540 REM       replies
  48. 550 DATA "Don't you believe that I can*?"
  49. 560 DATA "Perhaps you would like to be able to*."
  50. 570 DATA "You want me to be able       to*?"
  51. 580 DATA "Perhaps you don't want to*."
  52. 590 DATA "Do you want to be able to*?"
  53. 600 DATA "What makes you think I am*?"
  54. 610 DATA "Does it please you to believe I am*?"
  55. 620 DATA "Perhaps you would like to be*."
  56. 630 DATA "Do you sometimes wish you    were*?"
  57. 640 DATA "I think you do*."
  58. 650 DATA "Why don't you*?"
  59. 660 DATA "Do you wish to be able to*?"
  60. 670 DATA "Does that trouble you?"
  61. 680 DATA "Tell me more about such      feelings."
  62. 690 DATA "Do you often feel*?"
  63. 700 DATA "Do you enjoy feeling*?"
  64. 710 DATA "Do you believe I don't*?"
  65. 720 DATA "Perhaps in good time I will*."
  66. 730 DATA "Do you want me to*?"
  67. 740 DATA "Do you think you should be   allowed to*?"
  68. 750 DATA "Why can't you*?"
  69. 760 DATA "Why are you interested in   whether or not I am*?"
  70. 770 DATA "Would you prefer if I were   not*?"
  71. 780 DATA "Perhaps in your fantasies I  am*."
  72. 790 DATA "How do you know you can't*?"
  73. 800 DATA "Have you tried?"
  74. 810 DATA "Perhaps you can now*."
  75. 820 DATA "Did you come to me because  you are*?"
  76. 830 DATA "How long have you been*?"
  77. 840 DATA "Do you believe it's normal  to be*?"
  78. 850 DATA "Do you enjoy being*?"
  79. 860 DATA "We were discussing you...    Not me..."
  80. 870 DATA "Hmmm....so I*."
  81. 880 DATA "Why???"
  82. 890 DATA "Do you think it's normal to  want*?"
  83. 900 DATA "Why do you want*?"
  84. 910 DATA "Suppose you received*?"
  85. 920 DATA "What if you never got*?"
  86. 930 DATA "I sometimes also want*?"
  87. 940 DATA "Why do you ask?"
  88. 950 DATA "Does that question interest you?"
  89. 960 DATA "You tell me.."
  90. 970 DATA "Why do you think?"
  91. 980 DATA "Are such questions on your  mind often?"
  92. 990 DATA "What is it that you really  want to know?"
  93. 1000 DATA "Have you asked anyone else?"
  94. 1010 DATA "Have you asked such          questions before?"
  95. 1020 DATA "What else comes to your mind when you ask that?"
  96. 1030 DATA "Names don't interest me."
  97. 1040 DATA "I don't care about names.... Please go on."
  98. 1050 DATA "Is that the real reason?"
  99. 1060 DATA "Don't any other reasons come to mind?"
  100. 1070 DATA "Does that reason explain    anything else?"
  101. 1080 DATA "What other reasons might    there be?"
  102. 1090 DATA "Please don't apologize...    Go on. "
  103. 1100 DATA "Apologies aren't necesssary."
  104. 1110 DATA "What feelings do you have    when you apologize."
  105. 1120 DATA "Don't be so defensive.."
  106. 1130 DATA "What does that dream suggest to you?"
  107. 1140 DATA "Do you dream often?"
  108. 1150 DATA "What persons appear in your dreams?"
  109. 1160 DATA "Are you disturbed by your   dreams?"
  110. 1170 DATA "How do you do.              Please state your problem."
  111. 1180 DATA "You don't seem quite        certain."
  112. 1190 DATA "Why the uncertain tone?"
  113. 1200 DATA "Can't you be more positive?"
  114. 1210 DATA "You aren't sure?"
  115. 1220 DATA "Don't you know?"
  116. 1230 DATA "Are you saying no just to be negative?"
  117. 1240 DATA "That's a very creative       answer."
  118. 1250 DATA "Why not?"
  119. 1260 DATA "Are you sure?"
  120. 1270 DATA "Why no?  Explain..."
  121. 1280 DATA "Why are you concerned about my*?"
  122. 1290 DATA "What about your own*?"
  123. 1300 DATA "Can you think of a specific example?"
  124. 1310 DATA "When?"
  125. 1320 DATA "What are you thinking of?"
  126. 1330 DATA "Really..always?"
  127. 1340 DATA "Do you really think so?"
  128. 1350 DATA "But you are not so sure you*?"
  129. 1360 DATA "Do you doubt you*?"
  130. 1370 DATA "In what way?"
  131. 1380 DATA "What resemblance do you see?"
  132. 1390 DATA "What does the similarity     suggest to you?"
  133. 1400 DATA "What other connections do   you see?"
  134. 1410 DATA "Could there really be some   connection?"
  135. 1420 DATA "How?"
  136. 1430 DATA "You seem quite positive."
  137. 1440 DATA "Are you sure?"
  138. 1450 DATA "Really...Hmmmm."
  139. 1460 DATA "I understand....Go on."
  140. 1470 DATA "Why do you mention friends?"
  141. 1480 DATA "Do your friends worry you?"
  142. 1490 DATA "Do your friends pick on you?"
  143. 1500 DATA "Are you sure you have any    friends?"
  144. 1510 DATA "Do you really like your      friends"
  145. 1520 DATA "Perhaps your love for your   friends worries you?"
  146. 1530 DATA "What do you think computers have to do with your mental instability?"
  147. 1540 DATA "Are you talking about me in  particular?"
  148. 1550 DATA "Do I frighten you?"
  149. 1560 DATA "Why do you bring up the      topic of computers?"
  150. 1570 DATA "Do computers pick on you?"
  151. 1580 DATA "Don't you think computers    can help you?"
  152. 1590 DATA "What is it about computers  that make you so insecure?"
  153. 1600 DATA "I think you need my help."
  154. 1610 DATA "What does that suggest to   you?"
  155. 1620 DATA "I see....Hmmmm."
  156. 1630 DATA "What do you mean by that?"
  157. 1640 DATA "Please try not to drift so."
  158. 1650 DATA "Can you elaborate on that?"
  159. 1660 DATA "That is quite interesting."
  160. 1670 REM
  161. 1680 REM    data for finding             proper replies
  162. 1690 REM
  163. 1700 DATA 1,3,4,2,6,4,6,4,10,4,14,3,17,3,20,2,22,3,25,3
  164. 1710 REM    SPACER
  165. 1720 DATA 28,4,28,4,32,3,35,5,40,9,40,9,40,9,40,9,40,9,40,9
  166. 1730 REM    SPACER
  167. 1740 DATA 49,2,51,4,55,4,59,4,63,1,63,1,64,5,69,5,74,2,76,4
  168. 1750 REM    SPACER
  169. 1760 DATA 80,3,83,7,90,3,93,6,99,7,106,7
  170. 1765 SUB VARI(LN)
  171. 1770 LN$=CHR$(INT(LN/256))&CHR$(LN-256*INT(LN/256))
  172. 1780 CALL INIT :: CALL PEEK(-31952,A,B):: L=A*256+B-65534 :: CALL PEEK(L,A,B):: 
  173. L=A*256+B-65534
  174. 1790 CALL LOAD(L,ASC(SEG$(LN$,1,1))):: CALL LOAD(L+1,ASC(SEG$(LN$,2,1)))
  175. 1800 RESTORE 1640 :: SUBEND
  176.  
  177.