Tom and Jerry 6 points 8 points


constructordef __init__(self, color)
fighting behavioralways constants.SCRATCH
colorthe color passed to the constructor
movement behavioralternates between EAST and SOUTH in a zigzag pattern (first EAST, then SOUTH, then EAST, then SOUTH, and so on)

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.


constructordef __init__(self)
fighting behavioralways constants.ROAR
coloralternates between constants.ORANGE and constants.BLACK (first constants.ORANGE, then constants.BLACK, then …)
movement behaviormoves 3 turns in a row in one random direction (NORTH, EAST, SOUTH, or WEST), then chooses a new random direction and repeats

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 Repeater classes from the Warmup in your implementations, Tiger might be a good opportunity!