If you watch some youtubers or twitch streamers play competitive Pokemon, you will often hear phrases like this, after they made a choice that resulted in a bad outcome for them:

Wow, my opponent is such a ****head, why did he klick Earthquake in front of my Zapdos. He’s such a bad player! And now I lose.

Or, if he is not quite as easy to lose his temper:

Ok, I don’t agree with this play at all. He should really have protected that turn.

What’s going on here? Why do they think their opponent made a bad play if it resulted in a favorable outcome for them?

Often the answer to that is that the opponent made a very risky play that could have put him at a huge disadvantage. Let’s look at an example:

You lead your timid Nihilego against the opponents Charizard. Nihilego is guaranteed to outspeed and 0HKO with Power Gem, so you put huge pressure on the Charizard to switch out. You predict the switchout and set Stealth Rocks. But you made the wrong prediction: You can set up the Stealth Rocks but Nihilego gets 0HKOed with Outrage and you lose your only Charizard check.

Was it the wrong decision to klick on Stealth Rocks? Of course, in hindsight it was, but let’s look at it from a game-theoretic standpoint and make a payoff-matrix:

```
+--------------+------------+---------+
| | Switch Out | Outrage |
+--------------+------------+---------+
| Power Gem | 55% | 70% |
+--------------+------------+---------+
| Stealth Rock | 60% | 20% |
+--------------+------------+---------+
```

The numbers in the table are your estimated chances of winning the game after you and your opponent made their move choices and the turn ended. You now see that setting up Stealth Rocks was a rather risky choice. If you attacked with Power Gem you could have hurt the switch in or even 0HKOed the Charizard and got a Beast Boost from it. Setting up Stealth Rock would have been a little bit better than attacking if the opponent switched out, but a terrible decision if he decided to stay in.

So should you always attack in this situation? Should your opponent always switch out? But if your opponent always switches out, shouldn’t you always set up Stealth Rock?

## Nash Equilibria

Fortunately, there is a solution to this problem. You can adopt what’s called a mixed strategy. Most of the time you just attack with Power Gem, but sometimes you surprise your opponent with setting up Stealth Rock. Your opponent should do the same: Switch out most of the time, but sometimes attack with Outrage.

But what does sometimes mean? How often should you attack exactly? There are two things here that should influence your thought process. The first one is figuring out the psychology of your opponent and reacting accordingly. A player very low on the ladder might for example not know that Nihilego can attack with Power Gem and always stay in. Or you might know the player from previous matches for his very risky playstyle.

The other one is that you should try to hit what’s called a Nash equilibrium. Let’s look at the informal definition from Wikipedia:

Informally, a strategy profile is a Nash equilibrium if no player can do better by unilaterally changing his or her strategy

So if your opponent knows your strategy (attacking x% of the time) but can not exploit this knowledge to increase his odds of winning, then that’s a Nash equilibrium.

We can calculate the percentage of times you should attack by taking the payoff matrix into account. Let *q* be the percentage of time that your opponent chooses to switch out and E[x] the expected value of x.

* E[Chance of winning by attacking with Power Gem] = (55%)q + (70%)(1−q) = 70% – 15%q*

* E[Chance of winning by setting up Stealth Rocks] = (60%)q + 20%(1−q) = 20% + 40%q*

* E[Chance of winning by attacking with Power Gem] = E[Chance of winning by setting up Stealth Rocks]*

*⇒ 70% – 15%q = 20% + 40%q*

*⇒ q = ~91%*

So the opponent should switch out ~91% of the time and you should set up Stealth Rocks only ~9% of the time and attack ~91% of the time.

## What’s the takeaway?

While this is certainly the mathematically optimal way to solve this problem, it’s rarely very practical to whip out your calculator in the heat of a Pokemon battle and then use a random number generator that tells you what you should do. I certainly haven’t seen anyone attempt this. And you will probably be just as good if you just follow your hunches in such situations.

However, it would be really nice if this knowledge would spread in the competitive community and we could replace:

Wow, my opponent is such a ****head

with

Wow, my opponent made a risky play

or even:

I think my opponent should only attack about 10% of the time in such a situation. This was really bad luck for me.

By the way, if you are an avid Pokemon player you might have noticed that I simplified the battle scenario a little bit. Charizard has two different mega evolutions Charizard X, and Charizard Y and only Charizard X will kill Nihilego with Outrage.

In the next blog post, I will show you, how you can predict what mega evolution your opponent has by using Baye’s theorem. The hype is real!