-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
36 lines (31 loc) · 1006 Bytes
/
main.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
from pysc2.env import sc2_env
from pysc2.lib import actions, features
from overmind import zerg
from absl import app
def main(unused_argv):
agent = zerg()
map = 'AbyssalReef'
dims = features.Dimensions(screen = 84, minimap = 64)
agent_iface_fmt = features.AgentInterfaceFormat(feature_dimensions = dims, use_feature_units = True)
player_setup = [sc2_env.Agent(sc2_env.Race.zerg), sc2_env.Bot(sc2_env.Race.protoss, sc2_env.Difficulty.very_easy)]
try:
while True:
with sc2_env.SC2Env(
map_name = map,
players = player_setup,
agent_interface_format=agent_iface_fmt,
step_mul = 16,
game_steps_per_episode = 0,
visualize = False) as env:
agent.setup(env.observation_spec(), env.action_spec())
timesteps = env.reset()
agent.reset()
while True:
step_actions = [agent.step(timesteps[0])]
if timesteps[0].last():
break
timesteps = env.step(step_actions)
except KeyboardInterrupt:
pass
if __name__ == "__main__":
app.run(main)