iPhone应用程序与剪辑规则引擎

时间:2012-07-25 13:14:28

标签: iphone objective-c artificial-intelligence rule-engine clips

我正在开发一款使用CLIPS RULES ENGINE的iPhone应用 我使用下面的代码将它与XCode成功集成。

InitializeEnvironment();
Clear(); 

NSString *filePath = [[NSBundle mainBundle]
                      pathForResource:@"animal" ofType:@"clp"];

NSData *myData = [NSData dataWithContentsOfFile:filePath]; 

if (myData) {

    char *clipsFileChar = (char *)[filePath cStringUsingEncoding:NSASCIIStringEncoding]; 

    IncrementGCLocks();
    Load(clipsFileChar);
    Reset();
    AssertString("(find-all-facts ((?f state-list)) FALSE)"); 

    int numberRulesFired = Run(-1); 
    NSLog(@"Number of rules that fired: %d", numberRulesFired); 

    DecrementGCLocks(); 
}
else {
    NSLog(@"Could not find file %@", filePath);
} 

问题是当我运行我的应用程序时,它会从行int numberRulesFired = Run(-1);进入无限循环 如果您有任何想法,请帮助我....... 谢谢.. :))

0 个答案:

没有答案