@@ -34,7 +34,7 @@ def successor(self, state):
34
34
35
35
def goal_test (self , state ):
36
36
"""Return True if the state is a goal. The default method compares the
37
- state to self.goal, as specified in the constructor. Implement this
37
+ state to self.goal, as specified in the constructor. Override this
38
38
method if checking against a single self.goal is not enough."""
39
39
return state == self .goal
40
40
@@ -725,10 +725,7 @@ def goal_test(self, state):
725
725
return result
726
726
727
727
def __getattr__ (self , attr ):
728
- if attr in ('succs' , 'goal_tests' , 'states' ):
729
- return self .__dict__ [attr ]
730
- else :
731
- return getattr (self .problem , attr )
728
+ return getattr (self .problem , attr )
732
729
733
730
def __repr__ (self ):
734
731
return '<%4d/%4d/%4d/%s>' % (self .succs , self .goal_tests ,
@@ -748,7 +745,7 @@ def do(searcher, problem):
748
745
def compare_graph_searchers ():
749
746
"""Prints a table of results like this:
750
747
>>> compare_graph_searchers()
751
- Searcher Romania(A,B) Romania(O, N) Australia
748
+ Searcher Romania(A, B) Romania(O, N) Australia
752
749
breadth_first_tree_search < 21/ 22/ 59/B> <1158/1159/3288/N> < 7/ 8/ 22/WA>
753
750
breadth_first_graph_search < 10/ 19/ 26/B> < 19/ 45/ 45/N> < 5/ 8/ 16/WA>
754
751
depth_first_graph_search < 9/ 15/ 23/B> < 16/ 27/ 39/N> < 4/ 7/ 13/WA>
@@ -759,7 +756,7 @@ def compare_graph_searchers():
759
756
compare_searchers (problems = [GraphProblem ('A' , 'B' , romania ),
760
757
GraphProblem ('O' , 'N' , romania ),
761
758
GraphProblem ('Q' , 'WA' , australia )],
762
- header = ['Searcher' , 'Romania(A,B)' , 'Romania(O, N)' , 'Australia' ])
759
+ header = ['Searcher' , 'Romania(A, B)' , 'Romania(O, N)' , 'Australia' ])
763
760
764
761
#______________________________________________________________________________
765
762
0 commit comments