Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
@ErkCurley

Description

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /