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

incubation priority doesn't work, always incubates in order of decreasing distance #306

Open
cantelope opened this issue Aug 14, 2016 · 3 comments
Labels

Comments

@cantelope
Copy link

Expected Behavior

With these settings:
"incubation_fill": true, "incubation_use_all": true, "incubation_priority": ["2km", "5km", "10km"], "incubation_restrict": { "2km": 901 },
I expect 2km eggs to be incubated first and on the unlimited incubater only.

Actual Behavior

10km and 5km eggs were incubated first. As a low level player, I only have the unlimited incubater.

Steps to Reproduce

Set incubation_priority as above.

Other Information

Eggs are always considered in decreasing distance:
eggs_by_distance = sorted(eggs, key=lambda x: x.total_distance, reverse=True)

It seems that the incubation priority is only referenced in:
for egg_distance in bot.config.incubation_priority:

And the egg_distance is only referenced in checking whether there is an egg restriction:
try: egg_restriction = int(bot.config.incubation_restrict[egg_distance])

There's no check whether the distance of the current egg being considered matches the egg_distance.

@wchill wchill added the bug label Aug 14, 2016
@cantelope
Copy link
Author

cantelope commented Aug 14, 2016

Another egg incubation bug. Not sure if related or if i should file separately?

Steps to Reproduce

Ok, I've just leveled up and received limited use incubators (902) as a reward. I've also changed the line
eggs_by_distance = sorted(eggs, key=lambda x: x.total_distance, reverse=True)

into
eggs_by_distance = sorted(eggs, key=lambda x: x.total_distance, reverse=False)
on my copy to attempt to get the eggs to incubate in increasing order.

Expected Behaviour

limited incubators should incubate the 5km egg first, since 2km eggs should only incubate on the unlimited incubater due to "incubation_restrict"

Actual Behaviour

limited incubaters were also filled with 2km eggs.

@wchill
Copy link
Contributor

wchill commented Aug 14, 2016

Probably related.

@xasdf
Copy link

xasdf commented Aug 15, 2016

Rectricting egg type to incubator is also completely wrong.
Below is how I fixed it for me. I'm ignoring config files because I'm not very familiar yml parsing. My desired settings are hardcoded - priority 2km, 10km, 5km, restrict 2km to unlimited.

eggs_by_distance = sorted(eggs, key=lambda x: {2: 0, 10: 1, 5: 2}[x.total_distance])
for egg in eggs_by_distance:
     if len(incubators) == 0:
         log("No more free incubators ({}/{} in use)".format(in_use_count, len(inventory["egg_incubators"])), "yellow")
         return

     egg_restriction = 901 if egg.total_distance is 2 else None
     if egg_restriction is None:
         incubator = incubators.pop()

Something similar should be done but instead this should be read from yml.

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

No branches or pull requests

3 participants