Simulating game results - impact of win streaks I have a few questions related to the same topic:
Imagine you have a game (e.g. chess), where every time you win you gain some skill rating (SR), and every time you lose, you lose SR. If, however, you go on a winning streak (defined as winninng 2 or more games in a row) the SR you gain from each win increases as a function of how many you've won consecutively up until that point.
Having read multiple forums online, there appears to be 2 common strategies to keep your SR relatively stable and to prevent massive losses of SR during any one gaming session. The two strategies are:


*

*Stop your gaming session as soon as you lose 1 game

*Stop your gaming session as soon as you lose 2 games in a row
My first question is: is it possible to determine which is the better strategy without simulation?
I have tried setting up a basic simulation of this scenario in Python to answer the question empirically. It looks something like this:
num_sessions = 1000000
sr_per_win = 23
sr_per_loss = 23
sr_streak_multiplier = 3

# Stopping after 1 loss
sr_diff_1_loss = []
for i in range(num_sessions):
    cur_sr = 0
    win_streak = 0

    while True:
        game_result = random.randint(0, 1)  # Randomly decide game outcome

        if game_result:  # Win
            cur_sr += (sr_per_win + win_streak * sr_streak_multiplier)
            win_streak += 1
        else:  # Lose
            cur_sr -= sr_per_loss
            break

    sr_diff_1_loss.append(cur_sr)

sr_avg_1_loss = sum(sr_diff_1_loss) / len(sr_diff_1_loss)



# Stopping after 2 losses in a row
sr_diff_2_loss = []
for i in range(num_sessions):
    cur_sr = 0
    win_streak = 0
    lose_streak = 0

    while True:
        game_result = random.randint(0, 1)  # Randomly decide game outcome

        if game_result:  # Win
            cur_sr += (sr_per_win + win_streak * sr_streak_multiplier)
            win_streak += 1
            lose_streak = 0
        else:  # Lose
            cur_sr -= sr_per_loss
            win_streak = 0
            lose_streak += 1

            if lose_streak == 2:
                break

    sr_diff_2_loss.append(cur_sr)

sr_avg_2_loss = sum(sr_diff_2_loss) / len(sr_diff_2_loss)

There are 2 for loops, one for each strategy. Each time you win, you gain 23 SR, each time you lose you lose 23 SR. If you go on a win streak, you gain additional SR (on top of the base 23) which is calculated as 3*number of wins in a row. The game outcome is randomly determined.
I get some strange values when I look at the average SR change due to each strategy. For strategy 1, the average SR change is always equal to the multiplier (3). For strategy 2, average SR change is always equal to 3*multiplier (9). This is true regardless of the multiplier value.
So my second question: is there a reason why the average SR change is always a multiple of the win streak multiplier value? Or is there an error in my code?
 A: Strategy 1: stop your gaming session as soon as you lose 1 game.
Consider $R = (N+1)SR(P(W)-P(L))+M(N-1)$, where


*

*$R$ is the point result after playing a streak of games

*$N$ is the length of the winning streak. Note that the terms are $N-1$, as we stop when there is a loss

*$SR$ is the point change

*$P(W)$ is the probability of winning

*$P(L)$ is the probability of losing

*$M$ is the multiplier


In the random simulation, $P(W) = P(L) = 1/2$, so $R = M(N-1)$.
As $N$ is a geometric random variable with parameter $P(W)$, then the expected value is $1/P(W)$. Therefore, the expected result from strategy 1 is:
$E(R) = M/P(W) - M = 3/(1/2) - 3 = 3$
A: Strategy 2 using Markov Chains


*

*$M$ - multiplier

*$S$ - point change in SR

*$p$ - probability of winning


Model 1: 
Let us have an infinite Markov graph with vertices


*

*$X_{\epsilon}$ - starting state

*$X_0$ - state after 1 loss

*$X_{00}$ - state after 2 losses in a row

*$X_i$ - state after i-th win in a row


Edges have natural probabilities, e.g. we have $X_i \to^{p} X_{i+1}$ and $X_i \to^{1-p} X_0$ and so on.
Now we define $\mu_v$ - expected increase in SR travelling from state $X_v$ to $X_{00}$. We want to calculate $\mu_{\epsilon}$. We have
$$\mu_{00} = 0,\  \mu_0 = p(\mu_1 + S) + (1-p)(-S),\ \mu_{\epsilon} = p(\mu_1 + S) + (1-p)(\mu_0 - S)$$
$$\mu_i = p(\mu_{i+1} + S + iM) + (1-p)(\mu_0 - S),\ i \ge 1$$
Now this is an infinite system of equations. It probably can be solved by some tricky partial formula, but, we can transform it into finite system of equations with infinite sums.
Model 2
Definitions are the same. We have vertices


*

*$X_{\epsilon}$ - starting state

*$X_0$ - state after 1 loss

*$X_{00}$ - state after 2 losses in a row

*$X_1$ - state after 1 win


We define new edges from state $X_1$. 


*

*$X_1 \stackrel{1 - p}\longrightarrow X_0$ with value $-S$

*$X_1 \stackrel{p^i(1-p)}\longrightarrow X_0, \ i \ge 1$ with value $(\sum_{k=1}^{i}kM) + (i - 1)S$


New edges from $X_1$ represent whole paths $X_1 \to X_{11} \to \dots \to X_{1^n} \to X_0$ in the old graph with adequate value. Now we have
$$\mu_{00} = 0,\  \mu_0 = p(\mu_1 + S) + (1-p)(-S),\ \mu_{\epsilon} = p(\mu_1 + S) + (1-p)(\mu_0 - S)$$
$$\mu_1 = \sum_{i \ge 1}[p^i(1-p)(\mu_0 + \sum_{k=1}^{i}kM + (i - 1)S)] - (1-p)S $$
$$\mu_1 = \mu_0 + (1-p)M\sum_{i\ge1}(p^i\frac{i(i+1)}{2}) + S(1-p)\sum_{i\ge1}(p^i(i-1)) - (1-p)S$$
$$\mu_1 = \mu_0 + \frac{Mp}{(1-p)^2} + \frac{Sp^2}{1-p} - (1-p)S$$
And after solving the above with $p = 1/2$ we obtain 
$$\mu_0 = 2M,\ \mu_1 = 4M,\ \mu_{\epsilon} = 3M$$
So the expected gain in SR from starting state is indeed $3M$, for any $S$.
Note: It's important to notice that $\mu_o = 2M$ is twice as much as in strategy 1 and it's no mistake, we model different things.
