Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve IV calcuation #165

Closed
jancr opened this issue Aug 10, 2016 · 10 comments
Closed

improve IV calcuation #165

jancr opened this issue Aug 10, 2016 · 10 comments
Milestone

Comments

@jancr
Copy link

jancr commented Aug 10, 2016

in the game combat power is scales with attack * defence^0.5 * stamina^0.5

thus it would be nice if this was reflected in the %ivrating% variable
it is my understanding that your current formular is:

iv_percent = (attack + defense + stamina) / 45

a better way would be to use
iv_percent = (attack + defense^0.5 + stamina^0.5) / (15 + 15^0.5 + 15^0.5)

it would be even better if you kept the base pokemon in mind, as a pokemon with natural attack gains less CP from attack than a pokemon with a low natural attack

thus an even better formular would be (b for base):

cp_max =  ((b_attack + 15) * (b_defense + 15)^0.5 * (b_stamina + 15)^0.5 
cp_min =  ((b_attack) * (b_defense)^0.5 * (b_stamina)^0.5
cp_iv = ((b_attack + iv_attack) * (b_defense + iv_defense)^0.5 * (b_stamina + iv_stamina)^0.5
iv_percent = (cp_iv - cp_min) / (cp_max - cp_min) 

also it would be nice if you could introduce an %ivrating_int% variable which does not have the 2 didgets after the comma as they are largely unnecessary and makes the following command fail:

 "%ivrating% %iv%"

Finally it would be nice if there were two versions of %ivrating%, one for the iv rating of the current form and one for the final form (eg %ivrating_final%), at the percentage regresses towards 50% after evolving because it's base stats increase resulting in a relatively smaller contribution of the IVs to the the CP

It would also be nice if arrow up was mapped to the string you previously entered so I don't have to type the same thing over and over :)

*Keep up the awesome work!!!

This is a suggestion/improvement, but I do now know how to mark it as such

@Wolfsblvt
Copy link
Owner

I am not really sure about that. I mean, I really get your point. All your arguments are valid and your suggestions are good...
But do you think normal people would understand what all those different columns would mean?

I mean, we would need a fully detailed explanation on how it gets calculated and why and what it means.
You should create a wiki article about that stuff then lol

I guess it will be good to add that when we have the new UI and have the option to hide columns and make columns that are hidden by default. In that case we can even explain those columns.

So yeah, will be planned for the future.

@Wolfsblvt Wolfsblvt added this to the v0.2.0-Beta milestone Aug 10, 2016
@Wolfsblvt
Copy link
Owner

Wolfsblvt commented Aug 11, 2016

Another sidenote that I thought about. You are suggesting to calculate the IV the way the CP is calculated with the stats.
But wouldn't that show exactly the same values that "Max CP" does already? Sure, you can only sort after the ones you have and don't have something like "90% of the possible max CP", but it's nearly the same.

In that case I don't even have to calculate that how we calculate IV.
There are functions to get the Max CP possible of a Pokemon, and the Max CP of the current Pokemon. Divide them, and we get your value. Am I right?

@Wolfsblvt
Copy link
Owner

I don't see any real value on that column here right now :-/
Or do I understand something wrong?

@jancr
Copy link
Author

jancr commented Aug 12, 2016

In that case I don't even have to calculate that how we calculate IV.
There are functions to get the Max CP possible of a Pokemon, and the Max CP of the current Pokemon. Divide them, and we get your value. Am I right?

Probably

but the reason people are interested in IV is because they want to know whether their Pokemon is stronger than average, to take an extreme example onix have the following base stats:
Base Attack 90
Base Defense 186
Base Stamina 70

python cp formular for onix:

def cp_onix(a, d, s):
    ba = 90
    bd = 186
    bs = 70
    cp_max = (ba + 15) * (bd + 15) ** 0.5 * (bs + 15) ** 0.5
    cp_min = ba * bd ** 0.5 * bs ** 0.5
    cp_iv = (ba + a) * (bd + d) ** 0.5 * (bs + s) ** 0.5
    return (cp_iv - cp_min) / (cp_max - cp_min)

def iv_percent(a,d,s):
    return (a+d+s) / (45.0)

cp_onyx(15, 0, 0) = 0.495
cp_onyx(0, 15, 0) = 0.117
cp_onyx(0, 15, 15) = 0.432

vs

iv_percent(15, 0, 0) = 0.333
iv_percent(0, 15, 0) = 0.333
iv_percent(0, 15, 15) = 0.666

an onyx with 15 attack is stronger than one with 15 stamina and 15 defense in terms of combat power...

My point is this, lets assume a player use the ivrating to evaluate their pokemons and only keep the top 70% pokemons, then they would keep a 2, 15, 15 even though it is average (51% vs 71%) and throw away a 15, 0, 15 even though it is phenomenal (85% vs 67%)

I personally would like to keep my strongest pokemons not the ones with the highest IV's, and I expect that others are the same (though they might not know the math) as websites like https://thesilphroad.com/research returns "cp rating" similar to what I calculate.

I would like to thank you for your patience!

@Wolfsblvt
Copy link
Owner

Thanks for that example, that made it far more clear :D
Real numbers often help.
I'll think about it.

But for checking if you Pokémon is really good, take a look at that merged Pull Request: #213.
It uses the calculation many people online use. Some complicated stuff to have a good overview how good it really is.

@jancr
Copy link
Author

jancr commented Aug 12, 2016

Nice!, I will try to look more into that pull request tomorrow when I have time to parse java to math ;)

While I agree moves are more important than IV, you do not know your moves before you evolve, thus IV's are important in "batch" mode as only 1/x pokemons are evolved, if I have more than 1 pokemon who is fully evolved then I will give much higher weight to the moves than to the IVs, but I would also be willing to do the math by hand when it is a decision between few pokemons, but your application shines when you have a lot of pokemons and you need to transfer all the sucky ones ;)

@Wolfsblvt
Copy link
Owner

Yeah, those calculations are heavy stuff. There should be a reddit post linked, guess that's what you should read there.

I understand the reason for your column now. I will add it soon.

@patrissimo
Copy link

It's tricky because this is an area of active discussion in the community. Basic users may expect sum(IV)/45. But it clutters the display to use other formulas; plus there is no agreement yet on what the formula should be. Like, whether to do a geometric mean, whether to overweight attack power as jancr suggested.

I think it's great to add, but rather than adding an extra column I would make it a preference toggle, check a box for "Advanced IV %" and it changes the calculation. Just a thought.

@jancr
Copy link
Author

jancr commented Aug 13, 2016

That may be an excellent compromise patrissimo, but remember to link it with the %ivrating% variable used for renaming, and please make it only use 2 digets (ie 71 not 71.11) as we only have 12 characters for our pokemon names and 5 characters + a space is a little much for IV information, furthermore it kinda does not make sense to use 4 digets to express something that is basically a scale from 0-45 ;)

keep up the good work awesome people!

@Wolfsblvt
Copy link
Owner

PR is merged, so this is implemented now.
You can find the setting under "settings" in the menu bar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants