The problem is like this: Two guy play tennis. If a player has at least A points, and is at least B points ahead of his opponent, that player wins the game.Now given p which is the likelihood of player1 beats player2, we want to know the possibility that player1 winning the game.

original description is here

I already know how to find a approximate solution by using : P(x, y) = P(x-1, y) * p + P(x, y-1) * (1-p)

But how to solve this using equations? I saw some code with clear implementation, but can`t understand how to derive the equation.

Would anyone like to tell me about that? Thanks!