public boolean obstacle_ahead (final Room room) { int xTest = 0; int yTest = 0; if (direction == Robot.NORTH) { xTest = x; yTest = y + 1; } else if (direction == Robot.SOUTH) { xTest = x; yTest = y - 1; } else if (direction == Robot.EAST) { xTest = x + 1; yTest = y; } else { xTest = x - 1; yTest = y; } return (room.isObstacle (xTest, yTest)); }