!7 static int viewSize = 21; static int fps = 100, stepSize = 1; p { Class perimeter = hotwire(#1006786); set(perimeter, size := viewSize); callMainInNewThread(perimeter); int radius = viewSize/2-2; int direction = 0; new MouseMover mover; mover.endAfterInterference = false; mover.blockTimeAfterInterference = 5000; mover.enable(); while licensed { sleep(1000/fps); if (mover.blocked()) continue; Pt p = mousePointer(); Rect area = new Rect(p.x-viewSize/2, p.y-viewSize/2, viewSize, viewSize); BWImage img = shootScreenBW(area); L points = circlePoints(viewSize/2, viewSize/2, radius); final int n = l(points); float[] values = new float[n]; for i to n: values[i] = img.getPixel(points.get(i)); values = cyclicBlur(values); L minima = cyclicLocalMinima(values); if (empty(minima)) continue; final int _direction = direction; direction = lowestAccordingTo(minima, func(int i) { moddistance(i, _direction, n) }); print("n=" + n + ", minima: " + struct(minima) + ", old direction=" + _direction + ", new direction: " + direction); Pt p2 = addPts(p, ptMul(stepSize, oneStepPt(points.get(direction), viewSize/2, viewSize/2))); //print("Moving mouse " + (p2.x-p.x) + "/" + (p2.y-p.y) + " (centroid: " + formatDouble(cx, 2) + "/" + formatDouble(cy, 2) +")"); mover.moveMouseImmediate(p2); } mover.disable(); }