Optimal ball pitching