2023年汉诺塔实验(人工智能).docx

上传人:ylj18****41534 文档编号:81609309 上传时间:2023-03-24 格式:DOCX 页数:16 大小:13.74KB
返回 下载 相关 举报
2023年汉诺塔实验(人工智能).docx_第1页
第1页 / 共16页
2023年汉诺塔实验(人工智能).docx_第2页
第2页 / 共16页
点击查看更多>>
资源描述

《2023年汉诺塔实验(人工智能).docx》由会员分享,可在线阅读,更多相关《2023年汉诺塔实验(人工智能).docx(16页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、2023年汉诺塔实验(人工智能) 实验二专家系统 一、源代码 import javax.swing.JCheckBox; import javax.swing.JOptionPane; import javax.swing.JPanel; public cla Index extends javax.swing.JFrame jmilk = new javax.swing.JCheckBox(); jclaw = new javax.swing.JCheckBox(); jhoof = new javax.swing.JCheckBox(); jbird = new javax.swing.J

2、CheckBox(); jloogLeg = new javax.swing.JCheckBox(); jflyable = new javax.swing.JCheckBox(); jeatMeat = new javax.swing.JCheckBox(); jfur = new javax.swing.JCheckBox(); jruminate = new javax.swing.JCheckBox(); jswim = new javax.swing.JCheckBox(); jfeather = new javax.swing.JCheckBox(); jdogTooth = ne

3、w javax.swing.JCheckBox(); jflyest = new javax.swing.JCheckBox(); jlayEgg = new javax.swing.JCheckBox(); jblackWhite = new javax.swing.JCheckBox(); jyellow = new javax.swing.JCheckBox(); jinFlyable = new javax.swing.JCheckBox(); jdarkDot = new javax.swing.JCheckBox(); jhoofAnimal = new javax.swing.J

4、CheckBox(); jpredator = new javax.swing.JCheckBox(); jmammal = new javax.swing.JCheckBox(); jblackStrip = new javax.swing.JCheckBox(); jgaze = new javax.swing.JCheckBox(); jLabel1 = new javax.swing.JLabel(); btnOk = new javax.swing.JButton(); jloogNeck = new javax.swing.JCheckBox(); private void ini

5、tComponents() public Index() initComponents(); 数组设置/: checkBoxs0 = jmilk; checkBoxs1 = jclaw; checkBoxs2 = jhoof; checkBoxs3 = jbird; checkBoxs4 = jloogLeg; checkBoxs5 = jflyable; checkBoxs6 = jeatMeat; checkBoxs7 = jfur; checkBoxs8 = jruminate; checkBoxs9 = jswim; checkBoxs10 = jfeather; checkBoxs1

6、1 = jdogTooth; checkBoxs12 = jflyest; checkBoxs13 = jlayEgg; checkBoxs14 = jblackWhite; checkBoxs15 = jyellow; checkBoxs16 = jinFlyable; checkBoxs17 = jdarkDot; checkBoxs18 = jhoofAnimal; checkBoxs19 = jpredator; checkBoxs20 = jmammal; checkBoxs21 = jblackStrip; checkBoxs22 = jgaze; checkBoxs23 = jl

7、oogNeck; :/数组设置 setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jmilk.setText(u5976); jclaw.setText(u722a); jhoof.setText(u8e44); jbird.setText(u9e1f); jloogLeg.setText(u957fu817f); jflyable.setText(u4f1au98de); jeatMeat.setText(u5403u8089); jfur.setText(u6bdbu53d1); jruminate.s

8、etText(u53cdu520d); jswim.setText(u6e38u6cf3); jfeather.setText(u7fbdu6bdb); jdogTooth.setText(u72acu9f7f); jflyest.setText(u5584u98de); jlayEgg.setText(u4e0bu86cb); jblackWhite.setText(u9ed1u767du8272); jyellow.setText(u9ec4u8910u8272); jinFlyable.setText(u4e0du4f1au98de); jdarkDot.setText(u6697u65

9、91u70b9); jhoofAnimal.setText(u6709u8e44u7c7bu52a8u7269); jpredator.setText(u98dfu8089u52a8u7269); jmammal.setText(u54fau4e73u52a8u7269); jblackStrip.setText(u9ed1u8272u6761u7eb9); jgaze.setText(u773cu775bu76efu7740u524du65b9); jLabel1.setFont(new java.awt.Font(黑体, 0, 24); jLabel1.setText(u4e13u5bb6

10、u7cfbu7edf); btnOk.setText(u731cu731cu662fu4ec0u4e48uff1f); btnOk.addActionListener(new java.awt.event.ActionListener() public void actionPerformed(java.awt.event.ActionEvent evt) btnOkActionPerformed(evt); ); jloogNeck.setText(u957fu8116u5b50); javax.swing.GroupLayout layout = new javax.swing.Group

11、Layout( getContentPane(); getContentPane().setLayout(layout); layout .setHorizontalGroup(layout .createParallelGroup( .addGroup( layout .createSequentialGroup() .addGap(35, 35, 35) .addGroup( layout .addGroup( layout javax.swing.GroupLayout.Alignment.LEADING) .createParallelGroup( javax.swing.GroupL

12、ayout.Alignment.LEADING) .createSequentialGroup() .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING) .addComponent( jmilk) .addComponent( jclaw) .addComponent( jhoof) .addComponent( jbird) .addGap( 44, 44, 44) .addGroup( layout .createParallelGroup( javax.swing.Group

13、Layout.Alignment.LEADING) .addComponent( jeatMeat) .addComponent( jfur) .addComponent( jflyable) .addComponent( jruminate) .addGroup( layout .createSequentialGroup() .addComponent( jloogLeg) .addGap( 32, 32, 32) .addComponent( jswim) .addGap(26, 26, 26) .addGroup( layout .addComponent( .addComponent

14、(btnOk) .addGroup( layout 98, jLabel1, .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .createSequentialGroup() .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComp

15、onent( jflyest) .addComponent( jdogTooth) .addComponent( jfeather) .addComponent( jlayEgg) .addComponent( jgaze) .addGap( 23, 23, 23) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent( jloogNeck) .addGroup( layout .createSequentialGroup() .addGroup( lay

16、out .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent( jyellow) .addComponent( jblackWhite) .addComponent( jinFlyable) .addComponent( jdarkDot) .addGap( 18, 18, 18) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent( jmammal)

17、 .addComponent( jpredator) .addComponent( jblackStrip) .addComponent( jhoofAnimal) .addContainerGap( javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE); layout .setVerticalGroup(layout .createParallelGroup( .addGroup( layout .createSequentialGroup() .addGroup( layout .addGroup( layout javax.swin

18、g.GroupLayout.Alignment.LEADING) .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .createSequentialGroup() .addGap( 81, 81, 81) .addComponent( jLabel1) .addGap( 65, 65, 65) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent( jfeather, ja

19、vax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( jfur) .addComponent( jmilk) .addComponent( jyellow) .addGap( 18, 18, 18) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent( jdogTooth) .addComponent( jeatM

20、eat) .addComponent( jclaw) .addComponent( jblackWhite) .addComponent( jpredator) .addGap( 24, 24, 24) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent( jflyable) .addC

21、omponent( jhoof) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent( jlayEgg) .addComponent( jinFlyable) .addComponent( jblackStrip) .addGap( 18, 18, 18) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(

22、jflyest) .addComponent( jbird) .addComponent( jruminate) .addComponent( jdarkDot) .addComponent( jhoofAnimal) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup( layout .createSequentialGroup() .addContainerGap( 175, Short.MAX_VALUE) .addComponent( jmammal, javax.swing

23、.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap( 141, 141, 141) .addPreferredGap( .addGroup( layout .addGroup( layout javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .createParallelGroup( javax.sw

24、ing.GroupLayout.Alignment.BASELINE) .addComponent( jswim) .addComponent( jgaze) .addComponent( jloogNeck) .addComponent(jloogLeg) .addGap(73, 73, .addGap(27, 27, 27); 73).addComponent(btnOk) pack(); / /GEN-END:initComponents private void btnOkActionPerformed(java.awt.event.ActionEvent evt) / TODO ad

25、d your handling code here: if (jfur.isSelected() & count() = 1) show(哺乳动物); else if (jmilk.isSelected() & count() = 1) show(哺乳动物); else if (jfeather.isSelected() & count() = 1) 主要代码/: show(鸟); else if (jflyable.isSelected() & jlayEgg.isSelected() & count() show(鸟); else if (jeatMeat.isSelected() & c

26、ount() = 1) show(食肉动物); else if (jdogTooth.isSelected() & jclaw.isSelected() & show(食肉动物); else if (jmammal.isSelected() & jhoof.isSelected() & count() show(有蹄类动物); else if (jmammal.isSelected() & jruminate.isSelected() & show(有蹄类动物); else if (jmammal.isSelected() & jpredator.isSelected() & show(金钱豹

27、); else if (jmammal.isSelected() & jpredator.isSelected() & show(虎); else if (jhoofAnimal.isSelected() & jloogNeck.isSelected() & show(长颈鹿); = 2) jgaze.isSelected() & count() = 3) = 2) count() = 2) jyellow.isSelected() & jdarkDot.isSelected() & count() = 4) jyellow.isSelected() & jblackStrip.isSelec

28、ted() & count() = 4) jloogLeg.isSelected() & jdarkDot.isSelected() & count() = 4) else if (jhoofAnimal.isSelected() & jblackStrip.isSelected() show(斑马); else if (jbird.isSelected() & jinFlyable.isSelected() & & count() = 2) jloogNeck.isSelected() & jloogLeg.isSelected() & jblackWhite.isSelected() &

29、count() = 5) /GEN-BEGIN:variables public static void main(String args) java.awt.EventQueue.invokeLater(new Runnable() public void run() new Index().setVisible(true); public void show(String meage) public int count() int sum = 0; for (int i = 0; i return sum; if (checkBoxsi.isSelected() sum +; JOptio

30、nPane.showMeageDialog(this, meage); show(鸵鸟); else if (jbird.isSelected() & jinFlyable.isSelected() & show(企鹅); else if (jbird.isSelected() & jflyest.isSelected() & count() show(信天翁); else show(我不知道是什么。); jblackWhite.isSelected() & jswim.isSelected() & count() = 4) = 2) :/主要代码 ); / Variables declara

31、tion - do not modify private javax.swing.JButton btnOk; private javax.swing.JLabel jLabel1; private javax.swing.JCheckBox jbird; private javax.swing.JCheckBox jblackStrip; private javax.swing.JCheckBox jblackWhite; private javax.swing.JCheckBox jclaw; private javax.swing.JCheckBox jdarkDot; private

32、javax.swing.JCheckBox jdogTooth; private javax.swing.JCheckBox jeatMeat; private javax.swing.JCheckBox jfeather; private javax.swing.JCheckBox jflyable; private javax.swing.JCheckBox jflyest; private javax.swing.JCheckBox jfur; private javax.swing.JCheckBox jgaze; private javax.swing.JCheckBox jhoof

33、; private javax.swing.JCheckBox jhoofAnimal; private javax.swing.JCheckBox jinFlyable; private javax.swing.JCheckBox jlayEgg; private javax.swing.JCheckBox jloogLeg; private javax.swing.JCheckBox jloogNeck; private javax.swing.JCheckBox jmammal; private javax.swing.JCheckBox jmilk; private javax.swi

34、ng.JCheckBox jpredator; private javax.swing.JCheckBox jruminate; private javax.swing.JCheckBox jswim; private javax.swing.JCheckBox jyellow; / End of variables declaration/GEN-END:variables public JCheckBox checkBoxs = new JCheckBox24; 二、结果截图 示例1: 示例2: 三、推理树 汉诺塔实验(人工智能) 人工智能实验 人工智能实验一 人工智能实验报告 人工智能_实验报告 人工智能 人工智能 人工智能 人工智能 人工智能

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 应用文书 > 工作报告

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