⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 food.java

📁 基于java的专家系统
💻 JAVA
字号:
import java.util.*;import java.io.*;import jess.*;public class Food {    public static void main(String[] args) {        try {            FileReader fr = new FileReader("food_rules.clp");            Rete r = new Rete();            Jesp jesp = new Jesp(fr, r);            jesp.parse(false);            r.executeCommand("(reset)");            r.executeCommand("(assert (have_food (name spinach) (weight 10)))");            r.executeCommand("(assert (have_food (name peas) (weight 14) (is_frozen yes)))");            System.out.println("Output from executing up to 10 Jess rules:\n");            // Note: the following command causes any 'printout' commands from Jess to print to standard output:            r.executeCommand("(run 10)"); // run a maximum of 10 rule firings            // print out all facts in the system:            System.out.println("\nList of all facts asserted in the system:\n");            Iterator iter = r.listFacts();            while (iter.hasNext()) {                System.out.println("Current fact: " + iter.next());            }        } catch (Exception ex) {            System.err.println(ex);        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -