Note that there are some explanatory texts on larger screens.

plurals
  1. PORobocode Robot with Drools Expert
    primarykey
    data
    text
    <p>i have a class assignment to create a Robot using Drools as an inference machine. however, most of my rules act strange since they don't fire for the class but fire for it's superclass. Something like this:</p> <p>my rules:</p> <pre><code>import the.manifested.Robotonikku; import the.manifested.Strategy; import the.manifested.Action; import robocode.TeamRobot; rule "One" when Robotonikku(); then System.out.println("roboto is present"); end rule "Two" when not Robotonikku(); then System.out.println("roboto is not present"); end rule "Three" when TeamRobot(); then System.out.println("robot is present"); end rule "Four" when not TeamRobot(); then System.out.println("robot is not present"); end </code></pre> <p>and as expected </p> <pre><code>public class Robotonikku extends TeamRobot </code></pre> <p>inside the run() method of Robotonikku that is called by Robocode's simulator I insert the instance as a fact:</p> <pre><code>ksession.insert(this) </code></pre> <p>i would expect that rules One and Three should fire but rule Two and Three are fired. Why it recognizes the instance as a TeamRobot and not as Robotonikku?</p> <p>thanks in advance.</p> <p>loading code:</p> <pre><code> String ficheroReglas = System.getProperty("robot.reglas", RobotDrools.FICHERO_REGLAS); kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add(ResourceFactory.newClassPathResource(ficheroReglas, RobotDrools.class), ResourceType.DRL); if (kbuilder.hasErrors()) { System.err.println(kbuilder.getErrors().toString()); } kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); ksession = kbase.newStatefulKnowledgeSession(); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload