Switch rate

Safe of not most of the time this won't affect how you play, some players switch often and others less so, all raising this issue is going to do is make some players rethink when to switch and when not to.
 
This is actually pretty worthwhile and I'm going to be an ass and state that the multitude of the posters here don't get what the hell this all means.

I'll leave AA's terminology out of this for a second and explain something about what he is saying with a practical example. Just assume everything I say about the Pokemon is true.

You are using Snorlax and Salamence. Your opponent is using Starmie and Skarmory. You're in a vicious stall circle:
- Snorlax cannot beat Skarmory ever (there's no last-Poke-Curselax option and it doesn't have a Fire or Electric move)
- Starmie cannot beat Snorlax ever, because it keeps Resting off the damage and does damage back with its STAB move.
- Salamence cannot beat Starmie ever as Salamence does not have a Choice item - it either does less than 50% damage which can be Recovered off, or perhaps it could Dragon Dance up and do more but then it would die to Ice Beam
- Skarmory cannot beat Salamence ever, because it carries no attacks, no Toxic and there's no Stealth Rock (or Spikes/Toxic Spikes for that matter) and Salamence can dispose of it with Fire Blast

So basically, the match is boring. Starmie switches into Salamence, Salamence is switched for Snorlax, who in turn does nothing to the incoming Skarmory, who then gets threatened by Salamence again, etcetera.

But there is actually a breaking point in this match! The side with Starmie will win on average. Why? Because Starmie can freeze Snorlax with Ice Beam. It has 10PP (16 with PP Ups), which means that on average it will freeze once. You could call it "lucky" or "hax" then again it's like having a chance of 1 out of 10 to hit the bullseye with your bow-and-arrow set and repeatedly shooting: it's bound to happen.

Then Snorlax will be frozen and Starmie will march through the last two Pokemon.

Don't have time to apply this to the OP right now but I hope you get a clear idea of what I'm going at.
 

X-Act

np: Biffy Clyro - Shock Shock
is a Site Content Manager Alumnusis a Programmer Alumnusis a Smogon Discord Contributor Alumnusis a Top Researcher Alumnusis a Top CAP Contributor Alumnusis a Top Tiering Contributor Alumnusis a Top Contributor Alumnusis a Smogon Media Contributor Alumnusis an Administrator Alumnus
My mathematical mind couldn't help not find a formula for the switching rate in general.

Assuming:

General case: .5 >= (move accuracy)(1- ((1-crit rate)(1-added effect rate))^switch rate)

we get:

Switch Rate = ceil([log(2*MA-1) - log(2*MA)] / [log(1-CH) + log(1-AER)])

Where MA = move accuracy, CH = crit rate, AER = added effect rate, and ceil(x) is x rounded up.

You can also replace log with ln throughout and the formula above would still work.

Let's give an example:

Perfect accuracy, no added effect moves like Earthquake:

MA = 1, CH = 0.0625, AER = 0.

Switch rate = ceil([log(2*1-1)-log(2*1)]/[log(1-0.0625)+log(1-0)])
= ceil([log(1)-log(2)]/[log(0.9375)+log(1)])
= ceil([0-0.301]/[-0.028+0])
= ceil(-0.301 / -0.028)
= ceil(10.74)
= 11.

This matches with AA's OP.
 
My mathematical mind couldn't help not find a formula for the switching rate in general.

Assuming:

General case: .5 >= (move accuracy)(1- ((1-crit rate)(1-added effect rate))^switch rate)

we get:

Switch Rate = ceil([log(2*MA-1) - log(2*MA)] / [log(1-CH) + log(1-AER)])

Where MA = move accuracy, CH = crit rate, AER = added effect rate, and ceil(x) is x rounded up.
Damn man, you're going for the median. I was going to do the median calculation. You were supposed to make a mistake and go for the mean like most people do.

That should be specifically noted here: X-Act calculated the median, not the mean. The median makes significantly more sense here. Basically, if your switch rate is 5, then you have a 50% chance of hax happening and saving you by the 5th switch.

On the other hand, the mean is how long on the average you will have to switch over a period of many battles... and even then it doesn't really say anything useful.
 
This is actually pretty worthwhile and I'm going to be an ass and state that the multitude of the posters here don't get what the hell this all means.

I'll leave AA's terminology out of this for a second and explain something about what he is saying with a practical example. Just assume everything I say about the Pokemon is true.

