File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -91,8 +91,7 @@ def expand(self, problem):
91
91
92
92
class SimpleProblemSolvingAgent (agents .Agent ):
93
93
"""Abstract framework for problem-solving agent. [Fig. 3.1]"""
94
- def __init__ (self ):
95
- Agent .__init__ (self )
94
+ def make_agent_program (self ):
96
95
state = []
97
96
seq = []
98
97
@@ -102,12 +101,10 @@ def program(percept):
102
101
goal = self .formulate_goal (state )
103
102
problem = self .formulate_problem (state , goal )
104
103
seq = self .search (problem )
105
- action = seq [0 ]
106
- seq [0 :1 ] = []
107
- return action
108
-
109
- self .program = program
104
+ if not seq : return None
105
+ return seq .pop (0 )
110
106
107
+ return program
111
108
#______________________________________________________________________________
112
109
## Uninformed Search algorithms
113
110
You can’t perform that action at this time.
0 commit comments