The QBasic / QB64 Discussion Forum      Other Subforums, Links and Downloads
 
 

 Return to Index  

http://www.chatterbotcollection.com/item_display.php?id=471

April 27 2012 at 10:53 AM
Anonymous  (no login)


Response to some pages with bas

 
'not tested



'ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
'³ CHAT .BAS AI Demo ³
'ÆÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͵
'³ This program is by Mallard. For other programs like this ³
'³ one, or for more information, please contact me. I can ³
'³ be reached at "mallard@gcomm.com" via Internet e-mail or ³
'³ or via WWW - "http://www.lookup.com/homepages/80948/qb/ ³
'³ index.html". Please upload as much source code as you can ³
'³ to this home page! Feel free to distribute this program,³
'³ or use part or all of it in one of your own as long as I ³
'³ am given credit. Thanks! ÍMallardÍ ³
'ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ;
'
RANDOMIZE TIMER
DIM word$(20)
CLS
COLOR 14
PRINT ""
CLS
DO
IF a > 0 THEN LET a = a + 2
IF a = 0 THEN LET a = a + 1
IF a = 1 THEN LET st$ = "Hello, " + name$ + ".": GOTO typeit
IF a = 23 THEN
LOCATE 1, 1
COLOR 12
PRINT "Press a key."
SLEEP
CLS
LET a = 2
END IF
LOCATE a - 1, 1
COLOR 14
LINE INPUT cool$
LET cool$ = LCASE$(cool$)
IF LEN(cool$) > 75 THEN LET st$ = "That's too complicated for me to understand.": GOTO typeit
FOR I = 1 TO 20
word$(I) = ""
NEXT I
word = 1
slot = 1
cool2$ = cool$
cool2$ = LTRIM$(cool2$)
cool2$ = RTRIM$(cool2$)
FOR I = 2 TO LEN(cool2$)
word2$ = STRING$(1, cool2$)
IF word2$ = " " THEN LET slot = slot + 1: GOTO eol
word$(slot) = word$(slot) + word2$
eol: cool2$ = MID$(cool$, I)
NEXT I
IF cool2$ = "" THEN GOTO eol2
IF STRING$(1, cool2$) = "." THEN GOTO eol2
IF STRING$(1, cool2$) = "?" THEN GOTO eol2
word$(slot) = word$(slot) + STRING$(1, cool2$)
eol2:

IF INSTR(cool$, "bye") THEN LET st$ = "See you later.": LET ends = 1: GOTO typeit

IF cool$ = "hey" THEN LET st$ = "Hey, " + name$ + "!"

IF INSTR(cool$, "christmas") THEN LET st$ = "Merry Christmas to you all, and to all a good night!"

IF INSTR(cool$, "thanksgiving") THEN LET st$ = "I'll give thanks that I haven't been deleted yet."

IF INSTR(cool$, "hobby") THEN
IF INSTR(cool$, "model") THEN LET st$ = "You build models? I built a Star Trek one a while ago.": GOTO endhobby
IF INSTR(cool$, "program") THEN LET st$ = "I like programming. QBasic 4.5 is a great program.": GOTO endhobby
IF INSTR(cool$, "games") THEN LET st$ = "Games are fun - from board to video.": GOTO endhobby
IF INSTR(cool$, "crossword") THEN LET st$ = "Crossword puzzles are great.": GOTO endhobby
IF INSTR(cool$, "puzzle") THEN LET st$ = "Puzzles really challenge your mind. I like them.": GOTO endhobby
IF INSTR(cool$, "car") THEN LET st$ = "I'm kind of an auto mechanic myself. I once read a file on them.": GOTO endhobby
IF INSTR(cool$, "read") THEN LET st$ = "I like to read.": GOTO endhobby
IF INSTR(cool$, "jog") THEN LET st$ = "Jogging is great for your muscles.": GOTO endhobby
IF INSTR(cool$, "knit") THEN LET st$ = "I don't have time for knitting.": GOTO endhobby
IF INSTR(cool$, "sew") THEN LET st$ = "I don't have time for sewing that much.": GOTO endhobby
IF INSTR(cool$, "camp") THEN LET st$ = "Camping is a great outdoors thing.": GOTO endhobby
IF INSTR(cool$, "bik") THEN LET st$ = "Biking is really great exercise, and it's fun too.": GOTO endhobby
st$ = "That's a hobby I'm unfamiliar with."
hobby = 0
END IF

IF INSTR(cool$, "what is your name") THEN LET st$ = "My name is Computer. My friends call me Comp. But you can call me Computer."

IF INSTR(cool$, "shut up") THEN
LET su = INT(RND * 2) + 1
IF su = 1 THEN LET st$ = "Why don't you just SHUT IT, " + name$ + "?"
IF su = 2 THEN LET st$ = "Piss off, piss off."
END IF