You are using Snorlax and Salamence. Your opponent is using Starmie and Skarmory. You're in a vicious stall circle:
- Snorlax cannot beat Skarmory ever (there's no last-Poke-Curselax option and it doesn't have a Fire or Electric move)
- Starmie cannot beat Snorlax ever, because it keeps Resting off the damage and does damage back with its STAB move.
- Salamence cannot beat Starmie ever as Salamence does not have a Choice item - it either does less than 50% damage which can be Recovered off, or perhaps it could Dragon Dance up and do more but then it would die to Ice Beam
- Skarmory cannot beat Salamence ever, because it carries no attacks, no Toxic and there's no Stealth Rock (or Spikes/Toxic Spikes for that matter) and Salamence can dispose of it with Fire Blast

So basically, the match is boring. Starmie switches into Salamence, Salamence is switched for Snorlax, who in turn does nothing to the incoming Skarmory, who then gets threatened by Salamence again, etcetera.

But there is actually a breaking point in this match! The side with Starmie will win on average. Why? Because Starmie can freeze Snorlax with Ice Beam. It has 10PP (16 with PP Ups), which means that on average it will freeze once. You could call it "lucky" or "hax" then again it's like having a chance of 1 out of 10 to hit the bullseye with your bow-and-arrow set and repeatedly shooting: it's bound to happen.

Then Snorlax will be frozen and Starmie will march through the last two Pokemon.

Don't have time to apply this to the OP right now but I hope you get a clear idea of what I'm going at.
 
Hmm, I'd like to see how this formula was derived because I keep getting the feeling that trial and error resulted in this. It's probably just me, though...
 
oh my fucking god why wont it motherfucking postadfla;sdfjka;fa;slfjda;slk ffucking shitanyways, for the third time of me trying to type this and keep getting this not sent throughmekkah your example is probably the worst ever.for one thing, that situation will never happen 99 out of 99.1 times. to have such 'novel' situations to occur owuld mean the limited movesets being used, such as spikesless/swordsdanceless skarmory, in which case its amazing how the situation ever occured to those 2 idiots getting to 2-2.second of all, i dont see how starmie can outspeed salamence, have enough special attack to ohko, and still take less than 50%, it's just impossible
 
Well, both would be nice. Maybe then it'd be possible to come up with a better one. (Then again, it could end up being a moot effort, but I'm not sure...)
 
Still, there is nothing any formula can do to determine the actual battler's sense of switching. Some people might switch out their switch in, switch out a highly damaged poke, etc for whatever reason. There are just too many other factors to put in for this. (aka, many switches can/could be situational)
 

X-Act

np: Biffy Clyro - Shock Shock
is a Site Content Manager Alumnusis a Programmer Alumnusis a Smogon Discord Contributor Alumnusis a Top Researcher Alumnusis a Top CAP Contributor Alumnusis a Top Tiering Contributor Alumnusis a Top Contributor Alumnusis a Smogon Media Contributor Alumnusis an Administrator Alumnus
Well, both would be nice. Maybe then it'd be possible to come up with a better one. (Then again, it could end up being a moot effort, but I'm not sure...)
Okay. Let's start with AA's first.

As AA says:

AA said:
The main presumptions are:

1. The Pokemon being hit is hit while switching in.
2. The Pokemon being hit will lose if either the crit or the added effect happen, even if hit from full health.
Let the probability of a crit happening be CH, and that of the added effect happening be AER. Also, let the probability that the move hits be MA.

We need the average number of turns we can switch into this move so that we have a 50-50 chance (or better) of not getting a CH or an added effect.

In 1 turn, the probability of not getting a crit is 1-CH. In 2 turns, the probability of not getting a crit is (1-CH)*(1-CH) = (1-CH)^2. In general, in n turns, the probability of not getting a crit is (1-CH)^n.

Similarly, the probability of an added effect not happening in n turns is (1-AER)^n.

Hence, the probability of neither a crit nor an added effect happening in n turns is ((1-CH)^n) * ((1-AER)^n). This can be simplified to ((1-CH)(1-AER))^n.

This means that the probability of either a crit or an added effect (or both) happening at least once in n turns is 1 - ((1-CH)(1-AER))^n.

This assumed that the move has 100% accuracy. If the move has accuracy MA, this probability becomes (MA)(1-((1-CH)(1-AER))^n).

We want this probability to be at least 0.5. Hence, we need to find the minimum value of n (which is our switching rate SR) such that this probability does not exceed 0.5:

(MA)(1-((1-CH)(1-AER))^SR) <= 0.5.

And this is AA's formula.

To find SR, I just made SR the subject of the formula.

1-((1-CH)(1-AER))^SR <= 0.5/MA = 1/(2*MA)
1 - (1/(2*MA)) <= ((1-CH)(1-AER))^SR
((1-CH)(1-AER))^SR >= 1 - (1/(2*MA)) = (2*MA-1)/(2*MA)

