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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started