// CSE 142 Summer 2008, Helene Martin // // The DrunkenFratGuy Critters choose a random place for a party and all meet there. import java.util.*; public class DrunkenFratGuy extends Critter { // The static keyword makes these fields shared between all DFG objects // Without it, all DFGs go to different parties! private static int partyX; private static int partyY; public DrunkenFratGuy() { Random r = new Random(); partyX = r.nextInt(60); partyY = r.nextInt(50); } // First, move north until Y-coordinate matches party's // Then, move east until X-coordinate matches party's // Stay at party public Direction getMove() { if(getY() != partyY) { return Direction.NORTH; } else if(getX() != partyX) { return Direction.EAST; } else { return Direction.CENTER; } } }