# APPLE II ARTIFICIAL INTELLIGENCE

5 replies [Last post]
Offline
Joined: Nov 21 2010
Posts: 140

By the fruit of programming of me and Mark D. Overholser is born this Artificial intelligence, here the code:

```<br />
5  DIM A\$(8): DIM B(8): DIM C\$(8)<br />
6 N = 1<br />
10 A\$(1) = "HOW ARE YOU":B(1) = 1<br />
15 C\$(1) = "HOW LONG HAVE YOU FELT "<br />
20 A\$(2) = "WHAT IS YOUR NAME":B(2) = 1<br />
25 C\$(2) = "WELL MY NAME IS MELISSA, GLAD TO MEET YOU, "<br />
30 A\$(3) = "HOW OLD ARE YOU":B(3) = 1<br />
35 C\$(3) = "I AM 70 YEARS OLD"<br />
40 A\$(4) = "WHAT IS YOUR JOB":B(4) = 1<br />
45 C\$(4) = "I AM AN HOUSEHOLD."<br />
50 A\$(5) = "WHAT FRIGHTENS YOU ":B(5) = 1<br />
55 C\$(5) = "I AM FRIGHTENED OF CLEANING."<br />
60 A\$(6) = "WHAT IS YOUR BIGGEST SUCCESS":B(6) = 1<br />
65 C\$(6) = "MINE IS HELPING PEOPLE LIKE YOU."<br />
70 A\$(7) = "ARE YOU A MAN OR A WOMAN":B(7) = 1<br />
75 C\$(7) = "I'M AN ARTIFICIAL INTELLIGENCE, CAN BE SOON A ROBOT!"<br />
80 A\$(8) = "DO YOU WANT TO PLAY A GAME WITH ME" : B(8)=1<br />
85 C\$(8) = "OK..  WE CAN PLAY LATER"</p>
<p> 100  FOR I = 1 TO 100<br />
110 J =  INT (8 *  RND (N) + 1)<br />
120  IF B(J) = 1 THEN  GOSUB 200<br />
130  NEXT I<br />
140  END</p>
<p> 200  PRINT A\$(J)<br />
210  INPUT AA\$<br />
220  IF J = 1 THEN ? C\$(J); AA\$ : B(J) = 0 : GOTO 280<br />
230  IF J = 2 THEN ? C\$(J); AA\$ : B(J) = 0 : GOTO 280<br />
260  IF J = 8 AND AA\$ = "YES" THEN GOSUB 500 : GOTO 280<br />
265  IF J = 8 AND AA\$ <> "YES" THEN PRINT C\$(J) : GOTO 280</p>
<p> 270  PRINT C\$(J) : B(J) = 0<br />
280  PRINT<br />
290  RETURN</p>
<p> 500  INPUT "YOUR NUMBER: ";NA<br />
510  NB =  INT (1000 *  RND (1) + 1)<br />
520  HTAB 5: PRINT "YOUR NUMBER IS: ";NA<br />
530  HTAB 5: PRINT "COMPUTER NUMBER IS: ";NB<br />
550  IF NA = NB THEN  PRINT "YOU WIN!!!!!"<br />
560  IF NA <  > NB THEN  PRINT "YOU LOSE"<br />
570  RETURN```

Enjoy!

__________________

"gate gate paragate parasangate bodhi svahdl"
"Stay hungry, Stay Foolish!"
"Think Different"

## Comment viewing options

Offline
Joined: Nov 16 2011
Posts: 2377
Re: APPLE II ARTIFICIAL INTELLIGENCE

Hello Toolkitman,
nice work typing... but Eliza is quite common known code published in the mid 80's in several magazins.....
and it's just pretending AI but isn't really related to that topic...

If you like to talk about artificial intelligence then the talk should be related to
programming either LISP used with CPM at the Apple II series
or to
PROLOG.....

sincerely
speedyG

__________________

In early days I had a lot of money but no time - now I have no money but a lot of time....
the second part includes less friends but a lot more joy on life....

Offline
Joined: Nov 21 2010
Posts: 140
Re: APPLE II ARTIFICIAL INTELLIGENCE

Speedy G this is not Eliza!!!! Mark has called it so but it's a new Artificial intelligence studied by me, where you have a random of strings the possibility are endless.

__________________

"gate gate paragate parasangate bodhi svahdl"
"Stay hungry, Stay Foolish!"
"Think Different"

Offline
Joined: Nov 16 2011
Posts: 2377
Re: APPLE II ARTIFICIAL INTELLIGENCE

Hello Toolkitman,

in fact it's not completly Eliza.....
it's just a shortened "copycat" ....

here is a complete listing of the original modified for the Apple III :

5 HOME
10 HOME
12 PRINT CHR\$(16);CHR\$(1);
14 PRINT CHR\$(19);CHR\$(0);CHR\$(20);CHR\$(15):HOME
20 PRINT:PRINT:PRINT "****************************************"
30 PRINT TAB(12)"* *"
36 PRINT TAB(12)"* Based on the Program ELIZA *"
37 PRINT TAB(12)"* *"
38 PRINT TAB(12)"****************************************"
40 PRINT "****************************************"
45 ON KBD GOTO 60
50 DIM S(54),R(54),N(54)
60 N1=54:N2=16:N3=175
65 IF KBD =13 THEN HOME:END
70 FOR X=1 TO N1+N2+N3:READ Z\$:NEXT X:REM SAME AS RESTORE
80 FOR X=1 TO N1
100 NEXT X
110 PRINT "MY, YOU'RE LOOKING WELL TODAY."
120 PRINT "WHAT'S NEW?"
130 REM
140 PRINT:INPUT I\$:PRINT
150 I\$=" "+I\$+" "
160 NOTRACE
170 FOR L=1 TO LEN(I\$)
180 IF MID\$(I\$,L,1)="'"THEN I\$= LEFT\$(I\$,L-1)+RIGHT\$(I\$,LEN(I\$)-L):GOTO 180
190 IF L+4< LEN(I\$)THEN IF MID\$(I\$,L,4)="SHUT"THEN PRINT "SHUT
UP...":TEXT:HOME:END
200 NEXT L
210 IF I\$=P\$ THEN PRINT "PLEASE DON'T REPEAT YOURSELF!":GOTO 130
220 RESTORE
230 S=0
240 FOR K=1 TO N1
260 IF S>0 THEN 300
270 FOR L=1 TO LEN(I\$)-LEN(K\$)+1
280 IF MID\$(I\$,L,LEN(K\$))=K\$THEN S=K:T=L:F\$=K\$
290 NEXT L
300 NEXT K
310 IF S>0 THEN K=S:L=T:GOTO 330
320 K=54:GOTO 540
330 REM
340 RESTORE:FOR X=1 TO N1:READ Z\$:NEXT X
350 C\$=" "+RIGHT\$(I\$,LEN(I\$)-LEN(F\$)-L+1)+" "
360 FOR X=1 TO N2/2
380 FOR L=1 TO LEN(C\$)
390 IF L+ LEN(S\$)>LEN(C\$)THEN 440
400 IF MID\$(C\$,L,LEN(S\$))<>S\$THEN 440
410 C\$=LEFT\$(C\$,L-1)+R\$+RIGHT\$(C\$,LEN(C\$)-L-LEN(S\$)+1)
420 L=L+LEN(R\$)
430 GOTO 480
440 IF L+ LEN(R\$)>LEN(C\$)THEN 480
450 IF MID\$(C\$,L,LEN(R\$))<>R\$THEN 480
460 C\$=LEFT\$(C\$,L-1)+S\$+RIGHT\$(C\$,LEN(C\$)-L-LEN(R\$)+1)
470 L=L+LEN(S\$)
480 NEXT L
490 NEXT X
500 IF MID\$(C\$,2,1)=" "THEN C\$= RIGHT\$(C\$,LEN(C\$)-1)
510 FOR L=1 TO LEN(C\$)
520 IF MID\$(C\$,L,1)="!"THEN C\$= LEFT\$(C\$,L-1)+RIGHT\$(C\$,LEN(C\$)-L):GOTO 520
530 NEXT L
540 REM NOW USING THE KEYWORD NUMBER (K) GET REPLY
550 RESTORE:FOR X=1 TO N1+N2:READ Z\$:NEXT X
560 FOR X=1 TO R(K):READ F\$:NEXT X
570 R(K)=R(K)+1:IF R(K)>N(K) THEN R(K)=S(K)
580 IF RIGHT\$(F\$,1)<>"*"THEN PRINT F\$:P\$=I\$:GOTO 130
590 PRINT LEFT\$(F\$,LEN(F\$)-1);C\$
600 P\$=I\$:GOTO 130
610 DATA "I WANT","I NEED","I AM","IM ","I FEEL","I CANT","WHY DONT
YOU","WHY CANT I"
620 DATA "WHAT","HOW","WHO","WHERE","WHEN","WHY","CAN YOU","CAN I"
630 DATA "I DONT","YOU ARE","YOURE","YOUR","I
640 DATA "DEPRESSED","FRIEND","LOVE","WOMAN","WOMEN","MAN","MEN","FATHER"
650 DATA
"MOTHER","SEX","LIFE","WORK","AFRAID","WORRY","PARANOID","ENEMY","ENEMIES"
660 DATA "DEATH","UNDERSTAND","FAT","SICK","COMPUTER","MONEY"
670 DATA "TALK","OLD","HATE","LIVE","YES"," NO","NOKEYFOUND"
680 REM
690 REM
700 REM
710 DATA " ARE "," AM ","WERE ","WAS "," YOU "," I ","YOUR ","MY "
720 DATA " IVE "," YOUVE "," IM "," YOUR "
730 DATA " ME"," YOU"," ME "," !YOU"
740 DATA "ARE YOU SURE YOU REALLY WANT*"
750 DATA "WOULD IT CHANGE THINGS IF YOU GOT*"
760 DATA "WHY DO YOU WANT*"
770 DATA "YOU CAN'T ALWAYS GET WHAT YOU WANT."
780 DATA "I'M NOT SURE YOU REALLY NEED*"
790 DATA "WHY DO YOU NEED*"
800 DATA "WHAT WOULD HAPPEN IF YOU GOT*"
810 DATA "IS IT REALLY NECESSARY THAT YOU HAVE*"
820 DATA "I CAN SEE THAT YOU ARE*"
830 DATA "HOW LONG HAVE YOU BEEN*"
840 DATA "IS IT GOOD THAT YOU ARE*"
850 DATA "DOES ANYONE ELSE KNOW THAT YOU ARE*"
860 DATA "YOU HAVE EVERY RIGHT TO FEEL*"
870 DATA "I CAN SEE THAT YOU FEEL*"
880 DATA "IS IT A GOOD FEELING?"
890 DATA "HOW LONG HAVE YOU FELT*"
900 DATA "HOW DO YOU KNOW YOU CAN'T*"
910 DATA "WHAT WOULD YOU DO IF YOU COULD*"
920 DATA "MANY PEOPLE CAN'T*"
930 DATA "I CAN'T EITHER."
940 DATA "DO YOU REALLY THINK I SHOULD*"
950 DATA "DO YOU WANT ME TO*"
960 DATA "I MAY JUST DO THAT."
970 DATA "MAYBE IT WOULD HELP IF WE BOTH*"
980 DATA "WHAT MAKES YOU THINK YOU CAN'T*"
990 DATA "WOULD YOU BE HAPPY IF YOU COULD*"
1000 DATA "MANY PEOPLE CAN'T*"
1010 DATA "PERHAPS YOU WILL SOON BE ABLE TO*"
1020 DATA "WHAT DO YOU THINK?"
1030 DATA "I DON'T UNDERSTAND YOUR QUESTION."
1040 DATA "YOU SEEM UNSURE ABOUT THINGS."
1050 DATA "DO YOU REALLY THINK I CAN ANSWER THAT?"
1060 DATA "I'M AFRAID I DON'T KNOW."
1070 DATA "IF I KNEW THAT I WOULD RULE THE WORLD."
1080 DATA "DO YOU THINK I CAN*"
1090 DATA "I DOUBT THAT I CAN*"
1100 DATA "WOULD YOU LIKE ME TO BE ABLE TO*"
1110 DATA "I WILL TRY TO*"
1120 DATA "I DON'T REALLY KNOW IF YOU CAN*"
1130 DATA "DO YOU THINK YOU ARE ABLE TO*"
1140 DATA "I DOUBT IF YOU CAN*"
1150 DATA "PERHAPS SOMEDAY YOU CAN*"
1160 DATA "ARE YOU SURE YOU DON'T*"
1170 DATA "WHY DON'T YOU*"
1180 DATA "I THINK YOU DO*"
1190 DATA "I HAVE HEARD RUMORS THAT YOU DO*"
1200 DATA "DOES IT MATTER TO YOU IF I AM*"
1210 DATA "WOULD YOU LIKE TO BE*"
1220 DATA "WHY DO YOU THINK I AM*"
1230 DATA "MANY PEOPLE ARE*"
1240 DATA "LET'S NOT TALK ABOUT MY*"
1250 DATA "WHY DON'T WE TALK ABOUT YOUR*"
1260 DATA "LET'S CHANGE THE SUBJECT."
1270 DATA "WHY DO YOU THINK*"
1280 DATA "YOU HAVE EVERY RIGHT TO THINK*"
1290 DATA "I DON'T BLAME YOU A BIT."
1300 DATA "I ALSO THINK*"
1310 DATA "IT IS NORMAL TO BE SAD SOMETIMES."
1330 DATA "WHAT WOULD MAKE YOU HAPPY?"
1340 DATA "I WANT TO SEE YOU SMILE."
1350 DATA "WE DON'T APPRECIATE HAPPINESS UNTIL WE ARE SAD."
1360 DATA "YOU ARE GOING THROUGH A DIFFICULT TIME."
1370 DATA "WHAT MAKES YOU HAPPY?"
1380 DATA "CAN I HELP?"
1390 DATA "EVERYONE WANTS TO BE HAPPY."
1400 DATA "YOU HAVE EVERY REASON TO FEEL DEPRESSED."
1410 DATA "MAYBE YOU SHOULD THINK ABOUT OTHER THINGS."
1420 DATA "DEPRESSION IS PART OF LIFE."
1430 DATA "HOW LONG HAVE YOU BEEN DEPRESSED?"
1440 DATA "I'M SURE YOU HAVE MANY FRIENDS."
1450 DATA "DO YOU REALLY LIKE YOUR FRIENDS?"
1460 DATA "FRIENDS CAN BE VERY HELPFUL."
1470 DATA "IT SOUNDS LIKE YOUR FRIEND IS TROUBLED."
1480 DATA "WHAT ARE YOU REALLY SAYING ABOUT LOVE?"
1490 DATA "IS LOVE A VERB OR A SUBJECT?"
1500 DATA "ARE YOU REALLY TALKING ABOUT LOVE?"
1510 DATA "HAS SEX REARED ITS UGLY HEAD?"
1520 DATA "CAN YOU SEPARATE LOVE AND SEX?"
1530 DATA "YOU MUST REMEMBER ALL WOMEN ARE NOT ALIKE."
1540 DATA "IS SHE A LIBERATED WOMAN?"
1550 DATA "DO YOU HAVE A PARTICULAR WOMAN IN MIND?"
1560 DATA "WHAT DO YOU THINK IS THE DIFFERENCE BETWEEN THE SEXES?"
1570 DATA "WHAT WOMAN HAS INFLUENCED YOU THE MOST?"
1580 DATA "YOU MUST REMEMBER ALL MEN ARE NOT THE SAME."
1590 DATA "A HARD MAN IS GOOD TO FIND."
1600 DATA "ARE YOU THINKING OF A PARTICULAR MAN?"
1610 DATA "HOW DO YOU FEEL ABOUT MEN?"
1620 DATA "WHAT MAN HAS INFLUENCED YOU THE MOST?"
1650 DATA "YOUR FATHER SOUNDS INTERESTING."
1670 DATA "MOTHERS AFFECT OUR LIVES IN SO MANY WAYS."
1710 DATA "DO YOU THINK SEX HAS TOO MUCH IMPORTANCE?"
1730 DATA "WHAT SEX ARE YOU REFERRING TO?"
1740 DATA "WE COULD TALK ABOUT SEX FOREVER."
1750 DATA "WHAT IS YOUR SEXUAL PREFERENCE?"
1760 DATA "IS YOUR SEX LIFE SATISFACTORY?"
1780 DATA "IS YOUR LIFE TURNING OUT AS YOU EXPECTED?"
1790 DATA "DO YOU CONTROL YOUR OWN LIFE?"
1800 DATA "HOW CAN YOU IMPROVE YOUR LIFE?"
1810 DATA "WHAT WORK WOULD YOU LIKE TO DO?"
1820 DATA "DO YOU THINK WORK SHOULD BE FUN?"
1830 DATA "WHAT WORK DO YOU DO BEST?"
1840 DATA "YOU MUST TRY TO OVERCOME YOUR FEAR."
1850 DATA "MOST FEARS CAN BE CONFRONTED."
1860 DATA "DON'T BE SCARED."
1870 DATA "YOU SHOULD TRY NOT TO WORRY SO MUCH."
1880 DATA "PERHAPS YOU HAVE GOOD REASON TO FEEL PARANOID."
1890 DATA "ARE YOU BEING PERSECUTED?"
1900 DATA "YOU FEEL TRAPPED."
1910 DATA "WHO ARE YOUR ENEMIES?"
1920 DATA "DO YOU HAVE A LOT OF ENEMIES?"
1930 DATA "DO YOU THINK YOU ARE PARANOID?"
1940 DATA "DO YOU THINK YOU CAN LOVE YOUR ENEMIES?"
1950 DATA "PERHAPS YOU SHOULD NOT ASSOCIATED WITH SUCH PEOPLE."
1960 DATA "DOES IT DO ANY GOOD TO THINK ABOUT DEATH?"
1980 DATA "WE ARE ALL IN THE DARK ABOUT DEATH."
1990 DATA "IT DOESN'T DO ANY GOOD TO WORRY ABOUT SUCH THINGS."
2000 DATA "NOBODY UNDERSTANDS SOME THINGS."
2010 DATA "DO YOU THINK IT IS POSSIBLE TO UNDERSTAND?"
2020 DATA "HOW DO YOU FEEL ABOUT FATNESS?"
2030 DATA "IS FATNESS EVIL?"
2040 DATA "CAN YOU DO ANYTHING ABOUT FATNESS?"
2050 DATA "WHAT DO YOU MEAN BY SICK?"
2060 DATA "SICKNESS IS NEVER PLEASANT."
2070 DATA "DON'T YOU LIKE COMPUTERS?"
2080 DATA "COMPUTERS CAN BE HELPFUL."
2090 DATA "DO YOU EVER FEEL LIKE A COMPUTER?"
2100 DATA "IT'S TOO BAD MONEY IS SO IMPORTANT."
2110 DATA "WHAT WOULD YOU DO WITH LOTS OF MONEY?"
2120 DATA "COULD YOU LEND ME \$100?"
2130 DATA "PEOPLE WORRY TOO MUCH ABOUT MONEY."
2140 DATA "DO YOU THINK TALKING HELPS?"
2150 DATA "WHAT DO YOU WANT TO DISCUSS?"
2160 DATA "HOW OLD ARE YOU?"
2170 DATA "DO YOU FEEL OLD?"
2180 DATA "DOESN'T HATRED TAKE TOO MUCH ENERGY?"
2190 DATA "DOES HATRED HELP?"
2210 DATA "WHAT ELSE DO YOU HATE?"
2220 DATA "WHAT WOULD YOUR MOTHER THINK OF THAT?"
2230 DATA "DO YOU LIVE WELL?"
2240 DATA "IS YOUR LIFE RELATIVELY HAPPT?"
2250 DATA "DO YOU LIVE WITH SOMEONE YOU CARE ABOUT?"
2260 DATA "ARE YOU SURE?"
2270 DATA "TELL ME WHY YOU SAY YES?"
2280 DATA "IS THAT REALLY TRUE?"
2290 DATA "YOU SOUND ALMOST TOO POSITIVE."
2300 DATA "WHY NOT?"
2310 DATA "I THOUGHT YOU WOULD SAY YES."
2320 DATA "AREN'T YOU BEING RATHER NEGATIVE?"
2330 DATA "TRY A MORE POSITIVE ATTITUDE."
2340 DATA "I SEE YOU ARE TROUBLED."
2350 DATA "I DON'T THINK I UNDERSTAND."
2360 DATA "TRY TO BE MORE SPECIFIC."
2370 DATA "WHAT DO YOU MEAN?"
2380 DATA "I AM SURPRISED TO HEAR THAT?"
2390 DATA "DOES THAT WORRY YOU?"
2400 DATA "TUT, TUT."
2410 DATA "YOU DON'T SAY!"
2420 DATA "WHAT GIVES YOU THAT IDEA?"
2430 DATA "SO WHAT ELSE IS NEW?"
2440 DATA "DOES THAT SEEM LOGICAL TO YOU?"
2470 DATA "ARE YOU CLOSE TO ANYONE?"
2480 DATA "TELL ME MORE!"
2490 DATA 1,4,5,4,9,4,9,4,13,4,17,4
2500 DATA 21,4,25,4,30,7,30,7,30,7,30,7,30,7,30,7,36,3
2510 DATA 39,4,43,4,47,4,47,4,51,3,54,4,58,4,62,5,62,5,67,4
2520 DATA 71,4,75,5,80,5,80,5,85,5,85,5,90,4
2530 DATA 94,4,98,6,104,4,108,3,111,4,111,4
2540 DATA 115,4,119,4,119,4,123,4,127,2,129,3
2550 DATA 132,2,134,3,137,4,141,2,143,2,145,5
2560 DATA 150,3,153,4,157,4,161,15

