# Best strategy for machine that changes win chance weekly

Imagine you have a machine that you pay 1\$, push a button, and it will randomly give you 2$ (you win) or keep your money (you lose)

Now, the probability for you to win changes every week at the same daytime, and it's chosen randomly as well between 0% and 100% using a uniform distribution (So maybe the first week you have a 37% chance to win on each bet while the next one you have an 87% on each bet), but you don't know this chance the machine has chosen.

What would be the best strategy to win more times that you lose in this case asuming you had infinite money? I don't know how to mathematically analyze this problem, but by intuition I've thought many options. To better understand the examples, I'll set a fixed sequence of wins loses like so: WLLLWLWLWWWL, and put a - in between when a new day starts (this is not random and the outcome will always be the same ofc, but it's for the sake of examples)

• Playing K times every day should give an expected result of same wins as loses over time. We need to play more the weeks that we have a higher chance of winning than those that we have a lower chance. Example sequence: WLL-LWL-WLW-WWL
• Playing everyday many times until we get our first lose should rise the number of wins vs loses, since those weeks with a higher chance we will keep playing while those weeks with a lower chance we'll stop playing when we get a lose. But I don't like that by this method everyday we are guaranteed a lose (because it's the ending point). Example sequence: WL-L-L-WL-WL-WWWL

Then what about playing based on yesterday's result to avoid this guaranteed lose every day? Here's one posible idea, for each day:

• Play 1 time
• If lost, stop playing
• If won, play the number of yesterday's wins, but stop at first lose.

So we get a sequence like: WL-L-L-W-L-W-L-W-WW-L

But at this point I don't know if this strategy is better than the previous, or if there are better strategies... nor I know how to analyze this, or even if it's posible.

• In the presentation, you say the probability $p$ changes weekly, but then you refer to the previous period as 'yesterday' - I assume this is just a confusion ? Jul 27 '17 at 11:30

I think that on a given week, you should keep on playing as long as you have had more wins than losses. For instance after WWWWWL it is very probable (we can actually compute the likelihood) that $p>0.5$, so you better play on.

One simple strategy with infinite expected earns would be to play on as long as |W|>|L|.

With infinite fortune, you may also devote $100$ bets first just to get an estimation of $p$: even if you lost the three first ones, continue for a while, and if you get only 25 wins out of 100 you'll sure stop, but with 65% of wins you should continue.

The problem might be more interesting if you're limited in the number of bets you can do each week (say, 1000). Otherwise the answer will always be to play infinitely many times once you're assume that $p>0.5$.

• Yes, I see the "infinite plays" helps a lot to solve this problem. Because then we just spend a fixed amount every day to run some test to get the chance to win, and if it's greater than 50% just play infinite times. It would be really interesting to know the answer for a cap on 50 plays each week Jul 28 '17 at 7:25

I would sample the machine's probability $p$ over the first six days and spend a hell of money on the last day, if my tests result in a good odd ($p > 70\%$ or such).

You can analyse the strategy of playing until the first loss with a geometric distribution. You should find, by integrating the expected payoff over all possible win probabilities, that if the machine is allowed to give an exactly 100% chance of winning, you can theoretically expect to win infinite money.

Your second strategy is more complicated, as your expected payoff is capped at \$1 more than the previous day (if I understand it correctly). This will only make you more money in the long run if you can expect the next game you play to be a loss more often than a win; since the win probability is uniform on$[0,1]$, this won't be the case. In fact, you can deduce that, if you haven't lost a game yet (which you must to quit without losing in this strategy), the win probability is more likely closer to 100% than to 0% - you can do this because you have the given information that you have won$x$games, the probability of which is$p^{x}$- so the probability density distribution of$p$, given$x$wins, becomes$p^{x}/\int_{0}^{1}q^{x}dq$, which is skewed towards larger$p$. So you're losing out by stopping early. Still, if you want a numeric value for the expectation of your second strategy, you'd need some sort of state variable$x_{n}$, which is the number of times you won on day$n$. Then you'd need to derive the distribution of$\min{(g,x_{n}+1)}$where$g$is geometrically distributed with parameter$p$, and the values from that distribution give$x_{n+1}\$. It's a more complicated strategy, and worse overall than just playing to the first loss.