|
35 | 35 | removeall, unique, first, argmax, probability,
|
36 | 36 | isnumber, issequence, Expr, expr, subexpressions
|
37 | 37 | )
|
38 |
| -import agents |
| 38 | +from agents import Agent, Glitter, Bump, Stench, Breeze, Scream |
39 | 39 | from search import astar_search, PlanRoute
|
40 | 40 |
|
41 | 41 | import itertools
|
@@ -851,7 +851,7 @@ def __init__(self,dimrow):
|
851 | 851 | wumpus_at_least = list()
|
852 | 852 | for x in range(1, dimrow+1):
|
853 | 853 | for y in range(1, dimrow + 1):
|
854 |
| - wumps_at_least.append(wumpus(x, y)) |
| 854 | + wumpus_at_least.append(wumpus(x, y)) |
855 | 855 |
|
856 | 856 | self.tell(new_disjunction(wumpus_at_least))
|
857 | 857 |
|
@@ -913,7 +913,7 @@ def make_percept_sentence(self, percept, time):
|
913 | 913 | self.tell(percept_scream(time))
|
914 | 914 |
|
915 | 915 | ## Things not perceived
|
916 |
| - for i in len(range(flags)): |
| 916 | + for i in range(len(flags)): |
917 | 917 | if flags[i] == 0:
|
918 | 918 | if i == 0:
|
919 | 919 | self.tell(~percept_glitter(time))
|
@@ -1037,16 +1037,16 @@ def __eq__(self, other):
|
1037 | 1037 | # ______________________________________________________________________________
|
1038 | 1038 |
|
1039 | 1039 |
|
1040 |
| -class HybridWumpusAgent(agents.Agent): |
| 1040 | +class HybridWumpusAgent(Agent): |
1041 | 1041 | """An agent for the wumpus world that does logical inference. [Figure 7.20]"""
|
1042 | 1042 |
|
1043 |
| - def __init__(self): |
1044 |
| - super().__init__() |
1045 |
| - self.dimrow = 4 |
| 1043 | + def __init__(self,dimentions): |
| 1044 | + self.dimrow = dimentions |
1046 | 1045 | self.kb = WumpusKB(self.dimrow)
|
1047 | 1046 | self.t = 0
|
1048 | 1047 | self.plan = list()
|
1049 | 1048 | self.current_position = WumpusPosition(1, 1, 'UP')
|
| 1049 | + super().__init__(self.execute) |
1050 | 1050 |
|
1051 | 1051 |
|
1052 | 1052 | def execute(self, percept):
|
|
0 commit comments