Skip to content

"AssertionError: Units object is empty" if all minerals have been mined #268

@Saloshp

Description

@Saloshp

mf = self.state.mineral_field.closest_to(idle_worker)

When no more mineral fields are left, an assertion exception is thrown

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/sc2/main.py", line 144, in _play_game_ai
    await ai.on_step(iteration)
  File "./main.py", line 500, in on_step
    await self.distribute_workers()
  File "/usr/local/lib/python3.7/site-packages/sc2/bot_ai.py", line 276, in distribute_workers
    mf = self.state.mineral_field.closest_to(idle_worker)
  File "/usr/local/lib/python3.7/site-packages/sc2/units.py", line 163, in closest_to
    assert self, "Units object is empty"
AssertionError: Units object is empty

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions