I'm trying to load jFuzzyLogic.jar into my Greenfoot Scenario. I am having problems importing the classes.
Here is the code that I am trying to work on:
I have placed jFuzzyLogic_v2.0.11.jar at +libs in the root folder of Greenfoot but Greenfoot an error occurs at the line import net.sourceforge.jFuzzyLogic.FIS;
Am I doing something wrong or missing something? Please help!
import net.sourceforge.jFuzzyLogic.FIS; import net.sourceforge.jFuzzyLogic.FunctionBlock; public class FuzzyLogicController { static { final NativeLoader loader = new NativeLoader(); loader.addClasspath( ".\\+libs\\jFuzzyLogic_v2.0.11" ); loader.loadClass( "net.sourceforge.jFuzzyLogic.FIS" ); loader.loadClass( "net.sourceforge.jFuzzyLogic.FunctionBlock" ); } public FuzzyLogicController() { } public void TestTipper() throws Exception { String fileName = "tipper.fcl"; FIS fis = FIS.load(fileName, true); if( fis == null ) { // Error while loading? System.err.println("Can't load file: '" + fileName + "'"); return; } // Show ruleset FunctionBlock functionBlock = fis.getFunctionBlock(null); functionBlock.chart(); // Set inputs functionBlock.setVariable("service", 3); functionBlock.setVariable("food", 7); // Evaluate functionBlock.evaluate(); // Show output variable's chart functionBlock.getVariable("tip").chartDefuzzifier(true); // Print ruleSet System.out.println(functionBlock); } }