public class Turn { public static final int NORTH=90; public static final int SOUTH=270; public static final int EAST=0; public static final int WEST=180; private int x, y, dir; /** * Constructor for objects of class Turn */ public Turn(int x, int y, int dir) { this.x = x; this.y = y; this.dir = dir; } public boolean nearby(int x0, int y0) { return Math.abs(x-x0) + Math.abs(y-y0) < 2.0; } public int getDirection() { return dir; } public String toString() { return "At ["+x + "][" + y + "] turn "+dir; } }