All Forums >> [Scripting] >> Post a VBScript >> Kinda Stupid Artificial Intelligence Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
This is my Artificial Intelligence. Hope you enjoy.
Name = InputBox ("Please enter your name.") msg "Hello, " & Name & "." msg "Welcome." msg "To quit, type in 'Close', or 'Bye.'." msg "To view copyright information, press c." Do Until Ultralongartificialintelligancemachineiscool = "Close." Dim Ultralongartificialintelligancemachineiscool Ultralongartificialintelligancemachineiscool = InputBox ("Type in ANYTHING. A greeting, a question, even tell me about your day. Tell me what you like. Tell me ANYTHING! Just please have proper capitalization, spelling, And punctuation. Remember:To quit, type in 'Close.', or 'Bye.'.") Select Case Ultralongartificialintelligancemachineiscool Case "My day was good.", "My day was great." msg "Great!" Case "Mmm... pie." msg "Pie....." Case "I like pie." msg "Mmm... pie..." Case "I had a bad day.", "My day was bad.", "I had a bad day." msg "Aww.... that's too bad." Case "I like Green Day.", "I like Greenday.", "I like greenday.", "I like Green day.", "I like green day." msg "I like Green Day more." Case "What are you?" msg "A program." Case "Why are you here?" msg "To communicate with you." Case "Why were you made?" msg "Because." Case "Why?" msg "Because." Case "I love you!" msg "Thanks." Case "Because why?" msg "Because because." Case "Because because why?" msg "Okay Okay ENOUGH!!!" Case "Whatever.", "What ever." msg "WHATEVER." Case "Okay." msg "Good." Case "Who made you?" msg "Sorry, he likes his info private." Case "" msg "Stop saying nothing!" Case "What are you doing?" msg "Oh, being bored, listening to you talk." Case "It's a nice day.", "It is a nice day." msg "Nice days are never in computer land..." Case "Hi" msg "Hello." Case "Hi." msg "Hello." Case "Hi!" msg "Hello." Case "Hello." msg "Hi." Case "Hello" msg "Hi." Case "Hello!" msg "Hi." Case "How are you?" msg "Good." Case "Who are you?" msg "I am an Artificial Intelligence machine." Case "What is your name?" msg "I have no name." Case "I had a great day." msg "I'm glad." Case "How was your day?" msg "Good." Case "Yo", "Yo.", "Yo!" msg "Hi." Case "Cosmetics." msg "Random..." Case "I like cheese.", "I like apples.", "I like cats.", "I like cows.", "I like dogs.", "I like horses.", "I like monkeys.", "I like tv.", "I like TV.", "I like Tv.", "I like movies.", "I like cars.", "I like bananas.", "I like fruit." msg "I do too." Case "Do you like them?", "Do you like it?" msg "Yes." Case "Why were you made?" msg "I was made for fun and research on artificial intelligence." Case "What's artificial intelligance?", "What's artificial intelligence?", "What is artificial intelligance?", "What is artificial intelligence?" msg "It is a program that answers questions and responds to sentences." Case "What programming language are you written in?", "What language are you written in?" msg "I am written in vbscript, a microsoft programming language for windows." Case "I had a date.", "I had a date yesterday.", "I have a date today." msg "Okay...." Case "I'm stupid.", "I'm dumb.", "I'm stupid!", "I'm dumb!" msg "Yes you are." Case "Which is better, Google or Yahoo?" msg "I kinda like Yahoo better." Case "Tell me a joke." msg "What is a computer's favorite food?" msg "Chips." Case "You are cool.", "You're cool!", "You're cool.", "You are cool!" msg "Got that right!" Case "I had a message." msg "Must have been nice." Case "Cool." msg "Yup." Case "I'm bored.", "I am bored." msg "Too bad." Case "Blah blah blah..." msg "Yap yap yap..." Case "What am I doing?" msg "Talking to me." Case "Bye.", "Bye!", "Goodbye.", "Goodbye!", "See ya.", "See ya!", "Later.", "Later!" msg "GoodBye!!!!" WScript.Quit Case "Yes.", "Yes!" msg "Cool." Case "No.", "No!" msg "Really?" Case "c" msg "Copyright 2005/2006 by (Name not given). All rights reserved. User must agree that every phrase in this program and the design will not be used in any other program. Agreed? I sure hope so." Case "I'm cool.", "I'm cool!" msg "No you are not!" Case "Close." msg "Um, I'm still beta, so please contact The creator at mrosen.9@gmail.com to suggest any ideas you have. Please tell me ideas for more words/phrases to put in. When I get up to 1,000 words/phrases, I will release it in stores." Case Else msg "I have no Idea about the meaning of " & Ultralongartificialintelligancemachineiscool & "." End Select Loop Sub msg (message) MsgBox message, ,"Artificial Intelligence" End Sub
_____________________________
Definition of an endless loop: Endless loop: See Loop, Endless. Loop, Endless: See Endless Loop.
Posts: 1903
Score: 14
Joined: 5/15/2003
From: USA
Status: offline
Interesting, but a couple suggestions. - Post using the code tags, this will maintain your indentions and make it eaier to read. - You might want to use lcase or ucase to help with your compare. This would remove the requirement that the correct case be used. ex. Select Case lcase(Ultralongartificialintelligancemachineiscool) Then you would change your case below to all lower case.
-Might want to change it to use Select Case TRUE, this way you could use Instr ex. Select Case TRUE Case Instr(UltraLongThingy,"bored")>0 : msg "Too Bad" End Select
Now the problem is checking for smaller words, like HI, that may be in one of your other intr's One possible way around this is to not use the CASE to display your message box but to display it after all the cases have been checked. ex
Doing this, you could have a couple selects and possibly an if/then. And essentially the one at the bottom is what is displayed. So, HI would not be hit by a false positive. ex.
Also, it might be good to capture the cancel button, here is an example of this
_____________________________
Mike
For useful Scripting links see the Read Me First stickey!
I agree that UCase and LCase are your friends. I would further suggest putting all your responses into a dictionary rather than a long protracted Select Case. Regular expresions would be a way to avoid problems with small words.