Commit b6c6e170 authored by Siddhartha Laghuvarapu's avatar Siddhartha Laghuvarapu
Browse files

Add tqdm bar to rollout.py

parent c766f1b8
......@@ -13,6 +13,8 @@ from config import LocalEvaluationConfig
import random
import copy
from tqdm import tqdm
class ProxyEnv(Env):
def step(self, actions, preprocess=set(), omitDead=True):
......@@ -75,6 +77,7 @@ def assign_agents(player_agent, opponent_agents):
def run_episode(player_index, agents, N_TIME_STEPS):
config = projekt.config.CompetitionRound1()
config.RENDER = True
env = ProxyEnv(config)
n_steps = 0
neural_agents = set()
......@@ -92,9 +95,9 @@ def run_episode(player_index, agents, N_TIME_STEPS):
for entid in entids:
actions[entid] = agents[entid_agent_map[entid]].register_reset(obs[entid])
alive_agents = list(obs.keys())
pbar = tqdm(total = N_TIME_STEPS)
while len(obs.keys()) > 0 and n_steps < N_TIME_STEPS:
pbar.update(n=1)
for entid in actions:
if entid not in neural_agents:
realm = env.realm
......@@ -157,7 +160,7 @@ if __name__ == "__main__":
player_agent, opponent_agents = load_agents(LocalEvaluationConfig)
player_agent = player_agent[0]
N_EPISODES = 2
N_TIME_STEPS = 10
N_TIME_STEPS = 1024
for episode in range(N_EPISODES):
agents, player_index = assign_agents(player_agent, opponent_agents)
statistics = run_episode(player_index, agents, N_TIME_STEPS)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment