Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I'm designing a Pong clone but am doing some experimental AI.

What I need to solve is this:

Assuming both paddles are stationary and excluding any walls:

The probability of a ball hitting one of the paddles at any position on the paddle, bouncing off at any arbitrary angle within the hemisphere of the normal of the paddle, and hitting the other paddle. In other words, out of all possible bounces off of the initial paddle, theoretically how many of those would hit the other paddle?

Is this possible to calculate? If so, can it be deduced to an equation?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

Suppose we are in an arena of height $H$ and width $L$, with paddles of width $w$ parallel to the height on either side. I'll try to attach a picture in just a bit. Suppose that we shoot a ball (that's infinitely small, a point) at a uniformly random angle $\theta\in[0,\pi]$ from the left paddle to the right paddle. Specifically, suppose that we shoot the ball from a height $h$ off the left side, and we are trying to hit a paddle of width $w$ on the right side, whose center is at height $p$ off the bottom wall.

First, let's consider directly hitting the paddle without bounces. To find the range $\Theta$ of hitting angles, notice that we get a triangle formed with height $L$ and width $w$. Using the two formulas we know for the area of a triangle, we get:

$\frac{Lw}{2}=\frac{r_1r_2\sin(\Theta)}{2}$

where $r_1=\sqrt{L^2+(h-(p-w/2))^2}$ and $r_2=\sqrt{L^2+(h+(p-w/2))^2}$, where we can now solve for $\Theta$ giving:

$\Theta=\arcsin\left(\frac{Lw}{r_1r_2}\right)$.

Now we need to figure out all other possible ways to hit the paddle, with bounces. This becomes easy if we stack arena's one atop the other in a periodic fashion, where we see that hitting the paddle is equivalent to crossing arena's. In other words, we need to find $\theta$ angles which hit paddles centered at $p+kH$ where $k\in\mathbb{Z}$. The idea is exactly the same as before, and we get:

$\Theta_k=\arcsin\left(\frac{Lw}{r_1(k)r_2(k)}\right)$

where now every instance of $p$ in the definition of $r_1,r_2$ is replaced by $p(k)=p+kH$. Thus the probability of hitting the paddle will be the sum over all these chunks (convince yourself that they are disjoint geometrically) normalized by $\pi$:

$\frac{\sum_{k=-\infty}^\infty\Theta_k}{\pi}$

which I am not sure how to further simplify...

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.