protected override Point _Click(Button button) { Point point = new Point(); point.X = random.Next(button.Width); point.Y = random.Next(button.Height); return point; }
protected override Point _Click(Button button) { double[] coords = ClickButton(0, 0, button.Width - 1, button.Height - 1); return new Point((int)coords[0], (int)coords[1]); }
protected override Point _Click(Button button) { double rx = (button.Width - 1) / 2, ry = (button.Height - 1) / 2; for (int i = 0; i < 10; i++) { Point point = base._Click(button); double nx = (point.X - rx) / rx, ny = (point.Y - ry) / ry; if (Math.Sqrt(nx * nx + ny * ny) < 1.0) return point; } return new Point((int)rx, (int)ry); }
protected abstract Point _Click(Button button);
public Point Click(Button button) { Point point = _Click(button); if (point.X < 0 || point.X > button.Width || point.Y < 0 || point.Y > button.Height) throw new Exception("Point out of bounds"); return point; }
protected override Point _Click(Button button) { /*Point point = new Point(); point.X = random.Next(button.Width); point.Y = random.Next(button.Height); return point;*/ Point center = new Point(button.Width / 2, button.Height / 2); double dir = random.NextDouble() * (2 * Math.PI); double dist = random.NextDouble() * 20; double new_x = center.X + Math.Cos(dir) * dist; double new_y = center.Y + Math.Sin(dir) * dist; //double r = random.NextDouble() + random.NextDouble() - 1; //return new Point(60+(int)(15 * Math.Cos(r)), 25+(int)(15 * Math.Sin(r))); return new Point((int)new_x, (int)new_y); }