資源簡介
阿爾法貝塔剪枝算法五子棋,人工智能課程,Java代碼,可直接運行

代碼片段和文件信息
“““Implement?Agents?and?Environments?(Chapters?1-2).
The?class?hierarchies?are?as?follows:
Thing?##?A?physical?object?that?can?exist?in?an?environment
????Agent
????????Wumpus
????Dirt
????Wall
????...
Environment?##?An?environment?holds?objects?runs?simulations
????XYEnvironment
????????VacuumEnvironment
????????WumpusEnvironment
An?agent?program?is?a?callable?instance?taking?percepts?and?choosing?actions
????SimpleReflexAgentProgram
????...
EnvGUI?##?A?window?with?a?graphical?representation?of?the?Environment
EnvToolbar?##?contains?buttons?for?controlling?EnvGUI
EnvCanvas?##?Canvas?to?display?the?environment?of?an?EnvGUI
“““
#?TO?DO:
#?Implement?grabbing?correctly.
#?When?an?object?is?grabbed?does?it?still?have?a?location?
#?What?if?it?is?released?
#?What?if?the?grabbed?or?the?grabber?is?deleted?
#?What?if?the?grabber?moves?
#
#?Speed?control?in?GUI?does?not?have?any?effect?--?fix?it.
from?utils?import?distance_squared?turn_heading
from?statistics?import?mean
import?random
import?copy
import?collections
#?______________________________________________________________________________
class?Thing:
????“““This?represents?any?physical?object?that?can?appear?in?an?Environment.
????You?subclass?Thing?to?get?the?things?you?want.?Each?thing?can?have?a
????.__name__??slot?(used?for?output?only).“““
????def?__repr__(self):
????????return?‘<{}>‘.format(getattr(self?‘__name__‘?self.__class__.__name__))
????def?is_alive(self):
????????“““Things?that?are?‘alive‘?should?return?true.“““
????????return?hasattr(self?‘alive‘)?and?self.alive
????def?show_state(self):
????????“““Display?the?agent‘s?internal?state.?Subclasses?should?override.“““
????????print(“I?don‘t?know?how?to?show_state.“)
????def?display(self?canvas?x?y?width?height):
????????“““Display?an?image?of?this?Thing?on?the?canvas.“““
????????#?Do?we?need?this?
????????pass
class?Agent(Thing):
????“““An?Agent?is?a?subclass?of?Thing?with?one?required?slot
????.program?which?should?hold?a?function?that?takes?one?argument?the
????percept?and?returns?an?action.?(What?counts?as?a?percept?or?action
????will?depend?on?the?specific?environment?in?which?the?agent?exists.)
????Note?that?‘program‘?is?a?slot?not?a?method.?If?it?were?a?method
????then?the?program?could?‘cheat‘?and?look?at?aspects?of?the?agent.
????It‘s?not?supposed?to?do?that:?the?program?can?only?look?at?the
????percepts.?An?agent?program?that?needs?a?model?of?the?world?(and?of
????the?agent?itself)?will?have?to?build?and?maintain?its?own?model.
????There?is?an?optional?slot?.performance?which?is?a?number?giving
????the?performance?measure?of?the?agent?in?its?environment.“““
????def?__init__(self?program=None):
????????self.alive?=?True
????????self.bump?=?False
????????self.holding?=?[]
????????self.performance?=?0
????????if?program?is?None?or?not?isinstance(program?collections.Callable):
????????????print(“Can‘t?find?a?valid?program?for?{}?falling?back?to?default.“.format(
????????????????self.__clas
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-10-21?17:42??aima-python-master\
?????文件?????????131??2018-10-21?17:42??aima-python-master\.flake8
?????文件?????????899??2018-10-21?17:42??aima-python-master\.gitignore
?????文件??????????91??2018-10-21?17:42??aima-python-master\.gitmodules
?????文件?????????477??2018-10-21?17:42??aima-python-master\.travis.yml
?????文件???????10320??2018-10-21?17:42??aima-python-master\CONTRIBUTING.md
?????文件????????1091??2018-10-21?17:42??aima-python-master\LICENSE
?????文件???????17718??2018-10-21?17:42??aima-python-master\README.md
?????文件?????????599??2018-10-21?17:42??aima-python-master\SUBMODULE.md
?????文件??????128289??2018-10-21?17:42??aima-python-master\agents.ipynb
?????文件???????35990??2018-10-21?17:42??aima-python-master\agents.py
?????目錄???????????0??2018-10-21?17:42??aima-python-master\aima-data\
?????文件??????231531??2018-10-21?17:42??aima-python-master\csp.ipynb
?????文件???????27298??2018-10-21?17:42??aima-python-master\csp.py
?????文件???????49294??2018-10-21?17:42??aima-python-master\games.ipynb
?????文件???????20923??2018-10-21?17:42??aima-python-master\games.py
?????目錄???????????0??2018-10-21?17:42??aima-python-master\gui\
?????文件????????4618??2018-10-21?17:42??aima-python-master\gui\eight_puzzle.py
?????文件????????6944??2018-10-21?17:42??aima-python-master\gui\genetic_algorithm_example.py
?????文件???????23295??2018-10-21?17:42??aima-python-master\gui\grid_mdp.py
?????文件???????21513??2018-10-21?17:42??aima-python-master\gui\romania_problem.py
?????文件????????6810??2018-10-21?17:42??aima-python-master\gui\tic-tac-toe.py
?????文件???????14806??2018-10-21?17:42??aima-python-master\gui\tsp.py
?????文件????????6034??2018-10-21?17:42??aima-python-master\gui\vacuum_agent.py
?????文件????????7210??2018-10-21?17:42??aima-python-master\gui\xy_vacuum_environment.py
?????目錄???????????0??2018-10-21?17:42??aima-python-master\images\
?????文件???????16933??2018-10-21?17:42??aima-python-master\images\-0.04.jpg
?????文件???????20027??2018-10-21?17:42??aima-python-master\images\-0.4.jpg
?????文件???????19579??2018-10-21?17:42??aima-python-master\images\-4.jpg
?????文件???????21550??2018-10-21?17:42??aima-python-master\images\4.jpg
?????文件?????????377??2018-10-21?17:42??aima-python-master\images\IMAGE-CREDITS
............此處省略115個文件信息
評論
共有 條評論