This doesn't seem to be quite correct.<br><ul><li>There's a fact "location" and another one "Location" - are they the same?</li><li>Query "look" is defined; query "look2" is referenced.</li>
<li>How is the fact L/location defined?</li></ul>Regards<br>Wolfgang<br><br><br><br><br><div class="gmail_quote">On 18 April 2011 16:57, Mark Proctor <span dir="ltr"><<a href="mailto:mproctor@codehaus.org">mproctor@codehaus.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Here is a more friendly example based around "Adventures in Proglog"'s<br>
"Nani Search". This is just a sampling of queries and rules, which it<br>
uses to provide an adventure like game environment. The "?" means to<br>
pull results, rather than the normal reactive nature of patterns.<br>
<a href="http://www.amzi.com/AdventureInProlog/" target="_blank">http://www.amzi.com/AdventureInProlog/</a><br>
<br>
query niceFood( String thing, String location )<br>
location(thing, location) and<br>
edible(thing)<br>
end<br>
<br>
query connect( String x, String y )<br>
door(x, y;)<br>
or<br>
door(y, x;)<br>
end<br>
<br>
query look(String place, List things, List exits)<br>
things : List() from accumulate( Location(thing, place;) ,<br>
<br>
collectList( thing ) )<br>
food : List() from accumulate( ?niceFood(thing, place;) ,<br>
collectList(<br>
thing ) )<br>
exits : List() from accumulate( ?connect(place, exit;) ,<br>
collectList(<br>
[place, exit] ) )<br>
end<br>
<br>
rule reactiveLook when<br>
Here( place : location)<br>
?look2(place, things, exits)<br>
then System.out.println( " You are in the " + place );<br>
System.out.println( " You can see " + things );<br>
System.out.println( " You can eat" + eat );<br>
System.out.println( " You can go to " + exits );<br>
end<br>
<br>
-----Output----<br>
You are in the kitchen<br>
You can see [crackers, broccoli, apple]<br>
You can eat[crackers, apple]<br>
You can go to [[kitchen, dining room], [kitchen, cellar]]<br>
<br>
_______________________________________________<br>
rules-dev mailing list<br>
<a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
</blockquote></div><br>