-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.py
39 lines (32 loc) · 937 Bytes
/
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
import random
import json
from sc2 import run_game, maps, Race, Difficulty
from sc2.player import Bot, Computer
from bot import MyBot
def pick_map(all_maps=False):
if all_maps:
return random.choice(maps.get())
else:
mapset = [
"(2)DreamcatcherLE",
"(2)LostandFoundLE",
"(2)RedshiftLE"
]
return maps.get(random.choice(mapset))
def main():
with open("botinfo.json") as f:
info = json.load(f)
race = Race[info["race"]]
run_game(
pick_map(True),
[
Bot(race, MyBot()),
Computer(Race.Random, Difficulty.VeryHard)
],
realtime=False,
step_time_limit=0.5, # We use locally much stricter limit than in the competition
game_time_limit=(60*60), # Challenge has 60min gametime limit
save_replay_as="latest.SC2Replay"
)
if __name__ == '__main__':
main()