import java.awt.*; import java.util.*; public class Hippie extends Critter { private Random rand; public Hippie() { rand = new Random(); } // always have the munchies public boolean eat() { return true; } // fight randomly public Attack fight(char opponent) { Attack[] actions = { Attack.ROAR, Attack.POUNCE, Attack.SCRATCH }; int num = rand.nextInt(actions.length); return actions[num]; } // choose random psychedelic colors public Color getColor() { Color[] colors = { Color.RED, Color.BLUE, Color.YELLOW, Color.GREEN, Color.MAGENTA, Color.CYAN, Color.ORANGE, Color.PINK }; int num = rand.nextInt(colors.length); return colors[num]; } // wander around aimlessly (just like the real thing!) public Direction getMove() { Direction[] directions = { Direction.NORTH, Direction.SOUTH, Direction.EAST, Direction.WEST }; int num = rand.nextInt(directions.length); return directions[num]; } public char getChar() { return 'X'; } }