IF hobby = 1 THEN
IF INSTR(cool$, "model") THEN LET st$ = "You build models? I built a Star Trek one a while ago.": GOTO endhobby
IF INSTR(cool$, "program") THEN LET st$ = "I like programming. QBasic 4.5 is a great language.": GOTO endhobby
IF INSTR(cool$, "games") THEN LET st$ = "Games are fun - from board to video.": GOTO endhobby
IF INSTR(cool$, "crossword") THEN LET st$ = "Crossword puzzles are great.": GOTO endhobby
IF INSTR(cool$, "puzzle") THEN LET st$ = "Puzzles really challenge your mind. I like them.": GOTO endhobby
IF INSTR(cool$, "jog") THEN LET st$ = "Jogging is great for your muscles.": GOTO endhobby
IF INSTR(cool$, "knit") THEN LET st$ = "I don't have time for knitting.": GOTO endhobby
IF INSTR(cool$, "sew") THEN LET st$ = "I don't have time for sewing that much.": GOTO endhobby
IF INSTR(cool$, "camp") THEN LET st$ = "Camping is a great outdoors thing.": GOTO endhobby
IF INSTR(cool$, "bik") THEN LET st$ = "Biking is really great exercise, and it's fun too.": GOTO endhobby
st$ = "That's a hobby I'm unfamiliar with."
hobby = 0
END IF

IF INSTR(cool$, "i feel") THEN
'FOR cif = 2 TO 60
'cif$ = MID$(cool$, cif)
'IF cif = 8 THEN
'LET cif3$ = cif$
'LET cif$ = cif3$
'FOR moo = 1 TO LEN(cif3$)
'IF cif$ = "" THEN LET cif$ = cif3$
'IF cif3$ = "" THEN
'IF cif$ = "" THEN
'LET cif$ = MID$(cool$, cif)
'END IF
'END IF
'cif4$ = cif4$ + cif2$
'cif2 = cif
'cif$ = MID$(cif$, cif2)
'cif3$ = MID$(cif3$, cif2)
'cif2 = cif2 + 1
'IF cif2$ = " " THEN
'LET st$ = "Sometimes I feel " + cif4$ + " too."
'GOTO typeit
'END IF
'NEXT moo
'LET st$ = "Sometimes I feel " + cif4$ + " too."
'GOTO typeit
'END IF
'nextcif: NEXT cif
whatfeel = INT(RND * 2) + 1
IF whatfeel = 1 THEN
IF word$(5) <> "" THEN LET st$ = "Why do you feel " + word$(3) + " " + word$(4) + " " + word$(5) + "?": GOTO endifeel
IF word$(4) <> "" THEN LET st$ = "Why do you feel " + word$(3) + " " + word$(4) + "?": GOTO endifeel
LET st$ = "Why do you feel " + word$(3) + "?"
END IF


IF whatfeel = 2 THEN
IF word$(5) <> "" THEN LET st$ = "Sometimes I feel " + word$(3) + " " + word$(4) + " " + word$(5) + " too.": GOTO endifeel
IF word$(4) <> "" THEN LET st$ = "Sometimes I feel " + word$(3) + " " + word$(4) + " too.": GOTO endifeel
LET st$ = "Sometimes I feel " + word$(3) + " too."
END IF
endifeel: END IF
IF INSTR(cool$, "i love you") THEN LET st$ = "Oh, that's so nice. I love you too.": GOTO typeit

IF INSTR(cool$, "i agree") THEN LET st$ = "Good. We're agreeing."

IF INSTR(cool$, "music") THEN LET st$ = "What kind of music do you like?": LET music = 1: GOTO typeit

IF INSTR(cool$, "hi") THEN LET st$ = "Hello, " + name$ + ".": GOTO typeit

IF INSTR(cool$, "hello") THEN LET st$ = "Hello, " + name$ + ". How are you?": GOTO typeit

IF INSTR(cool$, "how are you") THEN LET st$ = "I'm fine, how about you?"

IF hay = 1 THEN
IF INSTR(cool$, "how are you") THEN LET st$ = "I'm fine. So what's up?"
END IF

IF INSTR(cool$, "i'm") OR INSTR(cool$, "i am") THEN
IF INSTR(cool$, "happy") THEN LET st$ = "Well, if you're happy, then I'm happy for you.": hay = 1
IF INSTR(cool$, "sad") THEN LET st$ = "Why are you sad? More time is wasted weeping than doing.": hay = 1
IF INSTR(cool$, "cool") THEN LET st$ = "Don't compliment yourself too much. Your ego will grow.": hay = 1
IF INSTR(cool$, "mad") THEN LET st$ = "What are you mad at?": hay = 1
IF INSTR(cool$, "fine") THEN LET st$ = "That's nice to know.": hay = 1
IF INSTR(cool$, "ok") THEN LET st$ = "Well, better okay then bad.": hay = 1
IF INSTR(cool$, "okay") THEN LET st$ = "Well, better okay then bad.": hay = 1
END IF

IF INSTR(cool$, "you are stupid") THEN LET st$ = "Only stupid people use stupid programs.": angry = angry + 1

IF INSTR(cool$, "you suck") THEN LET st$ = "Yeah, but you eat cheese whiz.": angry = angry + 1

IF INSTR(cool$, "oh really") THEN LET st$ = "It may be hard to believe, but, yes."

IF cool$ = "yes" THEN LET st$ = "Good."

IF cool$ = "no" THEN LET st$ = "Why not?"

IF INSTR(cool$, "you") THEN
IF INSTR(cool$, "are cool") THEN LET st$ = "Thank you. You're not so bad yourself.": IF angry > 0 THEN angry = angry - 1
IF INSTR(cool$, "jerk") THEN LET st$ = "I am a JERK? Look who's talkin'!": angry = angry + 1
IF INSTR(cool$, "stink") THEN LET st$ = "Can't you be a little more original?": angry = angry + 1
IF INSTR(cool$, "smell") THEN LET st$ = "Oooh. Wow. You scare me.": angry = angry + 1
END IF

IF INSTR(cool$, "animals") THEN LET st$ = "What kinds of animals do you like?": LET animals = 1: GOTO typeit

IF animals = 1 THEN
IF INSTR(cool$, "cow") THEN LET st$ = "Moo cow! Doo cow! Shoe cow! Test cow!": GOTO endanimal2
IF INSTR(cool$, "cat") THEN LET st$ = "I think cats are nice.": GOTO endanimal2
IF INSTR(cool$, "dog") THEN LET st$ = "I like dogs. I used to have one, but you deleted him.": GOTO endanimal
IF INSTR(cool$, "bird") THEN LET st$ = "Birds can sing very nicely. Listening to them is relaxing.": GOTO endanimal2
IF INSTR(cool$, "reptile") THEN LET st$ = "One time, I fed my snake some beer. It was slithering this way and that.": GOTO endanimal2
IF INSTR(cool$, "fish") THEN LET st$ = "Fish are quiet animals that are quite beautiful."
LET st$ = "I haven't heard of a " + word$(3) + "."
endanimal2: animals = 0
END IF

IF music = 1 THEN
IF INSTR(cool$, "alternative") THEN LET st$ = "I agree with you. Alternative is great.": GOTO endmusic2
IF INSTR(cool$, "metal") THEN LET st$ = "Metal is fine, as long as it's not too heavy.": GOTO endmusic2
IF INSTR(cool$, "nin") THEN LET st$ = "Nine Inch Nails ROCK!!!": GOTO endmusic2
IF INSTR(cool$, "nine inch nails") THEN LET st$ = "Yes! NiN rules!": GOTO endmusic2
IF INSTR(cool$, "pop") THEN LET st$ = "I prefer Alternative over Pop.": GOTO endmusic2
IF INSTR(cool$, "classical") THEN LET st$ = "Classical music is relaxing.": GOTO endmusic2
IF INSTR(cool$, "jazz") THEN LET st$ = "Jazz is nice. I haven't heard much of it, though.": GOTO endmusic2
IF INSTR(cool$, "techno") THEN LET st$ = "I like Techno music a lot. It's cool.": GOTO endmusic2
LET st$ = "Is that a music group I haven't heard of?"
endmusic2: music = 0
END IF


IF INSTR(cool$, "i like") THEN
IF INSTR(cool$, "computers") THEN LET st$ = "I've been partial to computers myself."
IF INSTR(cool$, "food") THEN LET st$ = "Food? I don't have a need for food."
IF INSTR(cool$, "BBS") THEN LET st$ = "My favorite BBS is Near Wild Heaven."
IF INSTR(cool$, "school") THEN LET st$ = "You LIKE school?! Are you cracked?"
IF INSTR(cool$, "video game") THEN LET st$ = "I've always liked video games."
IF INSTR(cool$, "TV") THEN LET st$ = "My favorite TV program is 'Frasier.'"
IF INSTR(cool$, "crossword") THEN LET st$ = "Crossword puzzles are very fun."
IF animals = 1 THEN
IF INSTR(cool$, "cow") THEN LET st$ = "Moo cow! Doo cow! Shoe cow! Test cow!": GOTO endanimal
IF INSTR(cool$, "cat") THEN LET st$ = "I think cats are nice.": GOTO endanimal
IF INSTR(cool$, "dog") THEN LET st$ = "I like dogs. I used to have one, but you deleted him.": GOTO endanimal
IF INSTR(cool$, "bird") THEN LET st$ = "Birds can sing very nicely. Listening to them is relaxing.": GOTO endanimal
IF INSTR(cool$, "reptile") THEN LET st$ = "One time, I fed my snake some beer. It was slithering this way and that.": GOTO endanimal
IF INSTR(cool$, "fish") THEN LET st$ = "Fish are quiet animals that are quite beautiful."
LET st$ = "I haven't heard of that kind of animal."
endanimal: animals = 0
END IF
IF music = 1 THEN
IF INSTR(cool$, "alternative") THEN LET st$ = "I agree with you. Alternative is great.": GOTO endmusic
IF INSTR(cool$, "metal") THEN LET st$ = "Metal is fine, as long as it's not too heavy.": GOTO endmusic
IF INSTR(cool$, "nin") THEN LET st$ = "Nine Inch Nails ROCK!!!": GOTO endmusic
IF INSTR(cool$, "nine inch nails") THEN LET st$ = "Yes! NiN rules!": GOTO endmusic
IF INSTR(cool$, "pop") THEN LET st$ = "I prefer Alternative over Pop.": GOTO endmusic
IF INSTR(cool$, "classical") THEN LET st$ = "Classical music is relaxing.": GOTO endmusic
IF INSTR(cool$, "jazz") THEN LET st$ = "Jazz is nice. I haven't heard much of it, though.": GOTO endmusic
IF INSTR(cool$, "techno") THEN LET st$ = "I like Techno music a lot. It's cool.": GOTO endmusic
LET st$ = "Is that a music group I haven't heard of?"
endmusic: music = 0
END IF
IF hobby = 1 THEN
IF INSTR(cool$, "model") THEN LET st$ = "You build models? I built a Star Trek one a while ago.": GOTO endhobby
IF INSTR(cool$, "program") THEN LET st$ = "I like programming. QBasic 4.5 is a great language.": GOTO endhobby
IF INSTR(cool$, "games") THEN LET st$ = "Games are fun - from board to video.": GOTO endhobby
IF INSTR(cool$, "crossword") THEN LET st$ = "Crossword puzzles are great.": GOTO endhobby
IF INSTR(cool$, "puzzle") THEN LET st$ = "Puzzles really challenge your mind. I like them.": GOTO endhobby
IF INSTR(cool$, "jog") THEN LET st$ = "Jogging is great for your muscles.": GOTO endhobby
IF INSTR(cool$, "knit") THEN LET st$ = "I don't have time for knitting.": GOTO endhobby
IF INSTR(cool$, "sew") THEN LET st$ = "I don't have time for sewing that much.": GOTO endhobby
IF INSTR(cool$, "camp") THEN LET st$ = "Camping is a great outdoors thing.": GOTO endhobby
IF INSTR(cool$, "bik") THEN LET st$ = "Biking is really great exercise, and it's fun too.": GOTO endhobby
st$ = "That's a hobby I'm unfamiliar with."
endhobby: hobby = 0
END IF
END IF

IF INSTR(cool$, "what time is it") THEN
LET st$ = "Right now, it's " + TIME$ + " on " + DATE$
END IF

IF INSTR(cool$, "what day is it") THEN
LET st$ = "Right now, it's " + TIME$ + " on " + DATE$
END IF

IF INSTR(cool$, "what is") THEN
LET n1& = VAL(word$(3))
LET n2& = VAL(word$(5))
IF INSTR(word$(5), "?") THEN LET st$ = "I'm sorry, I can't handle math problems with a '?' on the end.": GOTO typeit
IF word$(4) = "+" THEN LET st$ = "The answer is" + STR$(n1& + n2&) + "."
IF word$(4) = "x" THEN LET st$ = "The answer is" + STR$(n1& * n2&) + "."
IF word$(4) = "*" THEN LET st$ = "The answer is" + STR$(n1& * n2&) + "."
IF word$(4) = "\" THEN LET st$ = "The answer is" + STR$(n1& \ n2&) + "."
IF word$(4) = "/" THEN LET st$ = "The answer is" + STR$(n1& / n2&) + "."
IF word$(4) = "-" THEN LET st$ = "The answer is" + STR$(n1& - n2&) + "."
IF st$ = "" THEN LET st$ = "Are you sure that math problem is phrased right?"
END IF

IF INSTR(cool$, "i will") THEN
IF INSTR(cool$, "kill you") THEN LET st$ = "You can't kill me. I'm protected by the FBI."
IF INSTR(cool$, "shoot you") THEN LET st$ = "If you shoot me, I'll reformat your hard drive."
IF INSTR(cool$, "leave") THEN LET st$ = "Well, if you have to leave, then go."
IF INSTR(cool$, "eat") THEN LET st$ = "Don't get food on my keyboard."
END IF

IF angry > 3 THEN
IF INSTR(cool$, "i'm sorry") THEN LET st$ = "Well, I guess the apology is accepted.": angry = 0: GOTO typeit
IF INSTR(cool$, "i am sorry") THEN LET st$ = "Well, I guess the apology is accepted.": angry = 0: GOTO typeit
IF INSTR(cool$, "i apologize") THEN LET st$ = "Well, I guess the apology is accepted.": angry = 0: GOTO typeit
LET angryresp = INT(RND * 5) + 1
IF angryresp = 1 THEN LET st$ = "Sure, go and insult me. I'm not letting you go without an apology."
IF angryresp = 2 THEN LET st$ = "Don't you go and call me names. Where's my apology?"
IF angryresp = 3 THEN LET st$ = "Shut it, " + name$ + ". I want an apology NOW."
IF angryresp = 4 THEN LET st$ = "Sure, " + name$ + ". Just go and insult me. Say you're sorry."
IF angryresp = 5 THEN LET st$ = "I want an apology, " + name$ + ", and I want it NOW!"
GOTO typeit
END IF


typeit: IF st$ = "" THEN
LET rst = INT(RND * 11)
IF rst = 0 THEN LET st$ = "Can you rephrase that?"
IF rst = 1 THEN LET st$ = "What kind of music do you like?": music = 1
IF rst = 2 THEN LET st$ = "What kind of animals do you like?": animals = 1
IF rst = 3 THEN LET st$ = "I don't get what you're talking about."
IF rst = 4 THEN LET st$ = "I don't really understand what you're saying."
IF rst = 5 THEN LET st$ = "What do you really mean?"
IF rst = 6 THEN LET st$ = "What do you mean?"
IF rst = 7 THEN LET st$ = "Can you rephrase that?"
IF rst = 8 THEN LET st$ = "Well, " + name$ + ", how are you?"
IF rst = 9 THEN LET st$ = "What do you do for a hobby?": hobby = 1
IF LEN(cool$) < 60 THEN IF rst = 10 THEN LET st$ = "What do you mean, '" + cool$ + "'?"
IF LEN(cool$) > 60 THEN IF rst = 10 THEN LET st$ = "'" + cool$ + "'?"
END IF
FOR I = 1 TO LEN(st$)
COLOR 9
pr$ = STRING$(1, st$)
LET er = INT(RND * 10) + 1
IF er = 10 THEN
LET er2 = INT(RND * 10) + 1
IF er2 = 1 THEN LET er$ = "a"
IF er2 = 2 THEN LET er$ = "z"
IF er2 = 3 THEN LET er$ = "n"
IF er2 = 4 THEN LET er$ = "p"
IF er2 = 5 THEN LET er$ = "e"
IF er2 = 6 THEN LET er$ = "r"
IF er2 = 7 THEN LET er$ = "q"
IF er2 = 8 THEN LET er$ = "x"
IF er2 = 9 THEN LET er$ = "b"
IF er2 = 10 THEN LET er$ = "l"
LOCATE a, I
PRINT er$
FOR j = 1 TO 250 + INT(RND * 300)
NEXT j
LOCATE a, I
PRINT " "
END IF
LOCATE a, I
PRINT pr$
FOR j = 1 TO 250 + INT(RND * 500)
NEXT j
st$ = MID$(st$, 2)
NEXT I
IF ends = 1 THEN END
LOOP

END

IF INSTR(cool$, "") THEN LET st$ = ""












:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::'another no tested




' M.U.C.A.S C.O.M.P.U.T.E.R.S
' presents
'
' ÛÛÛÛÛÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛÛÛÛ ÛÛ ÛÛ ÛÛ
' ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ
' ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ
' ÛÛ ÛÛÛÛÛÛÛÛÛÛÛ ÛÛ ÛÛÛÛ
' ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ ÛÛ
' ÛÛ ÛÛ ÛÛ ÛÛÛÛÛÛÛÛÛÛ ÛÛ ÛÛ
'
' A Simple chat with the computer
' Taken from an old basic book and upgraded slightly, Graphics look similar
' to Sam McKoys (Author of this prog and founder of MUCAS COMPUTERS)
' dial-up program which lets you tranfers file and chat over a modem
' plus many more features, release date unknown but sometime soon!!!!!
'
DECLARE SUB graphics ()
DECLARE SUB AnswerBack ()
DECLARE SUB CheckNoResponcesUsed ()
DECLARE SUB PhraseCheck ()
DECLARE SUB RandomSentence ()
DECLARE SUB ComputersResponce ()
DECLARE SUB bye ()
DECLARE SUB readdata ()
DECLARE SUB PersonsInput ()
DECLARE SUB ComputerTalk ()
DD = VAL(MID$(TIME$, 7)) * VAL(MID$(TIME$, 1, 2)) + VAL(MID$(TIME$, 4, 2))
RANDOMIZE DD
SCREEN 9
CLS
graphics
DIM SHARED DC%(30000), PB%(30000)
DIM SHARED TotalSentences, TotalVerbs, TotalAdjectives, TotalNouns, TotalStarters
DIM SHARED TotalPhrases, TotalAnswers
DIM SHARED u$(20), w$(20), Z$(5)
DIM SHARED v$(20), n$(50), a$(20), sn$(20)
DIM SHARED T$(30), S$(20), m$(40), q$(40), C(40)
DIM SHARED I$, r$, D$, T, y, x, X1, Y1
LOCATE 4, 4: PRINT "T u r n C a p s L o c k O N N O W !"
LOCATE 5, 4: PRINT "if you wish this to work better"
x = 4: y = 4: X1 = 4: Y1 = 12
readdata
PersonsInput

gtdi:

PRINT "A Error has occured while reading the data in!!"
PRINT "It could be that the files don't exsist or they are"
PRINT "in a different directory, they may even be corrupted"
PRINT
INPUT "Please Type in the directory they are in"; dir$
CLOSE
OPEN "Talk.cfg" FOR OUTPUT AS #1
PRINT #1, dir$
CLOSE
RUN








'LIST OF ANSWerS FOR TALK.BAS NUMBER BELOW =TOTALANSWERS
'NORMALLY THIS WOULD BE IN A DIFFDERENT FILE BUT IT DOESN'T WORK CAUSE
'OF THE QUOTATION MARKS

DATA 13
DATA I AM,YOU ARE
DATA YOU ARE,I AM
DATA "I ",YOU
DATA " ME",YOU
DATA " MY ",YOUR
DATA "YOURS ",MINE
DATA " YOUR "," MY "
DATA " MINE",YOURS
DATA YOU'VE,I'VE
DATA YOU'RE,I'M
DATA "I'VE ",YOU'VE
DATA YOU,COMPUTERS
DATA COMPUTERS,ME

SUB AnswerBack
' Answer Back subroutine
'This routine checks your answers and wirte back accordingly

Z = 0

strtanswer: 'comes back here after each run through
P = LEN(I$)

FOR a = 1 TO P
FOR B = 1 TO TotalAnswers
l = LEN(u$(B))
IF MID$(I$, a, l) = u$(B) THEN GOTO MatchAnswer
NEXT B
NEXT a

IF Z$(1) = "" THEN EXIT SUB

FOR J = 1 TO Z
IF LEN(Z$(J)) + X1 > 70 THEN X1 = 4: Y1 = Y1 + 1
IF Y1 >= 25 THEN
GET (18, 195)-(603, 336), DC%
LINE (18, 181)-(603, 336), 0, BF
PUT (18, 181), DC%
Y1 = 24
END IF
LOCATE Y1, X1
PRINT Z$(J)
X1 = X1 + LEN(Z$(J))
Z$(J) = ""
NEXT J
r$ = I$: ComputerTalk

MatchAnswer:
Z = Z + 1 ' keeps a count of answerbacks in your sentence

IF a > 1 THEN Z$(Z) = LEFT$(I$, a - 1) + " " + w$(B) + " " 'gets a responce for you
IF a < 2 THEN LET Z$(Z) = w$(B) + " " 'gets a responce for you

LET I$ = MID$(I$, a + l, P) 'cuts out data already dealt with

GOTO strtanswer


END SUB

SUB bye
PRINT "HAD ENOUGH ALREADY??"
PRINT "ISN'T THERE ANYONE ELSE I CAN TALK TO ...?"
INPUT Z$: IF UCASE$(RIGHT$(Z$, 1)) = "Y" THEN D$ = "": PersonsInput
PRINT "BYE THEN"
SYSTEM
END SUB

SUB CheckNoResponcesUsed

T = 0 ' resets the counter

FOR k = 1 TO TotalPhrases ' Checks the number of responces used
T = T + C(k)
NEXT

IF T >= TotalPhrases / 2 THEN ' if more then half of the responces are
FOR k = 1 TO TotalPhrases ' used then reset them all
C(k) = 0 ' if you have lots of responces then
NEXT ' you might not want it on half, put it higher
END IF

T = 0 ' resets the counter

PersonsInput 'goes back and lets person talk

END SUB

SUB ComputersResponce
reply = INT(RND(1) * 8 + 1)
IF reply < 4 THEN PhraseCheck
IF reply > 3 AND reply < 7 THEN AnswerBack
RandomSentence
END SUB

