Skip to content

Commit

Permalink
Use do_actions() instead of do() in WorkerRushBot
Browse files Browse the repository at this point in the history
  • Loading branch information
merfolk committed Feb 17, 2019
1 parent dd3e7b4 commit 0a779f1
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions examples/worker_rush.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import sc2
from sc2 import run_game, maps, Race, Difficulty
from sc2 import run_game, maps, Race, Difficulty, BotAI
from sc2.player import Bot, Computer

class WorkerRushBot(sc2.BotAI):
class WorkerRushBot(BotAI):
def __init__(self):
super().__init__()
self.actions = []

async def on_step(self, iteration):
self.actions = []

if iteration == 0:
target = self.enemy_start_locations[0]

for worker in self.workers:
await self.do(worker.attack(self.enemy_start_locations[0]))
self.actions.append(worker.attack(target))

await self.do_actions(self.actions)

def main():
run_game(maps.get("Abyssal Reef LE"), [
Expand Down

0 comments on commit 0a779f1

Please sign in to comment.