Question: b. Write a constructor__init_ (self, heuristic) that constructs a new GreedySearcher object. The constructor should begin by calling the constructor inherited from the superclass this


b. Write a constructor__init_ (self, heuristic) that constructs a new GreedySearcher object. The constructor should begin by calling the constructor inherited from the superclass this will allow that superclass constructor to initialize the inherited attributes. Use the superO function to access the__init_ method in the superclass (as we did in the constructor for the Holiday class from lecture), and pass in a value of -1 to indicate that GreedySearcher objects will not use a depth limit. The new constructor should then initialize a new attribute called heuristic, assigning it whatever value is passed in for the heuristicparameter. This attribute will be used to store a reference to the heuristic function used by the searcher. Once you have implemented the constructor, you can test it as follows: >>>gGreedySearcher(he) GreedySearcher:0 untested, 0 tested, heuristic h0 Note that the string produced by the new__repr__includes the name of the heuristic function used by the searcher
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
