veekun / pokedex

more than you ever wanted to know about Pokémon
MIT License
1.45k stars 636 forks source link

Stat Calculator doesn't take maximum IV according to characteristic into account #171

Closed bladeoflight16 closed 8 years ago

bladeoflight16 commented 8 years ago

Here is an example.

Notice three things:

  1. The characteristic is Quick Tempered. This means that all IVs are less than or equal to the Attack IV. (See Bulbapedia.)
  2. The stat calculator has determined that the Special Attack IV is 28.
  3. The stat calculator can't determine whether the Attack IV is 24 or 29.

However, since the characteristic tells us that all IVs mus be less than or equal to the Attack IV, the Attack IV cannot be 24 since this would be lower than the Special Attack IV.

It would be helpful if the stat calculator took this into account and eliminated 24 for the possible IVs automatically. In combination with the Hidden Power calculation, this might narrow down some other IVs as well.

Thanks for the Pokedex and tools!

magical commented 8 years ago

Interesting. The stat calculator is already capable of using the maximum value of the Attack stat gene (in this case) to eliminate larger genes in other stats, but not the other way around.

magical commented 8 years ago

Er, scratch that. It should be doing what you suggest as well https://github.com/veekun/spline-pokedex/blob/master/splinext/pokedex/controllers/pokedex_gadgets.py#L1036. Must be a bug somewhere.

magical commented 8 years ago

If filter_genes was a no-op then the stat calculator would be a lot more broken than it is. Augmented assignment operators like &= can modify a collection in-place in python.

eevee commented 8 years ago

I, uh, seem to have just not done a deploy since that code was added. It works correctly locally.