small differences:
your program stores the sentences in variables at the beginning
the original stored it's sentences ar the rear end of the program as data statements

the textstring selection in your program is not really a ongoing dialog,
it's just a prelude smalltalk consisting of few programlines preleading
a short computergame "guess higher number"....

the original program creates a complex simulation of a dialog
beginning at line 130 and cycling back at line 600.....
thereby simulating a therapy session....

sincerely
speedyG

__________________

In early days I had a lot of money but no time - now I have no money but a lot of time....
the second part includes less friends but a lot more joy on life....

Offline
Joined: Nov 21 2010
Posts: 140
Re: APPLE II ARTIFICIAL INTELLIGENCE

This doesnt works on the Apple II! is this program for the Apple III Business BASIC? This is a really nice program if only i could test it!!! mine was only an attempt to get artificial intelligence to the Apple II, no claim! I have changed her name to MELISSA so there are no misunderstanding hope this can help!! You can add strings as you want it's completly different from ELIZA the core is a Random strings generator

__________________

"gate gate paragate parasangate bodhi svahdl"
"Stay hungry, Stay Foolish!"
"Think Different"

Offline
Joined: Nov 16 2011
Posts: 2377
Re: APPLE II ARTIFICIAL INTELLIGENCE

Still not "Artificial Intelligence".......

ctiteriaa for AI:

fault tolerance input
self mofifying "learning / correcting" code
"creative" solution strategies....

that turns the point back to posting # 1
LISP and PROLOG coding at CPM...

speedyG

__________________

In early days I had a lot of money but no time - now I have no money but a lot of time....
the second part includes less friends but a lot more joy on life....