Package cz.cuni.amis.pogamut.shady

Fuzzy/Shady (name subject to change) ===== Shady is a new engine using if-then rules.

See: Description

Package cz.cuni.amis.pogamut.shady Description

Fuzzy/Shady (name subject to change)
=====
Shady is a new engine using if-then rules. posh is ugly piece of code that is
maintaining compatibility with the version written in lisp and later in Python.
That must stop, it is not pretty (in fact, it is distasteful), it has many
features that are not used (goals in competences, nested APs) and very few
people even have an idea they are there (default goals and such) or even why
they are there.

Our students often complain about posh, so do I. I believe that much simples
tree engine with simple node structure will be easier to learn and to use. This
idea was proposed by Jakub Gemrot (17.10.2011) alongside with my tasks
for master thesis, but I am beat tonight, so it is time for some fun instead of
productuive work.

What is difference from posh?
 * Name - sorry, but I can't stand it any longer. That is also why my editor is
   called Shed, not poSH EDitor.
 * Simpler structure. In posh, we have AP, C, Ds, here, we have unified node.
   There are slight differences in behavior of Cs and DC, but not even I can
   remember what they are(another obscure feature). DPEs, CPEs...Headaches
   with connecting it all together...Be gone.
 * Arguments - I made a big mistake with named variables in posh. My design was
   more Pyhton like (named variables), not lisp like.
 * Priority - instead of fixed priority numbers in one node, the priority will
   determined on runtime. This will allow for things like node activating (prio-
   rity will be increased), when there is a predator close.
 * Multiple plan execution. It will be possible to execute multiple plans
   at once. You are probably not sure why. It only introduces complexity for
   our plan; that is not correct at all. We can utilize it using resource 
   approach. One plan will be responsible for moving player along the route,
   while other plan turns, shoots or whatnot. If you had only one plan, you
   would need to somehow handle the other plan in every action. This is
   by no means compulsory, but it could be useful, so it will be included.
 * trigger will be more complex, if needed. And, not, or.
 * simplified value handling. Then primitive returns value, in posh, it can be
   (nearly) anything, null, int, string, double, even object. Not here. I only
   allow to return the number. Zero is false, otherwise it is true. Numbers is 
   about everything I need in plan. For more complex things, program new sense.
 * I will of course incorporate all lessons learned while programming posh engine.


Grammar
=======

fuzzy : '(' node ')'

# NAME is a string in quotes, e.g. "root" or "run on hills"
node : '(' 'node' NAME DESCR (connection)+ ')'

# priority is a call 
connection : '(' PRIORITY trigger call ')'

# Trigger is something that returns either 1 or 0 (instead of true/false)
trigger : '(' 'not' trigger ')'
           '(' 'and' (trigger)+ ')'
           '(' 'or' (trigger)+ ')'
           '(' '>' value value ')'
           '(' '>=' value value ')'
           '(' '=' value value ')'
           '(' '=<' value value ')'
           '(' '<' value value ')'
           call

# Something that returns numerical value, either parameter, constant or call
value : call
        | parameter

 
# call function and return numerical value
call : '(' NAME (PARAMETER)* ')'

parameter : argument | string | number

ARG: '*' (DIGIT)+ '*'
STRING: 
INT: 
NUMBER:

Example :   
TODO: Use prefix, something like classpath so I dont have to use full names

(
    (node "root" "Root node for rabbit"
        ((fix 100)  ((hungry)) ("look for food") )
        ((fix 50)   ((succeed)) ("run around") )
        ((scared)   ((succeed)) ("run from closest enemy"))
    )
    
    (node "look for food" "Go around the forrest and look for edible stuff"
        ((fix 10) ) 
    )
)




How is target of call determined:

Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.