elephant.py: 8 points
opposite_elephant.py: 4 points
constructor | def __init__(self, steps) |
fighting behavior | if opponent displays as a Tiger (with the character T ), then constants.ROAR ; otherwise constants.POUNCE |
color | constants.GRAY |
movement behavior | first go SOUTH steps times, then go WEST steps times, then go NORTH steps times, then go EAST steps times (a clockwise square pattern), then repeat |
character | E |
The Elephant
constructor accepts a parameter steps
representing the distance the Elephant
will walk in each direction before changing direction. For example, an Elephant
constructed with a steps
value of 8 will walk 8 steps south, 8 steps west, 8 steps north, 8 steps east, and repeat. You can assume that the value passed for steps
is at least 1.
Reminder
Please commit and push your changes after you complete your Elephant.
constructor | same as Elephant |
fighting behavior | same as Elephant |
color | same as Elephant |
movement behavior | first go EAST steps times, then go NORTH steps times, then go WEST steps times, then go SOUTH steps times, then repeat |
character | O |
Implement OppositeElephant
as a subclass of your Elephant
class. First consider what methods actually need to be different in OppositeElephant
versus Elephant
—you should be able to write very little code to get OppositeElephant
in some sense for “free”! Remember that you will need to import the elephant module into opposite_elephant.py
as your Elephant implementation is in its own file.
ReadMe
Your Elephant
and OppositeElephant
must be defined in their own files. Specifically, Elephant
should be defined in elephant.py
and OppositeElephant
should be defined in opposite_elephant.py
Reminder
Please commit and push your changes before moving on.