Question: Write a constructor __init__(self, depth_limit) that constructs a new Searcherobject by initializing the following attributes: an attribute states for the Searchers list of untested states;

Write a constructor __init__(self, depth_limit) that constructs a new Searcherobject by initializing the following attributes:

an attribute states for the Searchers list of untested states; it should be initialized to an empty list

an attribute num_tested that will keep track of how many states the Searcher tests; it should be initialized to 0

an attribute depth_limit that specifies how deep in the state-space search tree the Searcher will go; it should be initialized to the value specified by the parameter depth_limit. (A depth_limit of -1 will be used to indicate that the Searcher does not use a depth limit.)

Because weve already given you an __repr__ method for the class, you should be able to test your constructor as follows:

>>> searcher1 = Searcher(-1) # -1 means no depth limit >>> searcher1 Searcher: 0 untested, 0 tested, no depth limit >>> searcher2 = Searcher(10) >>> searcher2 Searcher: 0 untested, 0 tested, depth limit = 10

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!