private Point GetNearbyPixel(Point origin, NearbyPosition relative) { if (LastPoint == origin) { LastPointCount++; //Console.WriteLine("Stuck on {0} for {1} ticks!",origin,LastPointCount); if (LastPointCount > 10) { Random r = new Random(); origin.Offset(r.Next(1), r.Next(1)); return(origin); } } else { LastPointCount = 0; LastPoint = origin; } Point offset = origin; int i = (int)relative; offset.Offset(Directions[i, 0], Directions[i, 1]); return(Clamp(offset)); }
private Point GetNearbyPixel(Point origin, NearbyPosition relative) { if(LastPoint==origin) { LastPointCount++; //Console.WriteLine("Stuck on {0} for {1} ticks!",origin,LastPointCount); if(LastPointCount>10) { Random r = new Random(); origin.Offset(r.Next(1),r.Next(1)); return origin; } } else { LastPointCount=0; LastPoint=origin; } Point offset = origin; int i = (int)relative; offset.Offset(Directions[i,0],Directions[i,1]); return Clamp(offset); }
private int GetNearbyPixel(int origin, NearbyPosition relative) { return(GetArrayIndex(GetNearbyPixel(GetPointFromArrayIndex(origin), relative))); }
private int GetNearbyPixel(int origin, NearbyPosition relative) { return GetArrayIndex(GetNearbyPixel(GetPointFromArrayIndex(origin), relative)); }