Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Patch 1 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Mar 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
9d272b7
Update test_agents.py
sofmonk Mar 18, 2017
1581f7a
Update test_agents.py
sofmonk Mar 18, 2017
7f9d053
Update test_agents.py
sofmonk Mar 18, 2017
594736d
Update test_agents.py
sofmonk Mar 18, 2017
b6f9de4
Update test_text.py
sofmonk Mar 18, 2017
7d5dcba
Update utils.py
sofmonk Mar 18, 2017
2783b6a
Update search.py
sofmonk Mar 18, 2017
99cbbaf
Update probability.py
sofmonk Mar 18, 2017
620cb41
Update learning.py
sofmonk Mar 18, 2017
ab26cd8
Update planning.py
sofmonk Mar 18, 2017
f69e7c1
Update rl.py
sofmonk Mar 19, 2017
fba8b92
Merge pull request #4 from sofmonk/patch-2
sofmonk Mar 19, 2017
fce259a
Update search.py
sofmonk Mar 19, 2017
6b82783
Update search.py
sofmonk Mar 19, 2017
5e628be
Update search.py
sofmonk Mar 19, 2017
86f10d5
Update search.py
sofmonk Mar 19, 2017
706838b
Removed flake8 test for pytest directory (#386)
Chipe1 Mar 21, 2017
c8115ce
edits in search.py (#384)
kaivalyar Mar 22, 2017
6a1b84b
Upadte search.py (#389)
BesanHalwa Mar 22, 2017
9f1b1ee
Update learning.py (#388)
BesanHalwa Mar 22, 2017
4548aae
Updated docstring for ModelBasedReflexAgentProgram in agent.py (#391)
articuno12 Mar 22, 2017
4bac571
Added testcase for ReflexVacuumAgent and ModelBasedVacuumAgent (#394)
articuno12 Mar 22, 2017
c38675a
Add Perceptron to Notebook (#387)
antmarakis Mar 22, 2017
2922ab6
Games notebook updates (#383)
kaivalyar Mar 22, 2017
2b07ba9
Fixed bugs in games.py (#380)
kaivalyar Mar 22, 2017
efa5628
Update test_learning.py (#376)
antmarakis Mar 22, 2017
a925fe6
Merge branch 'master' into patch-1
norvig Mar 22, 2017
1bd46b9
Update README.md
sofmonk Mar 23, 2017
6e3fb8e
Update README.md
sofmonk Mar 23, 2017
3f3ef6d
Update README.md
sofmonk Mar 23, 2017
534cfa7
Merge branch 'master' into patch-1
sofmonk Mar 23, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ install:
- pip install -r requirements.txt

script:
- flake8 tests/
- py.test
- python -m doctest -v *.py

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,16 @@ Here is a table of algorithms, the figure, name of the code in the book and in t
| 9.3 | FOL-FC-Ask | `fol_fc_ask` | [`logic.py`][logic] |
| 9.6 | FOL-BC-Ask | `fol_bc_ask` | [`logic.py`][logic] |
| 9.8 | Append | | |
| 10.1 | Air-Cargo-problem | |
| 10.2 | Spare-Tire-Problem | |
| 10.3 | Three-Block-Tower | |
| 10.7 | Cake-Problem | |
| 10.9 | Graphplan | |
| 10.1 | Air-Cargo-problem |`air_cargo` |[`planning.py`][planning]|
| 10.2 | Spare-Tire-Problem | `spare_tire` |[`planning.py`][planning]|
| 10.3 | Three-Block-Tower | `three_block_tower` |[`planning.py`][planning]|
| 10.7 | Cake-Problem | `have_cake_and_eat_cake_too` |[`planning.py`][planning]|
| 10.9 | Graphplan | `GraphPlan` |[`planning.py`][planning]|
| 10.13 | Partial-Order-Planner | |
| 11.1 | Job-Shop-Problem-With-Resources | |
| 11.5 | Hierarchical-Search | |
| 11.8 | Angelic-Search | |
| 11.10 | Doubles-tennis | |
| 11.10 | Doubles-tennis | `double_tennis_problem` |[`planning.py`][planning]|
| 13 | Discrete Probability Distribution | `ProbDist` | [`probability.py`][probability] |
| 13.1 | DT-Agent | `DTAgent` | [`probability.py`][probability] |
| 14.9 | Enumeration-Ask | `enumeration_ask` | [`probability.py`][probability] |
Expand Down
34 changes: 17 additions & 17 deletions agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def program(percept):


def ModelBasedReflexAgentProgram(rules, update_state, model):
"""This agent takes action based on the percept and state. [Figure 2.8]"""
"""This agent takes action based on the percept and state. [Figure 2.12]"""
def program(percept):
program.state = update_state(program.state, program.action, percept, model)
rule = rule_match(program.state, rules)
Expand Down Expand Up @@ -443,7 +443,7 @@ def move_to(self, thing, destination):
# obs.thing_added(thing)

def add_thing(self, thing, location=(1, 1), exclude_duplicate_class_items=False):
"""Adds things to the world. If (exclude_duplicate_class_items) then the item won't be
"""Adds things to the world. If (exclude_duplicate_class_items) then the item won't be
added if the location has at least one item of the same class."""
if (self.is_inbounds(location)):
if (exclude_duplicate_class_items and
Expand Down Expand Up @@ -523,7 +523,7 @@ class Wall(Obstacle):

class GraphicEnvironment(XYEnvironment):
def __init__(self, width=10, height=10, boundary=True, color={}, display=False):
"""define all the usual XYEnvironment characteristics,
"""define all the usual XYEnvironment characteristics,
but initialise a BlockGrid for GUI too"""
super().__init__(width, height)
self.grid = BlockGrid(width, height, fill=(200,200,200))
Expand All @@ -534,14 +534,14 @@ def __init__(self, width=10, height=10, boundary=True, color={}, display=False):
self.visible = False
self.bounded = boundary
self.colors = color

#def list_things_at(self, location, tclass=Thing): # need to override because locations
# """Return all things exactly at a given location."""
# return [thing for thing in self.things
# if thing.location == location and isinstance(thing, tclass)]

def get_world(self):
"""Returns all the items in the world in a format
"""Returns all the items in the world in a format
understandable by the ipythonblocks BlockGrid"""
result = []
x_start, y_start = (0, 0)
Expand All @@ -552,9 +552,9 @@ def get_world(self):
row.append(self.list_things_at([x, y]))
result.append(row)
return result

"""def run(self, steps=1000, delay=1):
"" "Run the Environment for given number of time steps,
"" "Run the Environment for given number of time steps,
but update the GUI too." ""
for step in range(steps):
sleep(delay)
Expand All @@ -569,33 +569,33 @@ def get_world(self):
self.reveal()
"""
def run(self, steps=1000, delay=1):
"""Run the Environment for given number of time steps,
"""Run the Environment for given number of time steps,
but update the GUI too."""
for step in range(steps):
self.update(delay)
if self.is_done():
break
self.step()
self.update(delay)

def update(self, delay=1):
sleep(delay)
if self.visible:
self.conceal()
self.reveal()
else:
self.reveal()

def reveal(self):
"""display the BlockGrid for this world - the last thing to be added
"""display the BlockGrid for this world - the last thing to be added
at a location defines the location color"""
#print("Grid={}".format(self.grid))
self.draw_world()
#if not self.visible == True:
# self.grid.show()
self.grid.show()
self.visible == True

def draw_world(self):
self.grid[:] = (200, 200, 200)
world = self.get_world()
Expand All @@ -606,14 +606,14 @@ def draw_world(self):
self.grid[y, x] = self.colors[world[x][y][-1].__class__.__name__]
#print('location: ({}, {}) got color: {}'
#.format(y, x, self.colors[world[x][y][-1].__class__.__name__]))

def conceal(self):
"""hide the BlockGrid for this world"""
self.visible = False
display(HTML(''))






Expand Down
Loading