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

Skip to content

Commit 1783bc6

Browse files
committed
Fixed bug: CSP.successor misnamed. Added a test for it.
1 parent fac9f8e commit 1783bc6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

csp.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ class CSP(search.Problem):
3838
The following are just for debugging purposes:
3939
nassigns Slot: tracks the number of assignments made
4040
display(a) Print a human-readable representation
41-
"""
41+
42+
>>> search.depth_first_tree_search(australia)
43+
<Node {'Q': 'B', 'T': 'B', 'WA': 'B', 'V': 'B', 'SA': 'G', 'NT': 'R', 'NSW': 'R'}>
44+
"""
4245

4346
def __init__(self, vars, domains, neighbors, constraints):
4447
"Construct a CSP problem. If vars is empty, it becomes domains.keys()."
@@ -98,7 +101,7 @@ def display(self, assignment):
98101

99102
## These methods are for the tree and graph search interface:
100103

101-
def succ(self, assignment):
104+
def successor(self, assignment):
102105
"Return a list of (action, state) pairs."
103106
if len(assignment) == len(self.vars):
104107
return []

0 commit comments

Comments
 (0)