.It's alive !Alive, yes, but not as much intelligent than expected ..........Instead of watching a stupid movie at TV, I decided to write a tiny AI programme all in PHP.My goal was to get some functionalities comparable to logic programming languages like Prolog.In simpler words : I wanted to create a programme that could learn facts, and find the solutions to some logical problems.For instance :> blue is colour.Okay.> carrot is vegetable.Okay.> blue is colour ?Yes.> blue is vegetable ?No.> carrot is colour ?No.etc.So far, I can teach it facts in the form of 3-words-affirmations, and I can ask it questions and definitions, and the creature is able to find some connections between facts.Experimentation #1 : > red is colour.Okay> black is colour.Okay> orange is colour.Okay> orange is fruit.Okay(Here, we have a trap : orange is both a color and a fruit.)> red is colour ?Yes> black is fruit ?No> orange is colour ?Yes> orange is fruit ?Yes(Good. The beast did not fall in the trap.)> translate : red- "colour"> translate : orange- "colour"- "fruit"> translate : colour- "red"- "black"- "orange"Good ! The beast can give a sense to the words it learned.Experimentation #2 :> Paul is human.Okay> human eat fruit.Okay> apple is fruit.Okay> human is animal.Okay> animal eat meat.Okay> animal is mortal.OkayNow, let's see if it can "chain" the facts in a logical manner :> translate : Paul- "human"Here it should have replied : "human", "animal" and "mortal", since human are animals, and animals are mortal ...Let's see how it defines "Paul" :> define : Paul- Paul is humanMy creature seems obviously narrow minded ...Let's quiz it now :> Paul is apple ?No> Paul is fruit ?No> Paul is human ?Yes> human is Paul ?Yes> Paul is Paul ?Yes> Paul eat fruit ?Yes> Paul eat apple ?Yes> Paul is animal ?Yes> Paul eat meat ?No> Paul is mortal ?YesAs we can see, it successfully (and surprisingly) replied correctly to each question by connecting facts together, excepted for "Paul eat meat ?".At this question, it should have replied "yes", since it knows that "Paul is human", "human is animal" and "animal eat meat". But it did not ... ... and it's bizarre since it can reply correctly to "Paul is mortal ?", from "Paul is human", "human is animal" and "animal is mortal", or to "Paul eat apple ?" from "Paul is human", " human eat fruit" and "apple is fruit" ...Interesting, isn't it ? =o)If you want, you can submit your facts and questions to my experimental creature (which has no name yet) =o)What would be interesting also, is to confront it to a "paradox" just to see how it behaves ! =o)20080625 : For those of you who would like to have a look at the guts of the beast, here is available the source code.However, keep it mind it's a spaghetti-code and many function names are in french (as well as comments).Also, this version relies on MySQL to store and query facts (I'm planning to replace it with simple arrays though), which make the code slightly more complicated than required ...The main code makes less than 250 lines =o)There is no direct input interface : instead, it use scripts (exp_*.php) that call functions. For example :declarer("red","is","colour"); // <---- declarationsdeclarer("black","is","colour");declarer("orange","is","colour");declarer("orange","is","fruit");verifier("red","is","colour"); // <---- questionsverifier("black","is","fruit");verifier("orange","is","colour");verifier("orange","is","fruit");... which is slightly more complicated than what I showed above for the sake of comprehension and simplification !