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

Skip to content

Commit 81d1493

Browse files
D-K-Enorvig
authored andcommitted
Minor refactor on a variable name (aimacode#925)
* Added a line to child node `child_node` method of `Node` uses the `problem.result` which returns normally a state not a node according to its docstring in `Problem`. Naming the variable `next_node` can be confusing to users when it actually refers to a resulting state. * Update search.py * Update search.py
1 parent 2207127 commit 81d1493

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

search.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,12 @@ def expand(self, problem):
109109

110110
def child_node(self, problem, action):
111111
"""[Figure 3.10]"""
112-
next_node = problem.result(self.state, action)
113-
return Node(next_node, self, action,
112+
next_state = problem.result(self.state, action)
113+
next_node = Node(next_state, self, action,
114114
problem.path_cost(self.path_cost, self.state,
115-
action, next_node))
116-
115+
action, next_state))
116+
return next_node
117+
117118
def solution(self):
118119
"""Return the sequence of actions to go from the root to this node."""
119120
return [node.action for node in self.path()[1:]]

0 commit comments

Comments
 (0)