Nesting/relocating the drone selection block in the spawning pool conditional body was not mentioned in the tutorial, and visually unclear from code.
While it makes sense we wouldn't want to keep selecting drones, with 2-space indentations, lots of wrapped lines, and no mention, if you're not copy pasting the tutorial code, it's possible you might miss the change. I think it would be nice to make that change more explicit.
spawning_pools = self.get_units_by_type(obs, units.Zerg.SpawningPool)
if len(spawning_pools) == 0:
if self.unit_type_is_selected(obs, units.Zerg.Drone):
if (actions.FUNCTIONS.Build_SpawningPool_screen.id in
obs.observation.available_actions):
x = random.randint(0, 83)
y = random.randint(0, 83)
return actions.FUNCTIONS.Build_SpawningPool_screen("now", (x, y))
drones = self.get_units_by_type(obs, units.Zerg.Drone)
if len(drones) > 0:
drone = random.choice(drones)
return actions.FUNCTIONS.select_point("select_all_type", (drone.x,
drone.y))
if self.unit_type_is_selected(obs, units.Zerg.Larva):
if (actions.FUNCTIONS.Train_Zergling_quick.id in
obs.observation.available_actions):
return actions.FUNCTIONS.Train_Zergling_quick("now")
larvae = self.get_units_by_type(oba, units.Zerg.Larva)
if len(larvae) > 0:
larva = random.choice(larvae)
return actions.FUNCTIONS.select_point("select_all_type", (larva.x,
larva.y))
Nesting/relocating the drone selection block in the spawning pool conditional body was not mentioned in the tutorial, and visually unclear from code.
While it makes sense we wouldn't want to keep selecting drones, with 2-space indentations, lots of wrapped lines, and no mention, if you're not copy pasting the tutorial code, it's possible you might miss the change. I think it would be nice to make that change more explicit.