-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFirstBot.py
30 lines (26 loc) · 1.05 KB
/
FirstBot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import sc2
from sc2 import run_game, maps, Race, Difficulty
from sc2.player import Bot, Computer
from sc2.constants import NEXUS, PROBE
## producing more workers
## We just need a nexus for producing workers
## reference a nexus
class SentdeBot(sc2.BotAI):
async def on_step(self, iteration):
# define an ansynchronous method
# every step we get, what will we do
await self.distribute_workers()
#already defined
await self.builder_workers()
#doesnt exist yet
async def builder_workers(self):
for nexus in self.units(NEXUS).ready.noqueue:
# Nexus must be ready
# no queue - nothing else in the queue
if self.can_afford(PROBE):
## inherited probe
await self.do(nexus.train(PROBE))
run_game(maps.get("AbyssalReefLE"), [Bot(Race.Protoss, SentdeBot()), Computer(Race.Terran, Difficulty.Easy)], realtime=True)
# specify where - which map
# player list
# run-speed -T - nomral speed, F = ultra fast