Taking logs on both sides, we get

log[((1-CH)(1-AER))^SR] >= log[(2*MA-1)/(2*MA)]
SR * log((1-CH)(1-AER)) >= log(2*MA-1) - log(2*MA)
SR * (log(1-CH) + log(1-AER)) >= log(2*MA-1) - log(2*MA)
SR >= [log(2*MA-1) - log(2*MA)] / [log(1-CH) + log(1-AER)]

Since SR must be at least the value of the right hand side, SR's minimum value is thus that value rounded up. Hence:

SR = ceil([log(2*MA-1) - log(2*MA)] / [log(1-CH) + log(1-AER)])
 
oh my fucking god why wont it motherfucking postadfla;sdfjka;fa;slfjda;slk ffucking shitanyways, for the third time of me trying to type this and keep getting this not sent throughmekkah your example is probably the worst ever.for one thing, that situation will never happen 99 out of 99.1 times. to have such 'novel' situations to occur owuld mean the limited movesets being used, such as spikesless/swordsdanceless skarmory, in which case its amazing how the situation ever occured to those 2 idiots getting to 2-2.second of all, i dont see how starmie can outspeed salamence, have enough special attack to ohko, and still take less than 50%, it's just impossible
Please quote me where I said Salamence would OHKO with Fire Blast, because I clearly didn't. Also note that it is merely an example of a completely stale match, made to illustrate my point. I did not say it was a realistic situation at all ever. The point of it was not to show a realistic battle scenario, but merely one where the match would get repetitive to the point where Starmie would be using Ice Beam often enough that Snorlax would have odds against it that it'd get frozen. Which occurs pretty often really, but I just wanted to have a very very stale situation to get the idea across.

Seriously, when I'm going out of my way agreeing with Amazing Ampharos I usually have a good reason for it.
 

Boa1891

Ninja Researcher
is a Researcher Alumnus
Seriously, when I'm going out of my way agreeing with Amazing Ampharos I usually have a good reason for it.
XD

I'd like to see what a crit-boosting item would do to most of those figures (Ice Beam mostly), using X-Act's splendid formula. The boost from neutral to one stage crit is around 50% (8.5% to 12.5%?) if I recall correctly, so that could play havoc on those numbers, especially stacking up with the effect rates. What about Serene Grace Razor Claw Ice Beam, on that note? Pretty wild decrease in the number of "safe" switches, I'd say.
 
@ X-Act

Ah, that makes sense. I wonder if I would've been able to put all of the variables in the right spots had I thought of this... (Ugh, my math's getting out of shape.)

Anyway, thank you. The formula seems to produce decent ballpark figures. I'm compiling an Excel spreadsheet full of formulas to use at my leisure, and I may use that one. I've put in Dragontamer's tiers so that one is not off the table. That reminds me; when I have the time, I do need to put in a good damage calculator...
 
For Serene Grace Razor Claw, the effect rate is 20% and the crit rate is 12.5%. This gives us a switch rate of 2. However, keep in mind the disadvantages you accept. Using the Razor Claw instead of, say, the Life Orb might remove your ability to get a 3HKO which invalidates the whole thing. Losing a trait like Natural Cure could effectively reduce your own ability to switch in which may be a sacrifice not worth making.

I should fix the original post to not suggest that Draco Meteor is 100% accurate.
 
Despite what anyone says, I say this thread is full of win.
Keep up the good work, I think the mind of X-Act is too dangerous to ever dwell in.
 
How would this apply to flinching? As staying in and switching incur the same loss, that is no move and damage done.

In any case carrying moves with extra effects on anything with any amount of endurance has always been a reasonable good idea, and for moves like
Lava Plume and Discharge even moreso as it can always kick in at the right time and save you.
 

X-Act

np: Biffy Clyro - Shock Shock
is a Site Content Manager Alumnusis a Programmer Alumnusis a Smogon Discord Contributor Alumnusis a Top Researcher Alumnusis a Top CAP Contributor Alumnusis a Top Tiering Contributor Alumnusis a Top Contributor Alumnusis a Smogon Media Contributor Alumnusis an Administrator Alumnus
Sorry about that. I only posted that "crazy math" post because it was requested by CardsOfTheHeart.
 
Sorry about that. I only posted that "crazy math" post because it was requested by CardsOfTheHeart.
But Jeebus, that was too insane for my brain. My head asplode. With all of that, I;m not even going to try to make a formula against it. @-@
 

X-Act

np: Biffy Clyro - Shock Shock
is a Site Content Manager Alumnusis a Programmer Alumnusis a Smogon Discord Contributor Alumnusis a Top Researcher Alumnusis a Top CAP Contributor Alumnusis a Top Tiering Contributor Alumnusis a Top Contributor Alumnusis a Smogon Media Contributor Alumnusis an Administrator Alumnus
I was thinking a bit more about AA's formula, and I think that it can be refined a bit.

I think AA's formula is overlooking the fact that if the opponent's move misses, then it will certainly neither crit nor have an added effect.

So the probability that a move neither crits nor have an added effect is (1-MA) + (MA)(1-CH)(1-AER). 1-MA is the probability that the move fails, and (MA)(1-CH)(1-AER) is the probability that the move hits without a CH and an added effect. Basically, I'm saying that, to be able to have a successful switch-in, the move used by the opponent can either miss (1-MA) or (+) hit without critting and without the added effect (MA)(1-CH)(1-AER).

That can be simplified to 1 - P, where P = (MA)(CH + AER - (AER)(CH)). P can be thought of being the probability that the opponent 'gets lucky'.

Hence, I propose to change AA's formula from

(MA)(1 - ((1-CH)(1-AER))^SR) <= 0.5

to

1 - (1 - P)^SR <= 0.5

This gives us the following alternative formula for SR:

SR = ceil(-log(2) / log(1-P))

where P = (MA)(CH + AER - (AER)(CH)) is the probability that the opponent 'haxxes' you.

Note that if P is at least 0.5, then SR = 1. This provides a quick way of determining whether switching in is definitely a bad idea.

I would like AA's input on this.
 
Flinching doesn't really count as an added effect since it does nothing on the switch. Staying in to go for a flinch is a whole new gamble that's beyond this.

I'm looking at the formulas, and I'm running through simple checks. For instance, let's consider Zap Cannon. The formula should return .5 exactly when the switch rate equals one for obvious reasons, and both of our formulas return this value so both pass the sanity test. For Fire Blast, with the assumption that the switch rate is six, mine gives 54.33% and yours gives 57.47%. This seems odd to me since yours is suggesting that the attacker is at an even greater advantage than my formula would suggest, but the logic of what was wrong with my formula was that I was assuming that moves that miss have a chance of getting a critical hit or an added effect. The logic behind your formula seems sound, but the difference between the results is in the opposite direction of what would be expected if my error were assuming that moves that miss can get critical hits or added effects. They both produce a result of 57.24% for Ice Beam's 5 switch rate so clearly the handling of the accuracy is the significant difference.

It's 3 AM, and I'm tired. I can't find anything wrong with your formula, but I feel like I haven't solved the discrepancy. I'll try to resolve the issue tomorrow, and once this is fully clear I'll update the first post, though I don't think it will have much of an effect on the switch rates I listed since our formulas seem prone to yielding similar values. I have a feeling your formula is right; I just need to approach this after a full night's sleep to be able to reason out exactly how it all works out.
 

X-Act

np: Biffy Clyro - Shock Shock
is a Site Content Manager Alumnusis a Programmer Alumnusis a Smogon Discord Contributor Alumnusis a Top Researcher Alumnusis a Top CAP Contributor Alumnusis a Top Tiering Contributor Alumnusis a Top Contributor Alumnusis a Smogon Media Contributor Alumnusis an Administrator Alumnus
I think that the discrepancy is that your formula

(MA)(1 - ((1-CH)(1-AER))^SR) <= 0.5

should have been

1 - ((MA)(1-CH)(1-AER))^SR) <= 0.5

but maybe I'm wrong.
 
X-Act, didn't you find some formula for the effective base power of flinching moves for some Rock Slide vs Stone Edge debate or something ages ago?

While I like the idea of these maths (and again it should be noted that I'm usually the first one to go all out against anything Amazing Ampharos related) I'm afraid that side effects often do not matter. If Alakazam gets a Psychic Special Defense drop on Blissey, no one will care. If Raikou paralyzes the same Blissey with Thunderbolt, no one will care. Only if they really continue to push their luck there's a chance the Pokemon on the offense wins, but those are still slim chances.

However, there are scenarios where this all applies. I prefer just to think: the longer you are on the defense, the higher the chance that you get critted. You can't get away repeatedly Recovering away 40% damage - one time you're going to eat 80%.
 

Deck Knight

Blast Off At The Speed Of Light! That's Right!
is a Forum Moderator Alumnusis a Top CAP Contributor Alumnusis a Top Smogon Media Contributor Alumnus
You know, there is such a thing as too much information.

I really appreciate all the work you guys put into this, but its rather pointless to point to an "OMG FREEZE J00 ARE HACK" n00b you would have beat anyway and say "this formula proves I'm right!"
 

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top