PDA

View Full Version : The Magic Server


Tim
12-12-2004, 07:13 PM
I made this PHP script, It's kind of like a Magic Eight Ball. You ask it a question, and it replies randomly out of 15. The cool part about it is: It know's if you're asking a question that doesn't have a yes or no answer to it. You can see it "in-action" at http://www.tm-software.uni.cc/scripts/magic.php and the source in PHP->Examples of my website( http://tm-software.uni.cc/ ) It's not really useful for any serious website, but it's fun to play around with and learn from.

Have fun, and tell me what you think :)

Edit: Spelling.

shwaza
12-12-2004, 07:18 PM
hehe, that's pretty cool, you could probably do that with javascript as well except for the yes or no stuff.

Loser
12-12-2004, 07:23 PM
Hey, it knew the answer!
"Am I a loser?"
"Definately."

shwaza
12-12-2004, 09:34 PM
Originally posted by Loser@Dec 12 2004, 05:23 PM
Hey, it knew the answer!
"Am I a loser?"
"Definately."
17429


Lol, tim you're program's a genious!

Tim
12-12-2004, 09:52 PM
Apparently, it's not:

I said: Are you a genius?
It replied: Absoloutely Not.

:P

Soldier00
12-12-2004, 10:39 PM
hmm tim this is what i get for asking : Please ask a complete yes or no question so ur theory about yes or no is not true..

Tim
12-13-2004, 12:03 AM
What question did you ask it?

undacuvabruva
12-13-2004, 02:52 AM
How does it know what a yes or no question is?
I'm confused.

Loser
12-13-2004, 01:04 PM
Undacuvabruva, it takes out a certain word, like "Am" and answers with a random answer from answers made to "am", I believe.

Tim
12-13-2004, 07:11 PM
Originally posted by Loser@Dec 13 2004, 10:04 AM
Undacuvabruva, it takes out a certain word, like "Am" and answers with a random answer from answers made to "am", I believe.
17562

Not exactly. It checks if the sentence begins with "is", "was", "were", "will", "could", "should", "are", "did", "am", "can", or "do" (I tried to think of what words a yes or know question would start with) If it does, it picks a random number out of 7, and then if it is 1-3 it will answer yes, 4-6 is will answer no, and 7 will answer try again. It picks random out of 5 for yes no and try again replies.

:)

mck9235
12-13-2004, 10:53 PM
Thats pretty nifty, nice work. :)

reid315
12-14-2004, 01:45 AM
Tim, thanks for ruining the magic of the Magic Server ;)

starmena3
12-14-2004, 02:07 AM
ok so this is how it works. I just thought it picked out the Usual 5 W's and the H: Who, What, Where, When, Why, How. and is this all PHP? how did you make this? or what did you use to make this?

doltlord
12-14-2004, 02:12 AM
"Area 51 has how many chairs?"
"My sources say no."

lol. Might want to fix that. :)

reid315
12-14-2004, 02:40 AM
are you using the isset() funtion? I think it's picking up just ARE and AREA or AREN't and all the like

starmena3
12-14-2004, 02:48 AM
hey nobody's perfect and I think it's a good enough program to have fun with. its not like its a competition were the winner gets money :P but i still wanna know how he did this

geek
12-14-2004, 03:24 AM
pretty crazy. how long did it take to make? you must've been bored. :P

Tim
12-14-2004, 07:38 PM
Originally posted by doltlord+Dec 13 2004, 11:12 PM--><div class='quotetop'>QUOTE(doltlord @ Dec 13 2004, 11:12 PM)</div><div class='quotemain'>"Area 51 has how many chairs?"
"My sources say no."

lol. Might want to fix that. :)
17654
[/b]
I guess I should. Or maybe you should ;)

Originally posted by reid315@Dec 13 2004, 11:40 PM
are you using the isset() funtion? I think it's picking up just ARE and AREA or AREN't and all the like
17669

Not the isset function. I'm checking the length of the total string to the length of the stristr() length... Go look at the souce :)

<!--QuoteBegin-geek@Dec 14 2004, 12:24 AM
pretty crazy. how long did it take to make? you must've been bored. :P
17693
[/quote]
Actually it only took me about 15 minutes :P

starmena3
12-14-2004, 07:42 PM
wow !15 minutes! can I use this code for my website? :D I like this game its really good. I find it better than those over there at those kids site and things like that

Tim
12-14-2004, 08:49 PM
Thanks :) Of course you can use it. Take credit for it if you want... :P

abrie
12-16-2004, 05:53 PM
Wow thats pretty cool. I tried to fool it but i couldn't. Well... not exactly, unless I asked something like: State, by means of yes or no, whether this is a yes or no question.

But i guess its only me who would ask someting like that... :lol: :lol:

mahangee
12-16-2004, 06:17 PM
Originally posted by Tim@Dec 12 2004, 08:13 PM
I made this PHP script, It's kind of like a Magic Eight Ball. You ask it a question, and it replies randomly out of 15. The cool part about it is: It know's if you're asking a question that doesn't have a yes or no answer to it. You can see it "in-action" at http://www.tm-software.uni.cc/scripts/magic.php and the source in PHP->Examples of my website( http://tm-software.uni.cc/ ) It's not really useful for any serious website, but it's fun to play around with and learn from.

Have fun, and tell me what you think :)

Edit: Spelling.
17425

Hey Tim PHP you know your examples section with , I would recommend that you use highlight_string() to make you examples easy to read. :D Just a suggestion other than that pretty good. :D

Tim
12-16-2004, 08:03 PM
Originally posted by mahangee@Dec 16 2004, 03:17 PM
Hey Tim PHP you know your examples section with , I would recommend that you use highlight_string() to make you examples easy to read. :D Just a suggestion other than that pretty good. :D
18127


That's not a bad idea. I think I'll try it :)