Post Reply 
General challenge for site members
06-21-2024, 09:08 PM
Post: #5
RE: General challenge for site members
Hello,

here is a simple version of ELIZA, the artificial psychiatraist, so to say the mother of all natural language communication software. Written for the HP-71B by ChatGPT:

Code:
10 ! Simple ELIZA program for HP-71B
20 DIM A$[100], B$[100]
30 DISP "HELLO. I AM ELIZA. HOW CAN I HELP YOU TODAY?"
40 INPUT A$
50 IF A$ = "" THEN GOTO 40
60 GOSUB 200
70 DISP B$
80 GOTO 40

200 ! Pattern matching subroutine
210 IF INSTR(A$, "HELLO") THEN B$ = "HELLO. HOW ARE YOU FEELING TODAY?": RETURN
220 IF INSTR(A$, "I FEEL") THEN B$ = "WHY DO YOU FEEL"+MID$(A$, INSTR(A$, "I FEEL") + 6): RETURN
230 IF INSTR(A$, "BECAUSE") THEN B$ = "IS THAT THE REAL REASON?": RETURN
240 IF INSTR(A$, "I AM") THEN B$ = "HOW LONG HAVE YOU BEEN"+MID$(A$, INSTR(A$, "I AM") + 4): RETURN
250 IF INSTR(A$, "I THINK") THEN B$ = "WHY DO YOU THINK"+MID$(A$, INSTR(A$, "I THINK") + 7): RETURN
260 IF INSTR(A$, "YES") THEN B$ = "YOU SEEM QUITE CERTAIN.": RETURN
270 IF INSTR(A$, "NO") THEN B$ = "WHY NOT?": RETURN
280 IF INSTR(A$, "YOU") THEN B$ = "WE SHOULD TALK ABOUT YOU, NOT ME.": RETURN
290 IF INSTR(A$, "ALWAYS") THEN B$ = "CAN YOU THINK OF A SPECIFIC EXAMPLE?": RETURN
300 IF INSTR(A$, "NEVER") THEN B$ = "WHY DO YOU THINK THAT IS?": RETURN
310 IF INSTR(A$, "EVERYONE") THEN B$ = "CAN YOU THINK OF ANYONE IN PARTICULAR?": RETURN
320 B$ = "TELL ME MORE ABOUT THAT.": RETURN

Good night
Max
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
General challenge for site members - Namir - 06-21-2024, 03:54 PM
RE: General challenge for site members - Maximilian Hohmann - 06-21-2024 09:08 PM



User(s) browsing this thread: 2 Guest(s)