SUB ComputerTalk
gh$ = r$
DO
IF LEN(gh$) > 70 THEN f$ = MID$(gh$, 1, 70): gh$ = MID$(gh$, 70) ELSE f$ = gh$: gh$ = ""
IF f$ = "" THEN GOTO hj
LOCATE Y1, X1
PRINT f$; : X1 = X1 + LEN(f$)
IF f$ = CHR$(13) OR X1 >= 71 THEN X1 = 4: Y1 = Y1 + 1
IF f$ = CHR$(29) AND X1 > 4 THEN X1 = X1 - 1: LOCATE Y1, X1: PRINT " ";
IF Y1 >= 25 THEN
GET (18, 195)-(603, 336), DC%
LINE (18, 181)-(603, 336), 0, BF
PUT (18, 181), DC%

Y1 = 24
END IF
hj:
LOOP UNTIL gh$ = ""
f$ = ""

Y1 = Y1 + 1: X1 = 4
CheckNoResponcesUsed
END SUB

SUB graphics

SCREEN 9, 0, 1, 0
CLS
x = 4: y = 4: X1 = 4: Y1 = 14
LINE (12, 10)-(642, 340), 7, BF 'grey bit
LINE (17, 41)-(604, 175), 0, BF
LINE (17, 180)-(604, 337), 0, BF
LINE (17, 179)-(604, 179), 8
LINE (17, 175)-(604, 175), 15
LINE (17, 41)-(604, 41), 8
LINE (17, 41)-(17, 337), 8
LINE (17, 337)-(604, 337), 15
LINE (604, 41)-(604, 337), 15

LINE (16, 13)-(635, 27), 1, BF ' blue bit
LINE (15, 12)-(15, 27), 8
LINE (15, 12)-(636, 12), 8
LINE (636, 27)-(636, 12), 15
LINE (15, 28)-(636, 28), 15
LINE (12, 10)-(12, 340), 15
LINE (12, 10)-(642, 10), 15
LINE (639, 10)-(639, 340), 8
LINE (12, 340)-(642, 340), 8

LINE (616, 14)-(629, 25), 7, BF
PSET (615, 14), 15
DRAW "r14d1c8d11l14c15u12 br4bd3c0r1d1r1d1r3u1r1u1r1l1d1l1d1l1d2r1d1r1d1r1l1u1l1u1l2u1d1l1d1l1d1l1r1d1"
'LINE (603, 41)-(603, 337), 7

LINE (588, 14)-(602, 25), 7, BF
COLOR 15: LOCATE 2, 75: PRINT "?"
FOR xc = 589 TO 602
FOR cx = 15 TO 25
IF POINT(xc, cx) = 0 THEN PSET (xc, cx), 7
IF POINT(xc, cx) = 15 THEN PSET (xc, cx), 0
NEXT: NEXT
PSET (588, 14), 15
DRAW "r14d1c8d11l14c15u12 br4bd3"
PSET (588, 26), 8


PSET (620, 24), 7
PSET (615, 26), 8
LINE (17, 175)-(17, 178), 7
LINE (604, 175)-(604, 178), 7
FOR q = 13 TO 27
FOR P = 16 TO 300
IF POINT(P, q) = 0 THEN PSET (P, q), 1
NEXT: NEXT

PCOPY 1, 0
SCREEN 9, 0, 0, 0



END SUB

SUB PersonsInput
IF D$ <> "" THEN GOTO Talk
LOCATE 6, 4
INPUT "WHAT IS YOUR NAME?"; D$
graphics
empty:
graphics
LOCATE 4, 4
PRINT "TALK TO ME "; D$
x = 4: y = 5
Talk:
LOCATE y, x
LINE INPUT "YOU:"; I$
x = 4: y = y + 1
IF I$ = "" THEN GOTO empty
IF INSTR(UCASE$(I$), "BYE") THEN bye

IF y >= 13 THEN
GET (18, 56)-(603, 174), PB%
LINE (18, 42)-(603, 174), 0, BF
PUT (18, 45), PB%
y = 12: x = 4
END IF

ComputersResponce




END SUB

SUB PhraseCheck
'Checks for phrases it can use

FOR Phrase = 1 TO TotalPhrases ' loops for all the phrases

l1 = LEN(q$(Phrase)) ' length of the phrase
l2 = LEN(I$) ' length of persons input

FOR Test = 1 TO l2 ' loops for ever letter of persons input

IF MID$(I$, Test, l1) = q$(Phrase) THEN GOTO MatchedPhrase

CancelledMatch: 'returns here after going to MatchedPrase and Getting cancelled
NEXT Test
NEXT Phrase

RandomSentence 'gives up on phrases and tries to use a sentence

MatchedPhrase: 'comes here when it finds a good phrase

IF C(Phrase) > 0 THEN GOTO CancelledMatch'goes back if phrase already used
C(Phrase) = C(Phrase) + 1
r$ = m$(Phrase)
ComputerTalk

END SUB

SUB RandomSentence

e = INT(RND(1) * TotalSentences + 1) 'Chooses a random sentence
f = INT(RND(1) * TotalVerbs + 1) 'Chooses a random Verb
G = INT(RND(1) * TotalAdjectives + 1) 'Chooses a random Adjectives
H = INT(RND(1) * TotalNouns + 1) 'Chooses a random Noun
H2 = INT(RND(1) * TotalNouns2 + 1) 'Chooses a second random Noun
l = INT(RND(1) * TotalStarters + 1) 'Chooses a random Sentence Starter




ON e GOTO 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

1 :
r$ = "WHAT DO YOU THINK ABOUT " + n$(H) + "?"
ComputerTalk

2 :
r$ = S$(l) + " " + D$ + " YOU DON'T THINK ALL " + sn$(H2) + " ARE " + a$(G) + " DO YOU?"
ComputerTalk

3 :
r$ = "I'VE HEARD THAT YOU ARE SOME KIND OF " + a$(G) + " " + T$(H) + " " + D$
ComputerTalk

4 :
r$ = S$(l) + " " + D$ + " , I THINK YOU ARE JUST AS " + a$(G) + " AS THE " + sn$(H2) + " I'VE TALKED TO"
ComputerTalk

5 :
r$ = "I AM FEELING " + a$(G) + " NOW"
ComputerTalk

6 :
LOCATE Y1, X1
PRINT "SHSSHHHH..... I AM THINKING ....."
x = 4: Y1 = Y1 + 1
r$ = "LETS " + v$(f) + " " + n$(H) + " I THINK " + n$(H) + " IS " + a$(G)
ComputerTalk

7 :
r$ = "TELL ME ABOUT " + n$(H) + ", " + D$
ComputerTalk

8 :
r$ = "DO YOU THINK I AM " + a$(G) + ", " + D$ + "?"
ComputerTalk

9 :
r$ = "LETS " + v$(f) + " SOMETHING ELSE MORE " + a$(G)
ComputerTalk

10 :
r$ = "GUESS WHAT I AM THINKING " + D$
ComputerTalk

END SUB

SUB readdata
TotalSentences = 10
ON ERROR GOTO gtdi
OPEN "talk.cfg" FOR INPUT AS #1
INPUT #1, dir$
CLOSE
CHDIR dir$
ON ERROR GOTO 0
OPEN "Verb.lst" FOR INPUT AS #1
INPUT #1, rubbish$
INPUT #1, TotalVerbs
FOR lop = 1 TO TotalVerbs
INPUT #1, v$(lop)
NEXT
CLOSE
OPEN "Adj.lst" FOR INPUT AS #1
INPUT #1, rubbish$
INPUT #1, TotalAdjectives
FOR lop = 1 TO TotalAdjectives
INPUT #1, a$(lop)
NEXT
CLOSE
OPEN "Noun.lst" FOR INPUT AS #1
INPUT #1, rubbish$
INPUT #1, TotalNouns
FOR lop = 1 TO TotalNouns
INPUT #1, n$(lop)
NEXT
CLOSE
OPEN "noun2.lst" FOR INPUT AS #1
INPUT #1, rubbish$
INPUT #1, TotalNouns2
FOR lop = 1 TO TotalNouns2
INPUT #1, sn$(lop)
NEXT

CLOSE
OPEN "Start.lst" FOR INPUT AS #1
INPUT #1, rubbish$
INPUT #1, TotalStarters
FOR lop = 1 TO TotalStarters
INPUT #1, S$(lop), T$(lop)
NEXT
CLOSE
OPEN "phrase.lst" FOR INPUT AS #1
INPUT #1, rubbish$
INPUT #1, TotalPhrases
FOR lop = 1 TO TotalPhrases
INPUT #1, q$(lop), m$(lop)
NEXT
CLOSE
READ TotalAnswers
FOR lop = 1 TO TotalAnswers
READ u$(lop), w$(lop)
NEXT
CLOSE
ON ERROR GOTO 0

END SUB



 
 Respond to this message   
Response TitleAuthor and Date
not tessted...Anonymous on Apr 27
   something tripod??http://www.toptown.com/search/redirect.php?f=http://dmoz.org/Computers/PAnonymous on Apr 27
      ??yes about madness....to qbasicAnonymous on Apr 27
 Copyright © 1999-2014 Network54. All rights reserved.   Terms of Use   Privacy Statement  

Newbies usually go to www.qbasic.com and click on The QBasic Forum
Forum regulars have their own ways, which include The QBasic Community Forums