You pick a random position and a random shot (angle, speed), see where it hits the backboard, and then change the angle of the backboard there to direct the ball through the rim after the bounce. Do this enough times, and you have a surface. (I don't know how the number work out, so there are probably points that have multiple values and surfaces with discontinuities. I guess you average the values at a given point and then smooth the surface, and call that "as good as possible".)