-
Notifications
You must be signed in to change notification settings - Fork 168
/
Copy pathbot_vs_bot.py
51 lines (42 loc) · 1.22 KB
/
bot_vs_bot.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"""
This script shows how to let two custom bots play against each other.
"""
from __future__ import annotations
from loguru import logger
from examples.protoss.warpgate_push import WarpGateBot
from examples.zerg.zerg_rush import ZergRushBot
from sc2 import maps
from sc2.data import Race, Result
from sc2.main import GameMatch, run_game, run_multiple_games
from sc2.player import Bot
def main_old():
result: list[Result] = run_game(
maps.get("AcropolisLE"),
[
Bot(Race.Protoss, WarpGateBot()),
Bot(Race.Zerg, ZergRushBot()),
],
realtime=False,
game_time_limit=2,
save_replay_as="Example.SC2Replay",
)
logger.info(f"Result: {result}")
def main():
result = run_multiple_games(
[
GameMatch(
map_sc2=maps.get("AcropolisLE"),
players=[
Bot(Race.Protoss, WarpGateBot()),
Bot(Race.Zerg, ZergRushBot()),
],
realtime=False,
game_time_limit=2,
)
]
)
logger.info(f"Result: {result}")
if __name__ == "__main__":
main_old()
# TODO Why does "run_multiple_games" get stuck?
# main()