-
Notifications
You must be signed in to change notification settings - Fork 175
Expand file tree
/
Copy pathshow_debug.py
More file actions
28 lines (24 loc) · 854 Bytes
/
show_debug.py
File metadata and controls
28 lines (24 loc) · 854 Bytes
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
import sc2
from sc2 import run_game, maps, Race, Difficulty
from sc2.player import Bot, Computer
class MyBot(sc2.BotAI):
async def on_step(self, iteration):
for unit in self.units:
self._client.debug_text_world(
"\n".join([
f"{unit.type_id.name}:{unit.type_id.value}",
f"({unit.position.x:.2f},{unit.position.y:.2f})",
f"{unit.build_progress:.2f}",
] + [repr(x) for x in unit.orders]),
unit.position3d,
color=(0, 255, 0),
size=12,
)
await self._client.send_debug()
def main():
run_game(maps.get("Abyssal Reef LE"), [
Bot(Race.Terran, MyBot()),
Computer(Race.Protoss, Difficulty.Medium)
], realtime=True)
if __name__ == '__main__':
main()