Python编程

  • z2_128603
    了解作者
  • 49.9MB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-07 01:46
    上传日期
很有趣的一本Python书,学完后可以做各种项目了,对入门的读者是很大的提升
[Python编程(第4版)].源代码.zip
内容介绍
This directory contains two AI (Artificial Intelligence) examples that are mentioned but not covered in any sort of depth in the text. PLEASE NOTE: The portions of these examples that are used and named in the 4th Edition of the book have been ported to Python 3.X, but others might not have been. PyToe was ported to 3.X, but holmes was not. Holmes dates back to pre-1.0 Python, and would be substantially different if coded today--see its own README for more details. 1) PyToe ======== A ticTacToe GUI program, described but not fully listed in the _Larger GUI Examples_ chapter. This is a new program (developed in the 1999-2000 timeframe) written for the 2nd edition of this book. It demonstrates basic game search strategies (you play the program). 2) Holmes ========= The holmes expert system is briefly mentioned to show its rule parser logic in the _Text and Language_ chapter. I don't maintain holmes anymore, but it seems to still work as advertised under Python 1.5.2. If memory serves, holmes dates back to 1993 and pre-1.0 Python releases, so please note that it is very old code, and not necessarily a good coding style example (e.g., it does not use class constructor methods, as they weren't available when holmes was written). Below are example Holmes sessions to get you started (this was all run under Python 1.5.2). It uses the following holmes interactive commands: += adds a rule @@ prints the rulebase ?- does backward chaining to prove a query +- does forward chaining with a set of facts @= loads a rulebase file stop exits holmes help prints all commands ================================================================== C:\...\PP2E\Ai\ExpertSystem\holmes\holmes>python holmes.py -Holmes inference engine- holmes> += rule pylike if ?X likes coding, ?X likes spam then ?X likes Python holmes> @@ rule pylike if ?X likes coding, ?X likes spam then ?X likes Python. holmes> holmes> ?- mel likes Python is this true: "mel likes coding" ? y is this true: "mel likes spam" ? y yes: (no variables) show proof ? yes "mel likes Python" by rule pylike "mel likes coding" by your answer "mel likes spam" by your answer more solutions? n holmes> +- ann likes spam, ann likes coding I deduced these facts... ann likes Python I started with these facts... ann likes spam ann likes coding time: 0.0 holmes> ?- ann likes ?X is this true: "ann likes coding" ? y is this true: "ann likes spam" ? y yes: ann likes Python holmes> stop ================================================================== holmes> += rule 1 if thinks ?x then human ?x holmes> += rule 2 if human ?x then mortal ?x holmes> ?- mortal bob is this true: "thinks bob" ? y yes: (no variables) holmes> +- thinks bob I deduced these facts... human bob mortal bob I started with these facts... thinks bob time: 0.0 =================================================================== holmes> @= ..\kbases\zoo.kb holmes> ?- it is a penguin is this true: "has feathers" ? y is this true: "able to fly" ? n is this true: "black color" ? y yes: (no variables) holmes> ?- it is a ?What is this true: "lives in saltwater" ? n is this true: "lives in freshwater" ? n is this true: "has feathers" ? n is this true: "live births" ? y is this true: "is omnivorous" ? y is this true: "is intelligent" ? y is this true: "technologically advanced" ? n yes: it is a monkey show proof ? y "it is a monkey" by rule 20 "subclass primate" by rule 19 "class mammal" by rule d "live births" by your answer "is omnivorous" by your answer "is intelligent" by your answer "not technologically advanced" by failure to prove "technologically advanced" ====================================================================== C:\...\PP2E\Ai\ExpertSystem\holmes\holmes>python holmes.py -Holmes inference engine- holmes> @= ..\kbases\fixit.kb holmes> ?- go toaster ?P ?S is this true: "toaster works" ? no is this true: "switch turned on" ? yes is this true: "toaster runs on batteries" ? no is this true: "toaster firmly plugged in" ? yes is this true: "used toaster before" ? yes is this true: "toaster makes sizzle sound" ? yes yes: go toaster unit-is-wet dry-it-out show proof ? yes "go toaster unit-is-wet dry-it-out" by rule 1 "fixit toaster unit-is-wet dry-it-out" by rule t2 "appliance abuse toaster unit-is-wet dry-it-out" by rule a1 "toaster makes sizzle sound" by your answer more solutions?
评论
    相关推荐
    • Python
      Python
    • python
      Python 这是用于大多数基本和简单python代码的示例模板的存储库。
    • Python
      Python项目 Python是一些简单的Python项目,它是一种解释性的高级通用编程语言,我愿意学习它为将来的许多项目做出贡献! 入门 您必须安装Python 3.9.2才能尝试这些项目。 这些项目来自各种书籍,您可以根据需要进行...
    • Python
      Python Dit是Mijn储存库van Python
    • python
      Python 基本的python编程
    • Python
      Python python和pyspark
    • python
      关于python的学习资料。。。。。。。
    • python学习
      python学习 安装Python 我们转到Python页面进行初始下载:( )在为Mac OSX选择了最新版本(3.9.2)之后,我将其下载到了我的计算机上。 然后,我们搜索了“ Python入门”,并确认VS Code是适用于Python的可行代码...
    • Fluent Python
      This book was written for practicing Python programmers who want to become proficient in Python 3. If you know Python 2 but are willing to migrate to Python 3.4 or later, you should be fine. At the ...
    • Python
      Python 该存储库包含与Python编程研究相关的文档