Question: How do i implement the upper limit class ThrowerAnt (Ant ) : ThrowerAnt throws a leaf each turn at the nearest Bee in its range.
How do i implement the upper limit

class ThrowerAnt (Ant ) : """ThrowerAnt throws a leaf each turn at the nearest Bee in its range. """ name = 'Thrower' implemented = True damage = 1 food cost = 3 def nearest bee (self ) : """Return the nearest Bee in a Place that is not the HIVE, connected to the ThrowerAnt's Place by following entrances. This method returns None if there is no such Bee (or none in range) . # BEGIN Probley 3 and 4 current place = self . place while current place is not None: if not current place. is_hive and current place. bees: return random_bee(current_place . bees) current place = current_place . entrance return None # END Problem 3 and 4
class Thrower Ant (Ant): """ThrowerAnt throws a leaf each turn at the nearest Bee in its range.' name = 'Thrower' implemented = True damage = 1 food_cost = 3 def nearest bee (self): ""Return the nearest Bee in a Place that is not the HIVE, connected to the Thrower Ant's Place by following entrances. This method returns None if there is no such Bee (or none in range). # BEGIN Probl 3 and 4 current_place = self.place while current place is not None: if not current_place.is_hive and current place.bees: return random_bee(current_place.bees) current_place = current_place.entrance return None # END Problem 3 and 4
Step by Step Solution
There are 3 Steps involved in it
To implement an upper limit for the range of the ThrowerAnt you can modify the nearestb... View full answer
Get step-by-step solutions from verified subject matter experts
