Basketball shots and stopping rule You are taken to play a basketball game where you can shoot basketballs at n slots using a machine that is equally likely to shoot the balls into those n slots. You can stop whenever you see fit and get a reward based on your performance. For every slot with only one ball, you get \$1, for every slot with k balls ($k>1$), you lose $k, empty slots don't count. What's your strategy to maximize your reward and what will your maximum reward be?
My idea was that you'd stop when your current wealth was higher than the expectation of your wealth if you kept going. And I got $n\le 2m$, where $m$ is the number of nonempty slots. But I'm having trouble getting the maximum reward.
Edit:
Thanks to Barry's comment, I missed out on the special slots with only one ball. But Barry seemed to have misinterpreted the question. The question was meant to say the game pays you only at the END rather than at every step. (But I think that would be an interesting variation to this question.) Taking into account the slots with only one balls and using the same stopping rule, I got $n\le2x_1+4x_2$, where $x_1$ and $x_2$ are numbers of slots with one ball and more than one ball, respectively.
The maximum reward still needs to be calculated though.
 A: The maximum reward is simple to calculate once you have the formula when to quit. Taking Barry's solution and substituting $e$ with $n - o - s$ results in $n < 4o + 2s$ 
The maximum reward you will get when you never hit a slot more than once, thus $s = 0$.
This leads to the function for the maximum of the reward of 
$\lceil(n + 1)/4\rceil$
If you have up to three slots you would only play once and the maximimum would be one. If you have four, five, six or seven slots you would play twice thus the maximum would be two and so on. 
An additional note: You should not stop once the expected return is zero, because the next throw might have a positive return. As example when you have four slots and you have thrown one ball you should not quit even though the expected payout is zero. In the case you are unlucky and hit the slot with the one ball you have a game with a positive net payout: three slots will give you one dollar and one slot looses one dollar. 
A: Here's an answer for when to quit. (But please note the addendum.)
You can think of the game as paying out at the end of each shot, giving you \$1 if you hit an empty slot, taking \$3 if you hit a slot that's got just one ball already in it, and taking \$1 if you hit a slot that's got two or more balls already in it.  If there are $e$ empty slots, $o$ slots with one ball, and $s$ slots that are stuffed with two or more balls, so that $e+o+s=n$, then the expected payout for the next shot is $(e-3o-s)/n$.  You should quit if $e\lt3o+s$.  
(A mea culpa note:  The OP pointed out an error in the initial version of this answer.  I mistakenly thought hitting a one-ball slot should only cost \$2.  Thinking through an example or two shows it should be \$3.)
Added 7/31/14:  Henry has made a very good point in comments:  It is not so obvious after all that one should necessarily quit as soon as $e\lt3o+s$.  
For example, if $n=7$ and you are in the state $(e,o,s)=(5,2,0)$, so that the expected payoff for the next shot is $(5-6-0)/7=-1/7$, the worst that can happen if you do take that shot is that you pay a \$3 penalty and wind up in the state $(5,1,1)$.  But that states gives you a positive expected value, $(5-3-1)/7=1/7$ for the shot after that, which means you should certainly take another shot, and possibly another one after that, depending on the outcome.  
What needs to be shown is that the positive expected values in the tree of subsequent possibilities are insufficient overcome that initial \$3 penalty.   It's not too hard to do this for this particular example ($n=7$), but I've yet to see how to show it in general.  Maybe someone else can explain what makes it obvious -- if indeed it's true at all....
