-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
55 lines (51 loc) · 1.6 KB
/
run.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
52
53
54
55
import sys
from __init__ import run_ladder_game
from sc2.data import Race, Difficulty, AIBuild
from sc2.player import Bot, Computer, Human
import random
from sc2 import maps
from sc2.main import run_game
import time
from run_data import DataName
# Load bot
from bot_main import BotStardust
bot = Bot(Race.Protoss, BotStardust())
# Start game
if __name__ == "__main__":
if "--LadderServer" in sys.argv:
# Ladder game started by LadderManager
print("Starting ladder game...")
result, opponentid = run_ladder_game(bot)
print(f"{result} against opponent {opponentid}")
else:
# Local game
print("Starting local game...")
map_name = random.choice(
[
"AcropolisLE",
"DiscoBloodbathLE",
"ThunderbirdLE",
"TritonLE",
"WintersGateLE",
"WorldofSleepersLE",
"2000AtmospheresAIE",
"BerlingradAIE",
"JagannathaLE",
"KairosJunctionLE",
]
)
opponent_race = Race.Protoss
difficulty = Difficulty.CheatMoney
replay_name = "./replay/" + map_name + time.strftime("%m%d%H%M") + \
DataName.difficulty[difficulty] + ".SC2Replay"
# map_name = "(2)16-BitLE"
run_game(
maps.get(map_name),
[
# Human(Race.Protoss),
bot,
Computer(opponent_race, difficulty), # CheatInsane VeryHard
],
realtime=False,
save_replay_as=replay_name
)