Skip to content

Comments

Adds -keep_best feature#668

Closed
hahnrobert wants to merge 2 commits intoPokemonGoF:devfrom
hahnrobert:dev
Closed

Adds -keep_best feature#668
hahnrobert wants to merge 2 commits intoPokemonGoF:devfrom
hahnrobert:dev

Conversation

@hahnrobert
Copy link

Always keep the best pokemon!

Whenever you capture a pokemon which you don't already own, it will be kept instead of transfered.
If you already own a weaker version of said pokemon, the weaker one is transferred. If the newly captured one is weaker, it will be transferred instead.

This change does some refactoring and we certainly want to follow up with changes to cleanup the code a little.

@douglascamata
Copy link
Member

@hahnrobert why not add this configuration to release_config.json so it become configurable per pokemon? I mean, I might want to keep the best Pinsir, but who gives a damn about the best Ratata?


def should_release_pokemon(self, pokemon_name, cp, iv, response_dict):
# Returns True if pokemon is better than other_pokemon
def _is_better(self, pokemon, other_pokemon):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A Pokemon isn't better than other pokemon just because it has higher CP. This function name isn't intuitive.

@hahnrobert
Copy link
Author

Let's get this pulled in first and then iterate on top of that.

@douglascamata
Copy link
Member

douglascamata commented Jul 24, 2016

@hahnrobert it's easy to apply this change that I told you. Apply it first, then we merge it. We're walking towards configuration in files, so no need for --keep_best if you configure in release__config.json. We try to keep standards as best as possible so code doesn't become a lot more messy than it already is.

@douglascamata
Copy link
Member

@hahnrobert and btw, remember to add the necessary explanation in README.

def should_release_pokemon(self, pokemon_name, cp, iv, response_dict):
# Returns True if pokemon is better than other_pokemon
def _is_better(self, pokemon, other_pokemon):
return (pokemon['cp'] >= other_pokemon['cp'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be pokemon['cp'] > other_pokemon['cp'] I think, because with = we will have situation like this:

[2016-07-24 23:56:22] [x] Captured Zubat! [CP 52] [IV 0.24]
[2016-07-24 23:56:22] [#] Owning weaker Zubat(52). Replacing it with 52!
[2016-07-24 23:56:23] [#] Weaker Zubat(52) has been exchanged for candy!
[2016-07-24 23:56:23] [x] Captured Zubat! [CP 52]

@mercuriete
Copy link
Contributor

I would like this pull request got merged. :D

@Nihisil
Copy link
Contributor

Nihisil commented Jul 24, 2016

I like it too 👍

@solderzzc
Copy link
Contributor

Please have the conflicts resolved then open :)

@solderzzc solderzzc closed this Jul 25, 2016
@julianwachholz
Copy link

@solderzzc you don't close a PR because it contains merge conflicts. that's counter intuitive. The merge button is disabled anyway as long as there are conflicts but now one can't see them because the PR has been closed.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants