FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Minor refactor on a variable name (#925) · dj5x5/aima-python@201e5f2 · GitHub

Repository navigation

Commit 201e5f2

Browse files
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 0a08b7c commit 201e5f2

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎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)

Back | FazBrowse Home | New Git URL