public Point[] getAdjacentPoints(Point p) {
		ArrayList<Point> points=new ArrayList<Point>();
		if (p.x>0) {
			if (p.y>0)
				points.add(map[p.x-1][p.y-1]);
			points.add(map[p.x-1][p.y]);
			if (p.y<HEIGHT-1)
				points.add(map[p.x-1][p.y+1]);
		}
		if (p.y>0)
			points.add(map[p.x][p.y-1]);
		if (p.y<HEIGHT-1)
			points.add(map[p.x][p.y+1]);
		if (p.x<WIDTH-1) {
			if (p.y>0)
				points.add(map[p.x+1][p.y-1]);
			points.add(map[p.x+1][p.y]);
			if (p.y<HEIGHT-1)
				points.add(map[p.x+1][p.y+1]);
		}
		return points.toArray(new Point[0]);
	}