mouse.py: 6 points
tiger.py: 8 points
constructor | def __init__(self, color) |
fighting behavior | always constants.SCRATCH |
color | the color passed to the constructor |
movement behavior | alternates between EAST and SOUTH in a zigzag pattern (first EAST , then SOUTH , then EAST , then SOUTH , and so on) |
character | M |
The Mouse
constructor accepts a parameter representing the color in which the Mouse
should be drawn—you’ll likely want to store this information! It should be returned every time the get_color()
method is called on a Mouse
. Note there is no default implementation for get_color()
(or almost any of the methods!) in the Critter
superclass.
As an example, if a Mouse
is constructed with a parameter value of constants.RED
, it should return constants.RED
from its get_color()
method and will therefore appear red on the screen. Remember, the simulation code constructs these mice, so you will have no control over what color each Mouse
receives.
Finally, the get_move()
method is called by the main program each time the critter needs to move; you can use this information to keep track of whether it is time to move east or to move south.
Reminder
Be sure to commit and push your changes after you complete your Mouse.
constructor | def __init__(self) |
fighting behavior | always constants.ROAR |
color | alternates between constants.ORANGE and constants.BLACK (first constants.ORANGE , then constants.BLACK , then …) |
movement behavior | moves 3 turns in a row in one random direction (NORTH , EAST , SOUTH , or WEST ), then chooses a new random direction and repeats |
character | T |
Your Tiger
should change colors every time it moves (i.e., when get_move()
is called by the simulation). If you’d like to use the ContinueMove
class from Lab 7 in your implementations, Tiger
might be a good opportunity! To do this, you can open your Lab 7 submission, create a new file in Lab 8 and copy-paste the code from ContinueMove
into this new file and save it as cmove.py
like we did in Lab 7.
Reminder
Be sure to commit and push your changes after you complete your Tiger.