Problem 13 (300pts): Slow and Scary Thrower
Implement two final thrower ants that do zero damage, but instead apply a temporary "status" on the action
method of a Bee
instance that they throw_at
. This "status" lasts for a certain number of turns, after which it ceases to take effect.
We will be implementing two new ants that inherit from ThrowerAnt.
SlowThrower
throws sticky syrup at a bee, slowing it for 3 turns. When a bee is slowed, it can only move on turns whengamestate.time
is even, and can do nothing otherwise. If a bee is hit by syrup while it is already slowed, it is slowed for an additional 3 turns.ScaryThrower
intimidates a nearby bee, causing it to back away instead of advancing. (If the bee is already right next to the Hive and cannot go back further, it should not move. To check if a bee is next to the Hive, you might find theis_hive
instance attribute ofPlace
s useful). Bees remain scared until they have tried to back away twice. Bees cannot try to back away if they are slowed andgamestate.time
is odd. Once a bee has been scared once, it can't be scared ever again.
Class | Food Cost | Health | |
---|---|---|---|
SlowThrower | 4 | 1 | |
ScaryThrower | 6 | 1 |
In order to complete the implementations of these two ants, you will need to set their class attributes appropriately and implement the slow
and scare
methods on Bee
, which apply their respective statuses on a particular bee. You may also have to edit some other methods of Bee
.
Before
Before writing any code, read the instructions and test your understanding of the problem:
python ok -q EC -u
After
You can run some provided tests, but they are not exhaustive:
python ok -q EC
Make sure to test your code! Your code should be able to apply multiple statuses on a target; each new status applies to the current (possibly previously affected) action method of the bee.