Well, you've left some details unspecified.

- Are you using static or dynamic definstaces? This will only work
with dynamic ones.

- Do your objects send correct propertyChange events? Study the way
the example beans that come with Jess do it -- there's only one right
way. 

- Have you heeded the warnings in the manual regarding the equals() and
hashCode() methods (section 3.4)? More subtly, do any of your objects,
or the objects in their slots, change their hashCode()s over time? We
just went throughthis recently on this mailing list: an object that
changes its hashCode() over time will confuse Jess just as it will
confuse java.util.HashMap and similar containers.

- Have you use the (watch all) command and (run) with an optional
numeric to step through your program, one rule at a time? Very often
this last procedure will show you something you didn't expect.

I think El German wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Hi,
> 
>   I'm describing the movements of a car with Jess rules.  I'm using Java to 
> define the main structures of the program and Jess to write rules that must 
> change the position, orientation, ... of the car.
> 
>   My problem is that the car makes too many movements where it shouldn't.  I 
> had this problem before, and I could make it work, but now it seems to be 
> imposible.
> 
>   I've got this rule:
> 
>   (defrule car-turns
>     (car (position ?pos)
>          (orientation ?o)
>          (OBJECT ?c))
>     (position (OBJECT ?old-pos&:(and (eq ?o (call ?c computeOrientation ?pos 
> ?old-pos))
>                                      (not (call ?c isAllowed ?old-pos))
>                                 )
>               )
>     )
>     (position (OBJECT ?new-pos&: ...))
>   =>
>     (set ?c orientation (call ?c computeOrientation ?old-pos ?new-pos))
>     ...
>   )
> 
>   Ok, that was the code.  The problem is that when there are different 
> posibilities (the car can turn right or left) all of them are activated 
> (that's ok) but then all of them are executed.  And I think they shouldn't 
> be executed because the car's orientation has been changed, and ?o should 
> change and after executing the first activated rule, the rest of activations 
> should be deactivated!
> 
>   I think there's something I'm doing wrong or that I don't understand using 
> Java objects from Jess.
> 
>   Any help will be wellcome.  Thanks,
> 
>     Cherman.
> 
> _________________________________________________________________
> Hable con sus amigos en l_nea, pruebe MSN Messenger: http://messenger.msn.es
> 
> 
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the list
> (use your own address!) List problems? Notify [EMAIL PROTECTED]
> --------------------------------------------------------------------
> 



---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9012                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to