Optional 1: Ninja

Implement the NinjaAnt, which damages all Bees that pass by, but can never be stung.

ClassFood CostHealth
Ninja51

A NinjaAnt does not block the path of a Bee that flies by. To implement this behavior, first modify the Ant class to include a new class attribute blocks_path that is True by default. Set the value of blocks_path to False in the NinjaAnt class.

Second, modify the Bee's method blocked to return False if either there is no Ant in the Bee's place or if there is an Ant, but its blocks_path attribute is False. Now Bees will just fly past NinjaAnts.

Finally, we want to make the NinjaAnt damage all Bees that fly past. Implement the action method in NinjaAnt to reduce the armor of all Bees in the same place as the NinjaAnt by its damage attribute. Similar to the FireAnt, you must iterate over a list of bees that may change.

Hint: Having trouble visualizing the test cases? Try drawing them out on paper! See the example in Game Layout for help.

Before

Before writing any code, read the instructions and test your understanding of the problem:

python ok -q optional1 -u

After

After writing code, test your implementation:

python ok -q optional1

For a challenge, try to win a game using only HarvesterAnt and NinjaAnt.