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

Error on max() of empty set when assigning workers. #304

Open
ErkCurley opened this issue Sep 12, 2019 · 0 comments
Open

Error on max() of empty set when assigning workers. #304

ErkCurley opened this issue Sep 12, 2019 · 0 comments

Comments

@ErkCurley
Copy link

ErkCurley commented Sep 12, 2019

In the bot_ai line 386:

target_mineral = max(local_minerals, key=lambda mineral: mineral.mineral_contents)

When the worker runs out of gas at an extraction site it will look for a mineral site to mine from. If none are available the program crashes because it will return an empty set to find the max of.

A simple fix is adding a check for an empty set prior to calling the max function:
if local_minerals:

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

No branches or pull requests

1 participant