One detail that was missing from the question is what abilities both Pokémon have. Assuming standard abilities (i.e., Shadow Tag for Wobbuffet and Natural Cure or Serene Grace for Chansey), these do not have any effect on the battle.
I model this as a concurrent reachability game for which winning strategies for reachability games were characterized in the seminal paper by de Alfaro et al.. I view this from Chansey's perspective, so "reachability" in this sense means reaching a state where Wobbuffet fainted.
I first want to discuss the assumption
Both trainers are perfect trainers who behave logically and rationally
Now in concurrent games it is not always clear how this is to be interpreted but the most common waay is to define the optimal strategy as the strategy that maximizes the winning probability under a worst-case assumption over the opponent's strategy. Formally, the optimal strategy for player A is
$$ \text{arg}\max _{\sigma_A}\min_{\sigma_B} P_{win}(\sigma_A,\sigma_B)$$
where $\sigma_X$ is the set of strategies for player X and $P_{win}(\sigma_A,\sigma_B)$ is the probability of player A winning.
Another way of viewing this, is that your strategy needs to be so robust that even if you tell your opponent exactly what you will do, they cannot decrease your winning probability.
While this may seem counterintuitive at first, there is on way to achieve this: using probabilistic strategies. A very basic example is rock-paper-scissors. If I had some deterministic strategy, no matter how intricate, if you knew my strategy you could always compute my next move and counter it. If I tell you my strategy is to just choose randomly, there is nothing you can do to increase your odds of winning (or a draw) above 1/3.
Analogy to formal literature:
If Chansey's Counter and Wobbuffet's Splash had infinite PP, this would be equivalent to the Hide-Or-Run example from de Alfaro et al. (left as an exercise for the reader ;)) and Chansey would have a limit-sure winning strategy (i.e., for each $\epsilon$ there is a strategy for which Chansey wins with probability $1-\epsilon$.
But unfortunately we have PP's which make it a lot harder to compute...
but we can encode the PP's in the state space. Naively, we can define a state by both Pokémon's HP all move's PP. This yields $611*491*21*21*41*21$ states (many unreachable tho). Now we will reduce the state space a bit and define states in which some player definitely wins.
First observation:
As @Aura commented, Chansey always wins after 5 Seismic Toss hits, or Wobbuffet wins after 4 counter hits. This means we do not need to keep track of the exact HP but only the number of Seismic Tosses/Counters hit.
Second observation:
If Chansey hits a single Seismic Toss that is not countered, Chansey wins. That is because it can just survive 3 more countered Seismic Tosses and the fifth Seismic Toss kills Wobbuffet before it has the chance to Counter. This means we do not need to keep track of the number of Seismic Toss hits, just the Counter hits.
Third observation:
The battle definitely ends after five seismic tosses of Chansey, so we do not need to keep track of Seismic Toss PP either. Additionally, this means the battle last for at most 25 turns. In particular, this means we do not need to keep track of Splash's PP either.
This means we acn fully characterize the battle by defining states according to the following variables:
Number of counters hit so far (0-3), Counter PP of both Pokémon (0-20 each), resulting in $4*21*21=1764$ states. Additionally, we introduce a "Chansey win" state that is reached whenever Chansey uses Seismic Toss and Wobbuffet uses Splash. Additionally, we need to consider the special case when one of the counter PP's reaches 0. If Wobbuffet's Counter PP reach 0, Chansey automatically wins (by assumpion Chansey must have 5 Seismic Toss PP left, otherwise the battle would be long over). If Chansey's counter PP reach 0, Chansey can still win as long as the number of counters hit so far plus the number of counters left on Wobbuffet is less than 4. So from all these states we always to to "Chansey win". From all other 0 PP states we know Wobbuffet wins. We can extend this even further by saying that if Chansey has less counter PP than Wobbuffet and the difference is large enough that Wobbuffet can use the leftover counter PP to win (i.e. Wobbuffet PP >= Chansey PP + number of required counter hits), Wobbuffet wins 100% of the time by just spamming counter.
From here, for notation
I will use triples $(a,b,c)$ to denote states where $a$ is the number of counters hit so far, $b$ Chansey's counter PP and $c$ Wobuffet's counter PP. We want to compute the winning probability under the optimal strategy for Chansey, which I will denote $P(a,b,c)$. Also for moves I will use tuples $(X,Y)$ where $X$ is Chansey's move and $Y$ is Wobbuffet's move and abbreviate moves with S or C.
Now let's try to solve this. We define this recursively.
For each turn have four outcomes: (S,S) always leads to Chansey win. (S,C) leads to a state where Wobbuffet has one counter less, but we increase the counter hit variable by 1. (C,S) and (C,C) leads to states where the hit counter is decreased. If we denote the probability of Chansey using Seismic Toss as $p_{st}$ and the probability of Wobbuffet using splash as $p_{sp}$ we have, recursively,
\begin{align*}
P(a,b,c) = & p_{st}p_{sp} * 1 + \\
& p_{st}(1-p_{sp}) * P(a+1,b,c-1) + \\
& (1-p_{st})p_{sp} * P(a,b-1,c) + \\
&(1-p_{st})(1-p_{sp}) * P(a,b-1,c-1)
\end{align*}
and additionally the discussed base cases ($P(4,b,c)=0$ and $P(a,b,0)=1$ etc).
Fortunately, we can solve this...
with a bottom-up approach since each variable is monotonically recursive (which makes sense as Pokémon cannot gain PP here and we cannot "un-make" counter hits). This means there is always some $P(a,b,c)$ for which we already know all the recursive cases ($P(a+1,b,c-1)$ and $P(a,b-1,c)$ and $P(a,b-1,c-1)$) In each of these equations we have to find the value $p_{st} \in [0,1]$ that maximizes $P(a,b,c)$ when $p_{sp}$ is picked adversarially. This means we first find the value of $p_{sp}$ that minimizes $P(a,b,c)$ dependent on $p_{st}$, and then find the value of $p_{st}$ that maximizes $P(a,b,c)$.
To solve this subtask...
notice that $P(a,b,c)$ is entirely linear in $p_{sp}$. We can see this by expressing it as
\begin{align*}
P(a,b,c) = & p_{sp} \Big(p_{st} - p_{st}P(a+1,b,c-1) - +P(a,b-1,c) p_{st}P(a,b-1,c)-P(a,b-1,c-1) + p_{st}P(a,b-1,c-1) \big) \\
& +p_{st}P(a+1,b,c-1)-p_{st}P(a,b-1,c-1)+P(a,b-1,c-1)
\end{align*}
where we can simply read off the slope $p_{st} - p_{st}P(a+1,b,c-1) - +P(a,b-1,c) p_{st}P(a,b-1,c)-P(a,b-1,c-1) + p_{st}P(a,b-1,c-1)$. If this is negative, $p_{sp}=0$ is optimal for Wobbuffet, if it is positive $p_{sp}=1$ is optimal, and if it is zero, it does not matter. In any case, we now that (at least one) optimal strategy for Wobbuffet that is adversarial to our Chansey strategy is always deterministic. This means we only need to consider two cases:
\begin{align*}
P_{sp=0}(a,b,c) =
& p_{st} P(a+1,b,c-1) + \\
&(1-p_{st}) * P(a,b-1,c-1) \\
P_{sp=1}(a,b,c) = & p_{st}+ \\
& (1-p_{st}) * P(a,b-1,c)
\end{align*}
We want to find a $p_{st}$ such that $\min \{P_{sp=0}(a,b,c),P_{sp=1}(a,b,c)\}$ is maximized. For this, we again start by noticing that both are linear in $p_{st}$.
\begin{align*}
P_{sp=0}(a,b,c) = & p_{st} (P(a+1,b,c-1)-P(a,b-1,c-1)) + P(a,b-1,c-1) \\
P_{sp=1}(a,b,c) = & p_{st} (1-P(a,b-1,c)) + P(a,b-1,c)
\end{align*}
For $P_{sp=1}$ it is clear that the slope $1-P(a,b-1,c)\geq 0$. On the other hand, for $P_{sp=0}$ it is not immediately clear. The slope $P(a+1,b,c-1)-P(a,b-1,c-1)$ might be positive or negative. If it is positive, both terms are positively correlated with $p_{st}$ and as such $p_{st}=1$ maximizes both terms (and hence also their minimum). If the slope is negative, the maximum of $\min \{P_{sp=0}(a,b,c),P_{sp=1}(a,b,c)\}$ is the point where $P_{sp=0}(a,b,c)=P_{sp=1}(a,b,c)$ as otherwise we could nudge $p_{st}$ s.t. the smaller term becomes larger. Solving this we get
$$ p_{st}=\frac{P(a,b-1,c-1)-P(a,b-1,c)}{1-P(a+1,b,c-1)+P(a,b-1,c-1)-P(a,b-1,c)} $$
And with that we are basically done and it's down to crunching numbers.
Summary of the method
To compute $P(a,b,c)$ recursively, do the following steps:
- compute $p_{st}$. If $P(a+1,b,c-1)-P(a,b-1,c-1)\geq 0$, set it to $1$, otherwise use formula above.
- check which of $p_{sp}=0$ and $p_{sp}=1$ minimizes $P(a,b,c)$ for the computed $p_{st}$
- save $P(a,b,c)$ as the minimized value
This is easy to automate. I wrote this small Python script:
values = dict()
# initialize table
for num_counters in range(5):
values[num_counters] = dict()
for chansey_pp in range(21):
values[num_counters][chansey_pp] = dict()
for wobbuffet_pp in range(21):
if num_counters == 4:
values[num_counters][chansey_pp][wobbuffet_pp] = 0
elif wobbuffet_pp + num_counters < 4:
values[num_counters][chansey_pp][wobbuffet_pp] = 1
elif chansey_pp == 0:
values[num_counters][chansey_pp][wobbuffet_pp] = 0
else:
values[num_counters][chansey_pp][wobbuffet_pp] = None
# find value s.t. all recursive values are known
while values[0][20][20] is None:
for num_counters in range(5):
for chansey_pp in range(21):
for wobbuffet_pp in range(21):
if values[num_counters][chansey_pp][wobbuffet_pp] is not None:
continue
if (values[num_counters+1][chansey_pp][wobbuffet_pp-1] is not None) \
and (values[num_counters][chansey_pp-1][wobbuffet_pp] is not None) \
and (values[num_counters][chansey_pp-1][wobbuffet_pp-1] is not None):
print(f"computing ({num_counters}, {chansey_pp}, {wobbuffet_pp})")
x1 = values[num_counters+1][chansey_pp][wobbuffet_pp-1]
x2 = values[num_counters][chansey_pp-1][wobbuffet_pp]
x3 = values[num_counters][chansey_pp-1][wobbuffet_pp-1]
slope = x1 - x3
p_st = 1 if slope >= 0 else (x3-x2)/(1-x1+x3-x2)
p_sp0 = p_st * x1 + (1-p_st) * x3
p_sp1 = p_st + (1-p_st)*x2
values[num_counters][chansey_pp][wobbuffet_pp] = min(p_sp0, p_sp0)
print(f"optimal strategy with {p_st=} and p_sp={1 if p_sp1>p_sp0 else 0} "
f"resulting in value {values[num_counters][chansey_pp][wobbuffet_pp]}")
Final result
The probability of Chansey winning this battle is
around 54.4% (or 0.5440429136081311 +- some float imprecisions along the way)
A potential shortcut that seems to hold but which I could not complete an argument for is
that in order to optimize $p_{st}$ we have to find a value for it such that the choice of $p_{sp}$ does not matter. This goes back to the idea, that our strategy would still work if we told the opponent what we had planned. However, I was not able to show that this indeed maximizes the winning probability, e.g., I could not prove that there cannot be a situation where for some $p_{st}$ we have $P(a,b,c)=0.5$, regardless of $p_{sp}$, but for some other $p_{st}$ we have $P(a,b,c)$ between $0.6$ and $0.8$ depending on $p_{sp}$. However, I say this seems to hold however, since in the final solution I computed $P_{sp=0}(a,b,c)=P_{sp=1}(a,b,c)$ always holds. Afterwards I also noticed that computing a $p_{st}$ such that $P_{sp=0}(a,b,c)=P_{sp=1}(a,b,c)$ boils down to the exact same computation.
One weird thing I have noticed is that
The optimal probability of Chansey using Seismic Toss is always $\frac{\text{# needed counters}}{\text{# needed counters}+\text{Chansey counter PP}}$ where # needed counters just means 4 minus the number of counters Wobbuffet already hit. Now this somehow makes sense. Whenever Chansey still has a lot of counter PP if can afford to be patient, so the Seismic Toss probability is smaller. If Wobbuffet still needs a lot of counters, Chansey can afford to play more risky, so the Seismic Toss probability is larger. However I was very surprised to see that this seems to be completely independant of Wobbuffet's counter PP. I have not found a line of reasoning that explains this but the results seem sensible overall, so I also do not see any obvious mistake. Maybe someone else can add to this.